Skip to content

Template Haskell quotes aren't reified in source-level Haskell

Summary

The expression, d, t, and p templatehaskell-quotes are syntactically magic, and don't exist anywhere as QuasiQuoters. This breaks any chance of composition.

Steps to reproduce

I'm unable to write the following:

transformType :: Type -> Type

tt = QuasiQuoter
tt = QuasiQuoter 
  { quoteType = fmap TransformType . quoteType t 
  }

foo :: [tt| Some Type |]
foo = blah

Instead I need to explicitly inline this composition anywhere I might need it:

foo = $(transformType [t| Some Type |])
foo = blah

Expected behavior

The TH-quotes behave just like any other QuasiQuoter.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information