Commit 9d799482 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Simplify TH_unresolvedInfix2

parent c25980fe
module TH_unresolvedInfix2 where
import TH_unresolvedInfix_Lib
import Language.Haskell.TH
expr = $( infixE Nothing plus (Just $ n +? n) )
infixl 6 :+
data Tree = N
| Tree :+ Tree
| Tree :* Tree
-- Should fail
expr = $( let plus = conE '(:+)
n = conE 'N
in infixE Nothing plus (Just $ uInfixE n plus n) )
TH_unresolvedInfix2.hs:6:11:
The operator `:+' [infixl 6] of a section
must have lower precedence than that of the operand,
namely `:+' [infixl 6]
in the section: `:+ N :+ N'
In the result of the splice:
$(infixE Nothing plus (Just $ n +? n))
To see what the splice expanded to, use -ddump-splices
In the expression: $(infixE Nothing plus (Just $ n +? n))
In an equation for `expr':
expr = $(infixE Nothing plus (Just $ n +? n))
TH_unresolvedInfix2.hs:12:11:
The operator `:+' [infixl 6] of a section
must have lower precedence than that of the operand,
namely `:+' [infixl 6]
in the section: `:+ N :+ N'
In the result of the splice:
$(let
plus = conE ':+
n = conE 'N
in infixE Nothing plus (Just $ uInfixE n plus n))
To see what the splice expanded to, use -ddump-splices
In the expression:
$(let
plus = conE ...
n = conE ...
in infixE Nothing plus (Just $ uInfixE n plus n))
In an equation for `expr':
expr
= $(let
plus = ...
....
in infixE Nothing plus (Just $ uInfixE n plus n))
......@@ -189,6 +189,6 @@ test('TH_unresolvedInfix',
multimod_compile_and_run,
['TH_unresolvedInfix.hs', '-v0'])
test('TH_unresolvedInfix2',
extra_clean(['TH_unresolvedInfix_Lib.hi', 'TH_unresolvedInfix_Lib.o']),
multimod_compile_fail,
['TH_unresolvedInfix2.hs', '-v0'])
normal,
compile_fail,
['-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