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

Safe HaskellNone
LanguageHaskell2010

Data.Digit.D2

Synopsis

Documentation

class D2 d where Source #

Minimal complete definition

d2

Methods

d2 :: Prism' d () Source #

x2 :: d Source #

Instances

D2 () Source # 

Methods

d2 :: Prism' () () Source #

x2 :: () Source #

D2 a => D2 (Digit2 a) Source # 

Methods

d2 :: Prism' (Digit2 a) () Source #

x2 :: Digit2 a Source #

D2 d => D2 (Either d x) Source # 

Methods

d2 :: Prism' (Either d x) () Source #

x2 :: Either d x Source #

parse2 :: (D2 d, CharParsing p) => p d Source #

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