Commit 8513c0ac authored by simonpj's avatar simonpj
Browse files

[project @ 2002-10-30 09:32:55 by simonpj]

Newtype record-selector test
parent 36be1ab2
......@@ -160,3 +160,4 @@ test('tc159', normal, compile, [''])
test('tc160', normal, compile, [''])
test('tc161', normal, compile, [''])
test('tc162', normal, compile, [''])
test('tc163', normal, compile, [''])
{-# OPTIONS -fglasgow-exts #-}
-- This one killed GHC 5.05 and earlier
-- The problem was in a newtype with a record selector, with
-- a polymorphic argument type. MkId generated a bogus selector
-- function
module ShouldCompile where
type M3 a = forall r. (forall b. M3' b -> (b -> M3' a) -> r) -> r
newtype M3' a
= M3' { mkM3' :: M3 a }
bind :: M3 a -> (a -> M3 b) -> M3 b
bind m k b = b (M3' m) (\a -> M3' (k a))
observe :: M3 a -> a
observe m
= m (\m' k -> mkM3' m'
(\bm k1 -> observe (bind (mkM3' bm)
(\a -> bind (mkM3' (k1 a)) (\a -> mkM3' (k a)))))
)
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