Commit 8756fa1d authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Add a test for deprecated [$foo| ... |] quaosquote syntax

parent 3b356932
TOP=../../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
{-# LANGUAGE TemplateHaskell #-}
module QQ where
import Language.Haskell.TH.Quote
import Language.Haskell.TH
pq = QuasiQuoter { quoteDec = \_ -> [d| f x = x |],
quoteType = \_ -> [t| Int -> Int |],
quoteExp = \_ -> [| $(varE (mkName "x")) + 1::Int |],
quotePat = \_ -> [p| Just x |] }
{-# LANGUAGE QuasiQuotes #-}
module Test where
import QQ
f :: [pq| foo |] -- Expands to Int -> Int
[pq| blah |] -- Expands to f x = x
h [pq| foo |] = f [$pq| blah |] * 8
-- Expands to h (Just x) = f (x+1) * 8
Test.hs:9:19:
Warning: Deprecated syntax:
quasiquotes no longer need a dollar sign: $pq
test('qq008',
[skip_if_fast,
extra_clean(['QQ.hi', 'QQ.o', 'Test.hi', 'Test.o']),
# We'd need to jump through some hoops to run this test the
# profiling ways, due to the TH use, so for now we just
# omit the profiling ways
omit_ways(['profc','profasm','profthreaded']),
only_compiler_types(['ghc'])],
multimod_compile,
['Test', '-v0'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment