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

Ord instance #32

Merged
merged 2 commits into from
Apr 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ instance showMap :: (Show k, Show v) => Show (Map k v)
```


#### `ordMap`

``` purescript
instance ordMap :: (Ord k, Ord v) => Ord (Map k v)
```


#### `semigroupMap`

``` purescript
Expand Down
3 changes: 3 additions & 0 deletions src/Data/Map.purs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ instance eqMap :: (Eq k, Eq v) => Eq (Map k v) where
instance showMap :: (Show k, Show v) => Show (Map k v) where
show m = "fromList " ++ show (toList m)

instance ordMap :: (Ord k, Ord v) => Ord (Map k v) where
compare m1 m2 = compare (toList m1) (toList m2)

instance semigroupMap :: (Ord k) => Semigroup (Map k v) where
(<>) = union

Expand Down