In a haskell project using template haskell, I am trying to generate an expression that has a type annotation as a phantom type.
A simple example would be a situation with DataKinds
and KindSignatures
like:
{-# LANGUAGE DataKinds, KindSignatures #-}
data Foo = A | B
data GenMe (w :: Foo) = GenMe Int
[| $(generate some code) :: GenMe $(genType someCompileTimeData) |]
How can I write a function, like genType
such that
genType :: Foo -> Q Type
lifting just lifts the variable holding the compile time Foo
value? I don't know which constructor to use from the Type Data Constructors
to make data kinds.
Any thoughts? Thanks!
Another way to slice this problem is to define a
promote :: Exp -> Maybe Type
function and then uselift
onFoo
.Then, I think something along the lines of the following should work