Commit a766958a authored by simonpj's avatar simonpj
Browse files

[project @ 2005-02-28 16:05:55 by simonpj]

Add test for kind errors in record update; and synonyms in iface files
parent ced56997
......@@ -199,6 +199,8 @@ test('tc186', normal, compile, [''])
test('tc187', normal, compile, [''])
test('tc188', normal, compile, [''])
test('tc189', normal, compile, [''])
test('tc190', normal, compile, [''])
test('tc191', normal, compile, [''])
test('LoopOfTheDay1', normal, compile, [''])
test('LoopOfTheDay2', normal, compile, [''])
......
{-# OPTIONS -cpp -fglasgow-exts #-}
-- The record update triggered a kind error in GHC 6.2
module Foo where
data HT (ref :: * -> *)
= HT { kcount :: Int }
set_kcount :: Int -> HT s -> HT s
set_kcount kc ht = ht{kcount=kc}
{-# OPTIONS -fglasgow-exts #-}
-- This only typechecks if forall-hoisting works ok when
-- importing from an interface file. The type of Twins.gzipWithQ
-- is this:
-- type GenericQ r = forall a. Data a => a -> r
-- gzipWithQ :: GenericQ (GenericQ r) -> GenericQ (GenericQ [r])
-- It's kept this way in the interface file for brevity and documentation,
-- but when the type synonym is expanded, the foralls need expanding
module Foo where
import Data.Generics.Basics
import Data.Generics.Aliases
import Data.Generics.Twins(gzipWithQ)
-- | Generic equality: an alternative to \deriving Eq\
geq :: Data a => a -> a -> Bool
geq x y = geq' x y
where
geq' :: forall a b. (Data a, Data b) => a -> b -> Bool
geq' x y = (toConstr x == toConstr y)
&& and (gzipWithQ geq' x y)
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