Skip to content

Instantly share code, notes, and snippets.

@aavogt
Created February 22, 2016 18:10
Show Gist options
  • Select an option

  • Save aavogt/b60fa8b50384f84832a3 to your computer and use it in GitHub Desktop.

Select an option

Save aavogt/b60fa8b50384f84832a3 to your computer and use it in GitHub Desktop.
reify does not report the use of PromotedT
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
module C where
class C (a :: Bool)
instance C True
instance C 'False -- ' syntax doesn't make a difference
{-# 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