From: simonm Date: Mon, 8 Sep 1997 09:48:03 +0000 (+0000) Subject: [project @ 1997-09-08 09:48:01 by simonm] X-Git-Tag: Approx_2487_patches~1515 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=dbcefc27cc4566935c1351348d9d287f82bbdf8f;p=ghc-hetmet.git [project @ 1997-09-08 09:48:01 by simonm] reinstate tests that now work. --- diff --git a/ghc/tests/typecheck/should_compile/tc081.hs b/ghc/tests/typecheck/should_compile/tc081.hs new file mode 100644 index 0000000..6590550 --- /dev/null +++ b/ghc/tests/typecheck/should_compile/tc081.hs @@ -0,0 +1,28 @@ +--!!! an example Simon made up +-- +module ShouldSucceed where + +f x = (x+1, x<3, g True, g 'c') + where + g y = if x>2 then [] else [y] +{- +Here the type-check of g will yield an LIE with an Ord dict +for x. g still has type forall a. a -> [a]. The dictionary is +free, bound by the x. + +It should be ok to add the signature: +-} + +f2 x = (x+1, x<3, g2 True, g2 'c') + where + -- NB: this sig: + g2 :: a -> [a] + g2 y = if x>2 then [] else [y] +{- +or to write: +-} + +f3 x = (x+1, x<3, g3 True, g3 'c') + where + -- NB: this line: + g3 = (\ y -> if x>2 then [] else [y])::(a -> [a]) diff --git a/ghc/tests/typecheck/should_run/tcrun001.hs b/ghc/tests/typecheck/should_run/tcrun001.hs new file mode 100644 index 0000000..f45f506 --- /dev/null +++ b/ghc/tests/typecheck/should_run/tcrun001.hs @@ -0,0 +1,16 @@ +--!! Test for (->) instances + +module ShouldRun where + +class Flob k where + twice :: k a a -> k a a + +instance Flob (->) where + twice f = f . f + +inc :: Int -> Int +inc x = x+1 + +main = print (twice inc 2) + +