Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
fa089da4
Commit
fa089da4
authored
Jan 02, 2006
by
jpbernardy
Browse files
[project @ 2006-01-02 19:36:50 by jpbernardy]
minor cleanups
parent
80e240f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
testsuite/tests/libraries/Data/reference/Map.hs
View file @
fa089da4
...
...
@@ -102,8 +102,8 @@ unionWith = withoutKey2 unionWithKey
unionWithKey
::
Ord
k
=>
(
k
->
a
->
a
->
a
)
->
Map
k
a
->
Map
k
a
->
Map
k
a
unionWithKey
f
m1
m2
=
L
.
map
coalese
$
L
.
groupBy
(
testing
fst
)
$
L
.
sortBy
(
comparing
fst
)
(
m1
++
m2
)
where
coalese
group
=
let
key
=
fst
(
head
group
)
in
(
key
,
foldl1
(
f
key
)
(
L
.
map
snd
group
)
)
--
coalese
::
[(k,a)]
->
(k
,a
)
where
coalese
[(
k
,
a
)]
=
(
k
,
a
)
coalese
[(
k
1
,
a
1
),(
k2
,
a2
)]
=
(
k
1
,
f
k1
a1
a2
)
unions
::
Ord
k
=>
[
Map
k
a
]
->
Map
k
a
unions
=
unionsWith
const
...
...
@@ -133,7 +133,7 @@ intersectionWith :: Ord k => (a -> b -> c) -> Map k a -> Map k b -> Map k c
intersectionWith
=
withoutKey2
intersectionWithKey
intersectionWithKey
::
Ord
k
=>
(
k
->
a
->
b
->
c
)
->
Map
k
a
->
Map
k
b
->
Map
k
c
intersectionWithKey
f
m1
m2
=
[(
k
,
f
k
x
y
)
|
(
k
,
x
)
<-
m1
,
(
k'
,
y
)
<-
m2
,
k
==
k'
]
intersectionWithKey
f
m1
m2
=
[(
k
,
f
k
x
y
)
|
(
k
,
x
)
<-
m1
,
y
<-
lookup
k
m2
]
-- * Traversal
-- ** Map
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment