Skip to content

Instantly share code, notes, and snippets.

@xenophobia
Created August 18, 2012 04:04
Show Gist options
  • Save xenophobia/3384289 to your computer and use it in GitHub Desktop.
Save xenophobia/3384289 to your computer and use it in GitHub Desktop.
{-# Language TemplateHaskell, QuasiQuotes #-}
module ReifyTest where
import Language.Haskell.TH
import Language.Haskell.TH.Quote
import Data.Maybe
qq :: QuasiQuoter
qq = QuasiQuoter{quoteExp = \x -> litE . StringL .show =<< reify . fromJust =<< lookupValueName x}
---------------------------------------------------------------------
{-# Language TemplateHaskell, QuasiQuotes #-}
import Language.Haskell.TH
import ReifyTest
test :: Int -> String
test x = [qq|x|] -- error!
-- reify2.2.hs:6:14:
-- x_a11C' is not in the type environment at a reify
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment