-
-
Save aavogt/b60fa8b50384f84832a3 to your computer and use it in GitHub Desktop.
reify does not report the use of PromotedT
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
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE KindSignatures #-} | |
| module C where | |
| class C (a :: Bool) | |
| instance C True | |
| instance C 'False -- ' syntax doesn't make a difference |
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
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE TemplateHaskell #-} | |
| {-# LANGUAGE KindSignatures #-} | |
| module Main where | |
| import C | |
| import Language.Haskell.TH | |
| main = do | |
| putStrLn "reify uses ConT True" | |
| mapM_ putStrLn $(do | |
| ClassI _ insts <- reify ''C | |
| listE (map (\ (InstanceD _ hd _) -> stringE (show hd)) insts)) | |
| putStrLn "\noxford brackets use PromotedT" | |
| putStrLn $([t| C True |] >>= stringE . show) | |
| {- runghc Main with 7.10.2 | |
| reify uses ConT True | |
| AppT (ConT C.C) (ConT GHC.Types.False) | |
| AppT (ConT C.C) (ConT GHC.Types.True) | |
| oxford brackets use PromotedT | |
| AppT (ConT C.C) (PromotedT GHC.Types.True) | |
| -} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment