Ticket #5508: THPrettyBug.hs

File THPrettyBug.hs, 398 bytes (added by mgsloan1, 4 years ago)
Line 
1{-# LANGUAGE TemplateHaskell, QuasiQuotes, ViewPatterns #-}
2
3import Language.Haskell.TH
4import Language.Haskell.TH.Quote
5
6x = mkName "x"
7
8thb = QuasiQuoter (const [| $(return . LamE [VarP x] $ VarE x) . id |])
9                  undefined undefined undefined
10
11-- Gives correct output: "(\\x -> x) GHC.Base.. GHC.Base.id"
12main = print . pprint =<< runQ [| $(return . LamE [VarP x] $ VarE x) . id |]