Consider the following record (yes, I know, we all hate records but
I use them frequently for read-only data):
> import IO
>
> class Foo a where
> bar :: a -> [a]
>
> instance Foo Int where
> bar x = replicate x x
>
> data Record = R {
> blub :: Foo a => a -> [a]
> }
>
> main = do
> let r = R {blub = bar}
>
> print (bar (3::Int)) -- works!
> --print ((blub r) (3::Int)) -- doesn�t compile!
As long as I don�t try to use "r", everything works fine. Using the latter
print-statement, ghc yields
classTest.lhs:14:
Couldn't match `Int' against `{Foo a}'
Expected type: Int
Inferred type: {Foo a}
In an expression with a type signature: 3 :: Int
Hugs (Feb�00) is much more eager and wouldn�t even load the working case:
ERROR "classTest.lhs" (line 10): Undefined type variable "a".
Shouldn�t ghc reject the record-declaration altogether like Hugs? Why can�t
I use the record like I�m doing in the first place?
--
\usepackage[latin1]{inputenc}!
Volker Stolz * [EMAIL PROTECTED] * PGP + S/MIME
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs