digit-0.4.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 a => D4 (Digit4 a) Source # 

Methods

d4 :: Prism' (Digit4 a) () Source #

x4 :: Digit4 a Source #

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

Methods

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

x4 :: Either d x Source #

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

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