Commit 1a19250a authored by batterseapower's avatar batterseapower
Browse files

Tests for unboxed tuple sections

parent 5e8ff849
-- TupleSections not enabled
{-# LANGUAGE UnboxedTuples #-}
module Foo where
foo = (1,)
bar = (# 1, #)
rnfail056.hs:5:6: Illegal tuple section: use -XTupleSections
rnfail056.hs:6:6: Illegal tuple section: use -XTupleSections
rnfail056.hs:8:6: Illegal tuple section: use -XTupleSections
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TupleSections, UnboxedTuples #-}
module Main where
a :: Bool -> (Int, Bool)
......@@ -10,4 +10,13 @@ b = (1, )
c :: a -> (a, Bool)
c = (True || False, )
d :: Bool -> (#Int, Bool#)
d = (# , True#)
e :: Int -> Bool -> (#Int, Bool#)
e = (#1, #)
f :: a -> (#a, Bool#)
f = (#True || False, #)
main = return ()
\ No newline at end of file
......@@ -22,3 +22,27 @@ tcfail206.hs:11:4:
Inferred type: a -> (Bool, a)
In the expression: (True || False,)
In the definition of `c': c = (True || False,)
tcfail206.hs:14: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 `d': d = (# , True #)
tcfail206.hs:17: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 `e': e = (# 1, #)
tcfail206.hs:20:4:
Couldn't match expected type `a' against inferred type `Bool'
`a' is a rigid type variable bound by
the type signature for `f' at tcfail206.hs:19:5
Expected type: a -> (# a, Bool #)
Inferred type: a -> (# Bool, a #)
In the expression: (# True || False, #)
In the definition of `f': f = (# True || False, #)
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TupleSections, UnboxedTuples #-}
module Main where
a :: Int -> (Int, Bool)
......@@ -12,4 +12,21 @@ c = (, True || False)
d = (,1,)
main = print (a 1, b False, c "Hello", c 1337, d "Yeah" "Baby")
\ No newline at end of file
e = (# , True #)
f = (# 1, #)
g = (# , True || False #)
h = (# ,1, #)
main = do
print (a 1, b False, c "Hello", c 1337, d "Yeah" "Baby")
case e 1 of { (# x1, x2 #) ->
case f False of { (# x3, x4 #) ->
case g "Hello" of { (# x5, x6 #) ->
case g 1337 of { (# x7, x8 #) ->
case h "Yeah" "Baby" of { (# x9, x10, x11 #) ->
print (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) }}}}}
((1,True),(1,False),("Hello",True),(1337,True),("Yeah",1,"Baby"))
(1,True,1,False,"Hello",True,1337,True,"Yeah",1,"Baby")
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