d10-1.0.1.3: Digits 0-9
Safe HaskellTrustworthy
LanguageGHC2021

D10.Num.Splices

Synopsis

Expressions

d10Exp :: Integer -> Q Exp Source #

Produces an expression of type D10 a that can be used in a Template Haskell splice.

>>> d10Nat $(d10Exp 5) 5 
>>> d10Nat $(d10Exp 12) ... ... d10 must be between 0 and 9 ... 

You may also be interested in d10, a quasi-quoter which does something similar.

d10ListExp :: String -> Q Exp Source #

Produces an expression of type [D10 a] that can be used in a Template Haskell splice.

>>> d10Nat <$> $(d10ListExp "") [] 
>>> d10Nat <$> $(d10ListExp "5") [5] 
>>> d10Nat <$> $(d10ListExp "58") [5,8] 
>>> d10Nat <$> $(d10ListExp "a") ... ... d10 must be between 0 and 9 ... 

You may also be interested in d10list, a quasi-quoter which does something similar.

Patterns

d10Pat :: Integer -> Q Pat Source #

Produces a pattern that can be used in a splice to match a particular D10 a value.

>>> :{  case (charD10Maybe '5') of Just $(d10Pat 4) -> "A" Just $(d10Pat 5) -> "B" _ -> "C" >>> :} "B" 

You may wish to use the d10 quasi-quoter instead.

d10ListPat :: String -> Q Pat Source #

Produces a pattern that can be used in a splice to match a particular list of D10 a values.

>>> :{  case (strD10ListMaybe "56") of Just $(d10ListPat "42") -> "A" Just $(d10ListPat "56") -> "B" _ -> "C" >>> :} "B" 

You may wish to use the d10list quasi-quoter instead.