Created
April 19, 2021 19:33
-
-
Save parsonsmatt/4747a846085889bde5dce08c37a40f45 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
liftType :: forall t. Typeable t => Q Type | |
liftType = do | |
let rep = typeRep @t | |
go rep | |
where | |
go :: forall (a :: k). TypeRep a -> Q Type | |
go tr = | |
case tr of | |
Con tyCon -> do | |
let | |
nameBase = | |
mkOccName $ tyConName tyCon | |
flavor = | |
NameG | |
TcClsName | |
(mkPkgName $ tyConPackage tyCon) | |
(mkModName $ tyConModule tyCon) | |
name = | |
Name | |
nameBase | |
flavor | |
pure $ ConT name | |
App trA trB -> | |
[t|$(go trA) $(go trB)|] | |
Fun trA trB -> | |
[t|$(go trA) -> $(go trB)|] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now a
major motion pictureCabal package!