Commit 5e8ff849 authored by batterseapower's avatar batterseapower
Browse files

Tests for basic TupleSections

parent 059783d1
......@@ -65,6 +65,7 @@ test('rnfail055',
'RnFail055_aux.hi', 'RnFail055_aux.o']),
multimod_compile_fail,
['RnFail055','-v0'])
test('rnfail056', if_compiler_lt('ghc', '6.11', expect_fail), compile_fail, [''])
test('rn_dup', normal, compile_fail, [''])
test('T2310', normal, compile_fail, [''])
......
-- TupleSections not enabled
module Foo where
foo = (1,)
rnfail056.hs:5:6: Illegal tuple section: use -XTupleSections
......@@ -200,6 +200,7 @@ test('tcfail201', normal, compile_fail, [''])
test('tcfail202', normal, compile_fail, [''])
test('tcfail203', expect_broken(2806), compile_fail, [''])
test('tcfail204', normal, compile_fail, [''])
test('tcfail206', if_compiler_lt('ghc', '6.11', expect_fail), compile_fail, [''])
test('T1899', normal, compile_fail, [''])
test('T2126', normal, compile_fail, [''])
......
{-# LANGUAGE TupleSections #-}
module Main where
a :: Bool -> (Int, Bool)
a = ( , True)
b :: Int -> Bool -> (Int, Bool)
b = (1, )
c :: a -> (a, Bool)
c = (True || False, )
main = return ()
\ No newline at end of file
tcfail206.hs:5:4:
Couldn't match expected type `Int' against inferred type `Bool'
Expected type: Bool -> (Int, Bool)
Inferred type: Bool -> (Bool, Bool)
In the expression: (, True)
In the definition of `a': a = (, True)
tcfail206.hs:8:4:
Couldn't match expected type `Bool -> (Int, Bool)'
against inferred type `(t, Int)'
Expected type: Int -> Bool -> (Int, Bool)
Inferred type: Int -> (t, Int)
In the expression: (1,)
In the definition of `b': b = (1,)
tcfail206.hs:11:4:
Couldn't match expected type `a' against inferred type `Bool'
`a' is a rigid type variable bound by
the type signature for `c' at tcfail206.hs:10:5
Expected type: a -> (a, Bool)
Inferred type: a -> (Bool, a)
In the expression: (True || False,)
In the definition of `c': c = (True || False,)
......@@ -64,6 +64,8 @@ test('tcrun038',
test('tcrun039', only_compiler_types(['ghc']), compile_and_run, [''])
test('tcrun040', normal, compile_and_run, [''])
test('tcrun041', if_compiler_lt('ghc', '6.11', expect_fail), compile_and_run, [''])
test('tcrun042', if_compiler_lt('ghc', '6.11', expect_fail), compile_and_run, [''])
test('church', normal, compile_and_run, [''])
test('testeq2', normal, compile_and_run, [''])
......
{-# LANGUAGE TupleSections #-}
module Main where
a :: Int -> (Int, Bool)
a = ( , True)
b :: Bool -> (Int, Bool)
b = (1, )
c :: a -> (a, Bool)
c = (, True || False)
d = (,1,)
main = print (a 1, b False, c "Hello", c 1337, d "Yeah" "Baby")
\ No newline at end of file
((1,True),(1,False),("Hello",True),(1337,True),("Yeah",1,"Baby"))
{-# LANGUAGE TupleSections, RankNTypes, ImpredicativeTypes #-}
module Main where
e :: a -> (forall b. b -> b -> b) -> (a, String, forall c. c -> c -> c)
e = (,"Hello" ++ "World",)
dropFunction :: (a, String, forall c. c -> c -> c) -> (a, String, Int)
dropFunction (x, y, z) = (x, y, z 10 20)
main = print (dropFunction $ e "Meh" (flip const), dropFunction $ e 10 const)
\ No newline at end of file
(("Meh","HelloWorld",20),(10,"HelloWorld",10))
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