Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Commit 6a7f05f

Browse files
committed
Merge pull request #32 from AKST/ord-instance
Ord instance
2 parents a9e88d6 + e0ddf77 commit 6a7f05f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ instance showMap :: (Show k, Show v) => Show (Map k v)
2828
```
2929

3030

31+
#### `ordMap`
32+
33+
``` purescript
34+
instance ordMap :: (Ord k, Ord v) => Ord (Map k v)
35+
```
36+
37+
3138
#### `semigroupMap`
3239

3340
``` purescript

src/Data/Map.purs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ instance eqMap :: (Eq k, Eq v) => Eq (Map k v) where
4646
instance showMap :: (Show k, Show v) => Show (Map k v) where
4747
show m = "fromList " ++ show (toList m)
4848

49+
instance ordMap :: (Ord k, Ord v) => Ord (Map k v) where
50+
compare m1 m2 = compare (toList m1) (toList m2)
51+
4952
instance semigroupMap :: (Ord k) => Semigroup (Map k v) where
5053
(<>) = union
5154

0 commit comments

Comments
 (0)