[GHC] #8460: Annotation reification with types in TH
GHC
ghc-devs at haskell.org
Wed Oct 23 13:32:10 UTC 2013
#8460: Annotation reification with types in TH
-------------------------------+-------------------------------------------
Reporter: errge | Owner:
Type: feature | Status: patch
request | Milestone: 7.10.1
Priority: normal | Version: 7.7
Component: Template | Keywords:
Haskell | Architecture: Unknown/Multiple
Resolution: | Difficulty: Easy (less than 1 hour)
Operating System: | Blocked By:
Unknown/Multiple | Related Tickets: #8397
Type of failure: |
None/Unknown |
Test Case: |
Blocking: |
-------------------------------+-------------------------------------------
Comment (by monoidal):
I like `liftTyped`. I would go even further and add it to the `Lift`
class:
{{{
class Lift t where
lift :: t -> Q Exp
liftTyped :: t -> Q (TExp t)
lift = unTypeQ . liftTyped
liftTyped = unsafeTExpCoerce . lift
{-# MINIMAL lift | liftTyped #-}
}}}
Now, when you write an instance of `Lift`
{{{
data A = A
instance Lift A where
liftTyped A = [e|| A ||]
}}}
the compiler will detect if you mistakenly use a different type in the
`[e|| ... ||]` brackets.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8460#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list