Ambiguous type variable

Jorge Adriano jadrian@mat.uc.pt
Wed, 22 Jan 2003 18:55:32 +0000


> > This works fine, as expected
> >
> > > f :: (Num a, Random a) =3D> Int -> [a]
> > > f =3D randomRs (0,1).mkStdGen
> >
> > If I skip the type signature, though, I get the following error messa=
ges:
> > ...
>
> You just tripped over the infamous monomorphic restriction of Haskell:
> A variable that is defined like a constant (no arguments before "=3D") =
is
> not allowed to be overloaded (have a class context), except when the
> type of the variable is explicitly given.
Oh, yes of course... I knew that :)
Sorry to waste your time over this, thanks!=20

J.A.