This is a distilled version of a problem that arose in a student's program:

> f :: a -> a
> f x = g
>    where
>    g :: a
>    g = x

Reading file "[...]":
Type checking
ERROR "[...]" (line 5): Inferred type is not general enough
*** Expression    : g
*** Expected type : a
*** Inferred type : _2

Yet if the inner type declaration is omitted:

> f :: a -> a
> f x = g
>    where
>    -- g :: a
>    g = x

it compiles without a hitch.

Is there a simple explanation for this phenomenon?

Thanks,

--Ham



------------------------------------------------------------------
Hamilton Richards Jr.            Department of Computer Sciences
Senior Lecturer                  Mail Code C0500
512-471-9525                     The University of Texas at Austin
SHC 434                          Austin, Texas 78712-1188
[EMAIL PROTECTED]
------------------------------------------------------------------


Reply via email to