hello,
just skip the forall. "free" type variables are implicitly forall-quantified.
the forall keyword is used for functions that need to take polymorphic functions
as arguments, but that's advanced stuff.
so in short, this should work:


> class Space t
> class Space t => HasY v t
>   where
>     assignY :: v -> t -> t
>     getY :: t -> v
>     varY ::  Space w => v -> (t->t) -> (w->w)

the next problem you are likely to run into is ambiguities,
and you might want to take a look at functional dependencies.

hope this helps
iavor


Theodore S. Norvell wrote:



Can anyone explain the following error message from Hug98 (with extensions enabled)?

I have

> class Space t
> class Space t => HasY v t
>   where
>     assignY :: v -> t -> t
>     getY :: t -> v
>     varY :: forall w . Space w => v -> (t->t) -> (w->w)

I get an error on the last definition "quantifier does not
mention type variable v" (and if I quantify v, then it complains
that t is not quantified).

The idea I'm trying to express is that for any instance of HasY v t
there should be a function varY with type
             v -> (t->t) -> (w->w)
for some type w of class Space.

Any help much appreciated.

Is there any kind of tutorial introduction to "forall" out there?

Cheers,
Theo Norvell

_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe



--
==================================================
| Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering |
| School of OGI at OHSU |
| http://www.cse.ogi.edu/~diatchki |
==================================================


_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to