Commit 3db76508 authored by gmainland's avatar gmainland
Browse files

Merge New Template Haskell branch.

parents c5806bf6 27c2fd71
......@@ -3,3 +3,9 @@
Multiple declarations of ‛f’
Declared at: <interactive>:3:32
<interactive>:3:68
In the Template Haskell quotation
[d| f = undefined
class Foo x where
f :: x -> x
instance Foo Int where
f = id |]
......@@ -29,7 +29,7 @@ test('ghci015', ignore_output, ghci_script, ['ghci015.script'])
test('ghci016', expect_broken(552), ghci_script, ['ghci016.script'])
test('ghci017', [reqlib('haskell98'), extra_run_opts('-hide-package haskell98')], ghci_script, ['ghci017.script'])
test('ghci018', expect_broken(1201), ghci_script, ['ghci018.script'])
test('ghci018', normal, ghci_script, ['ghci018.script'])
test('ghci019', normal, ghci_script, ['ghci019.script'])
test('ghci020', normal, ghci_script, ['ghci020.script'])
test('ghci021', normal, ghci_script, ['ghci021.script'])
......
......@@ -9,3 +9,4 @@ SafeLang12_B.hs:2:14: Warning:
SafeLang12_B.hs:14:67:
Syntax error on ''Class
Perhaps you intended to use TemplateHaskell
In the Template Haskell quotation ''Class
......@@ -24,6 +24,8 @@ instance Ord a => MyClass (Quux2 a)
class MyClass2 a b
instance MyClass2 Int Bool
$(return [])
main = do
putStrLn $(do { info <- reify ''MyClass; lift (pprint info) })
print $(isInstance ''Eq [ConT ''Foo] >>= lift)
......
......@@ -7,12 +7,16 @@ import System.IO
a = 1
$(return [])
b = $(do VarI _ t _ _ <- reify 'a
runIO $ putStrLn ("inside b: " ++ pprint t)
[| undefined |])
c = $([| True |])
$(return [])
d = $(do VarI _ t _ _ <- reify 'c
runIO $ putStrLn ("inside d: " ++ pprint t)
[| undefined |] )
......@@ -23,6 +27,8 @@ $(do VarI _ t _ _ <- reify 'c
e = $([| True |])
$(return [])
f = $(do VarI _ t _ _ <- reify 'e
runIO $ putStrLn ("inside f: " ++ pprint t)
[| undefined |] )
......
inside d: t_0
inside b: a_0
inside d: GHC.Types.Bool
type of c: GHC.Types.Bool
inside f: GHC.Types.Bool
type of e: GHC.Types.Bool
......@@ -3,4 +3,3 @@ T2597b.hs:8:8:
Empty stmt list in do-block
When splicing a TH expression: do
In the expression: $mkBug2
In an equation for ‛bug2’: bug2 = $mkBug2
T3177a.hs:8:15:
T3177a.hs:8:6:
‛Int’ is applied to too many type arguments
In the type ‛Int Int’
In the Template Haskell quotation [t| Int Int |]
In the first argument of ‛id’, namely ‛[t| Int Int |]’
In the type signature for ‛f’: f :: Int Int
T3177a.hs:11:6:
‛Int’ is applied to too many type arguments
......
......@@ -9,9 +9,3 @@ T3395.hs:6:9:
$ CompE
[NoBindS (VarE $ mkName "undefined"),
BindS (VarP $ mkName "r1") (VarE $ mkName "undefined")])
In an equation for ‛foo’:
foo
= $(return
$ CompE
[NoBindS (VarE $ mkName "undefined"),
BindS (VarP $ mkName "r1") (VarE $ mkName "undefined")])
......@@ -5,6 +5,8 @@ import Language.Haskell.TH
type family S :: (* -> (* -> * -> *)) -> (* -> *) -> *
$(return [])
test :: String
test = $(do
test <- [d|
......
......@@ -9,6 +9,8 @@ t2 x = x
prop_x1 x = t1 x == t2 x
$(return [])
runTests = $( do VarI _ t _ _ <- reify (mkName "prop_x1")
error $ ("runTest called error: " ++ pprint t)
)
T5358.hs:7:1:
Couldn't match expected type ‛t1 -> t1’ with actual type ‛Int’
The equation(s) for ‛t1’ have one argument,
but its type ‛Int’ has none
T5358.hs:8:1:
Couldn't match expected type ‛t0 -> t0’ with actual type ‛Int’
The equation(s) for ‛t2’ have one argument,
but its type ‛Int’ has none
T5358.hs:10:13:
Couldn't match expected type ‛t -> a0’ with actual type ‛Int’
Relevant bindings include
x :: t (bound at T5358.hs:10:9)
prop_x1 :: t -> Bool (bound at T5358.hs:10:1)
The function ‛t1’ is applied to one argument,
but its type ‛Int’ has none
In the first argument of ‛(==)’, namely ‛t1 x’
In the expression: t1 x == t2 x
T5358.hs:10:21:
Couldn't match expected type ‛t -> a0’ with actual type ‛Int’
Relevant bindings include
x :: t (bound at T5358.hs:10:9)
prop_x1 :: t -> Bool (bound at T5358.hs:10:1)
The function ‛t2’ is applied to one argument,
but its type ‛Int’ has none
In the second argument of ‛(==)’, namely ‛t2 x’
In the expression: t1 x == t2 x
T5358.hs:12:15:
T5358.hs:14:15:
Exception when trying to run compile-time code:
runTest called error: forall t_0 . t_0 -> GHC.Types.Bool
Code: do { VarI _ t _ _ <- reify (mkName "prop_x1");
......@@ -37,7 +7,3 @@ T5358.hs:12:15:
In the expression:
$(do { VarI _ t _ _ <- reify (mkName "prop_x1");
error $ ("runTest called error: " ++ pprint t) })
In an equation for ‛runTests’:
runTests
= $(do { VarI _ t _ _ <- reify (mkName "prop_x1");
error $ ("runTest called error: " ++ pprint t) })
......@@ -4,4 +4,3 @@ T5795.hs:9:6:
‛ty’ is used in a top-level splice or annotation,
and must be imported, not defined locally
In the expression: ty
In the type signature for ‛f’: f :: $ty
......@@ -8,4 +8,3 @@ T5971.hs:6:7:
$(newName "x" >>= varE)
To see what the splice expanded to, use -ddump-splices
In the expression: $(newName "x" >>= varE)
In a pattern binding: _ = $(newName "x" >>= varE)
......@@ -10,8 +10,3 @@ T6114.hs:6:17:
instanceType <- [t| $(varT xName) |];
_ <- reifyInstances ''Eq [instanceType];
.... })
In an equation for ‛instanceVar’:
instanceVar
= $(do { xName <- newName "x";
instanceType <- [t| $(varT xName) |];
.... })
......@@ -5,7 +5,7 @@ instance C Bool where
==================== Renamer ====================
bang
$bang
T7532.hs:1:1: Splicing declarations
bang
......
......@@ -10,6 +10,8 @@ instance C Int
type D a = C a
$(return [])
main = print $(
do isCInst <- isInstance ''C [ConT ''Int]
isDInst <- isInstance ''D [ConT ''Int]
......
......@@ -3,4 +3,3 @@ TH_1tuple.hs:11:7:
Illegal 1-tuple type constructor
When splicing a TH expression: 1 :: ()
In the expression: $(sigE [| 1 |] (tupleT 1))
In an equation for ‛y’: y = $(sigE [| 1 |] (tupleT 1))
......@@ -5,6 +5,7 @@ import Language.Haskell.TH
ds :: Q [Dec]
ds = [d|
$(dataD [] (mkName "D") [] [normalC "K" []] [])
$(do { d <- dataD (cxt []) (mkName "D") [] [normalC (mkName "K") []] []
; return [d]})
|]
TH_dataD1.hs:8:13:
Declaration splices are not permitted inside declaration brackets
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