Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utility Template Haskell macros.
Documentation
cstaticDict :: Name -> ExpQ Source #
Abbreviation for closure (static Dict)
. Example usage:
foo :: Closure (Dict (Num a)) -> ... foo $cdict ...
withStatic :: DecsQ -> DecsQ Source #
Auto-generates the Static
instances corresponding to the given class
instances. Example:
data T a = T a
withStatic [d| instance Show a => Show (T a) where ... |]
======>
instance Show a => Show (T a) where ...
instance (Static (Show a), Typeable a) => Static (Show (T a)) where
closureDict = closure (static (Dict -> Dict)) cap
closureDict
You will probably want to enable FlexibleContexts
and ScopedTypeVariables
in modules that use withStatic
.