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
contain any bound or free variable names
(or any in general any values that are themselves non-trivial
instances of 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.
newtype 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 _ = mempty -- nthPatFind _ = mempty -- namePatFind _ _ = mempty -- swaps' _ _ = id -- freshen' _ i = return (i, mempty) -- lfreshen' _ i cont = cont i mempty