Skip to content

Commit

Permalink
Merge pull request #11 from jdegoes/ready/char-instances
Browse files Browse the repository at this point in the history
added essential instances for Char; fully backward compatible
  • Loading branch information
paf31 committed Oct 16, 2014
2 parents 976d330 + 2a044ec commit 7f7bd7b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
newtype Char


### Type Class Instances

instance eqChar :: Eq Char

instance ordChar :: Ord Char

instance showChar :: Show Char


### Values

charString :: Char -> String
Expand Down
10 changes: 10 additions & 0 deletions src/Data/Char/Char.purs
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@ module Data.Char
\ return String.fromCharCode(c);\
\}" :: Number -> Char

instance eqChar :: Eq Char where
(==) (Char a) (Char b) = a == b

(/=) a b = not (a == b)

instance ordChar :: Ord Char where
compare (Char a) (Char b) = a `compare` b

instance showChar :: Show Char where
show (Char s) = "Char " ++ show s

0 comments on commit 7f7bd7b

Please sign in to comment.