digit-0.5.2: 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 Digit Source # 

Methods

d2 :: Prism' Digit () Source #

x2 :: Digit Source #

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

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