Commit a79e782b authored by sof's avatar sof
Browse files

[project @ 1997-05-18 01:49:22 by sof]

New test
parent c21106a2
{- The purpose of this is to test that record update is
sufficiently polymorphic. See comments with
tcExpr (RecordUpd) in TcExpr.lhs
-}
module Main where
data T a b c d = MkT1 { op1 :: a, op2 :: b }
| MkT2 { op1 :: a, op3 :: c }
| MkT3 { op4 :: a, op5 :: d }
update1 :: a2 -> T a b c d -> T a2 b c d2
update1 x t = t { op1 = x }
-- NB: the MkT3.op4 case doesn't constrain the result because
-- it doesn't have an op1 field
update2 :: a2 -> T a b c d -> T a2 b2 c2 d
update2 x t = t { op4 = x }
main = print (op4 $
update2 True $
MkT3 { op4 = op2 $
update1 (1::Int) $
MkT1 { op1 = True }
})
TOP = ../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/target.mk
-- This test checks that constructors with strictness annotations
-- at least parse correctly. In GHC 2.02 they didn't!
module Main where
data Foo1 = Crunch1 ! Int ! Int Int deriving( Show )
data Foo2 = Crunch2 ! Int Int Int deriving( Show )
main = do
print (Crunch1 (1+1) (2+2) (3+3))
print (Crunch2 (1+1) (2+2) (3+3))
TOP = ../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/target.mk
Supports Markdown
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