Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- d10ListExp :: String -> Q Exp
- d10ListPat :: String -> Q Pat
Splice expressions
d10ListExp :: String -> Q Exp Source #
Produces an expression of type [
that can be used
in a Template Haskell splice.D10
]
>>>
$(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.