Copyright | (c) 2015, Aleksey Kliger |
---|---|
License | BSD3 (See LICENSE) |
Maintainer | Aleksey Kliger |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Extensions | TemplateHaskell |
- makeClosedAlpha :: Name -> DecsQ
Documentation
makeClosedAlpha :: Name -> DecsQ Source
Make a trivial instance
for a type Alpha
TT
that does not
contains no bound nor free values of type
or Name
a
(or any in general any values that are themselves non-trivial
instances of AnyName
Alpha
). Use this to write Alpha
instances for
types that you don't want to traverse via their GHC.Generics.Rep
representation just to find out that there aren't any names.
@@
data T = T Int deriving (Eq, Ord, Show)
$(makeClosedAlpha T)
-- constructs
-- instance Alpha T where
-- aeq' _ = (==)
-- acompare' _ = compare
-- fvAny' _ _ = pure
-- close _ _ = id
-- open _ _ = id
-- isPat _ = mempty
-- isTerm _ = True
-- nthPatFind _ = Left
-- namePatFind _ _ = Left 0
-- swaps' _ _ = id
-- freshen' _ i = return (i, mempty)
-- lfreshen' _ i cont = cont i mempty
@@