digit-0.5.0: A data-type representing digits 0-9 and other combinations

Safe HaskellNone
LanguageHaskell2010

Data.Digit.D4

Synopsis

Documentation

class D4 d where Source #

Minimal complete definition

d4

Methods

d4 :: Prism' d () Source #

x4 :: d Source #

Instances

D4 () Source # 

Methods

d4 :: Prism' () () Source #

x4 :: () Source #

D4 Digit Source # 

Methods

d4 :: Prism' Digit () Source #

x4 :: Digit Source #

parse4 :: (D4 d, CharParsing p) => p d Source #

>>> parse (parse4 <* eof) "test" "4" :: Either ParseError Digit
Right 4
>>> parse parse4 "test" "4xyz" :: Either ParseError Digit
Right 4
>>> isn't _Right (parse parse4 "test" "xyz" :: Either ParseError Digit)
True 
\c -> c /= '4' ==> isn't _Right (parse parse4 "test" [c] :: Either ParseError Digit)