Add TH combinator maybeD.

This commit is contained in:
Kei Hibino 2013-05-08 14:43:38 +09:00
parent f52371e0ad
commit d92fc81b1f

View File

@ -4,7 +4,7 @@ module Language.Haskell.TH.Name.Extra (
compileErrorIO, compileError,
integralE, simpleValD
integralE, simpleValD, maybeD
) where
import Language.Haskell.TH
@ -32,3 +32,6 @@ simpleValD var typ expr = do
sig <- sigD var typ
val <- valD (varP var) (normalB expr) []
return [sig, val]
maybeD :: (a -> Q [Dec]) -> Maybe a -> Q [Dec]
maybeD = maybe (return [])