[Haskell-beginners] help with a class definition

Daniel Fischer daniel.is.fischer at googlemail.com
Mon Nov 28 16:01:27 CET 2011


On Monday 28 November 2011, 15:21:56, Rustom Mody wrote:
> The Data.Vector.Unboxed page on hackage has the following line
> 
> class (Vector Vector a, MVector MVector a) => Unbox a
> 
> Can someone explain whats the repeating Vector (and MVector) there?

Vector and MVector both appear as the names of two different things here.

The first occurrence is as the name of the (two-parameter) class,

class [M]Vector v a where ...

and the second occurrence is as the name of a datatype constructor

data [M]Vector a = [M]Vector ...


In instance declarations, the name can also appear as the name of a third 
thing, the value constructor ;)



More information about the Beginners mailing list