d10-1.0.1.0: Digits 0-9
Safe HaskellSafe
LanguageHaskell2010

D10.Safe.Splices

Synopsis

Splice expressions

d10ListExp :: String -> Q Exp Source #

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

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

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

Splice patterns

d10ListPat :: String -> Q Pat Source #

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

>>> :{
      case [D5, D6] of
        $(d10ListPat "42") -> "A"
        $(d10ListPat "56") -> "B"
        _                  -> "C"
>>> :}
"B"

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