Polymorphic Recursion / Rank-2 Confusion

Brandon Michael Moore brandon at its.caltech.edu
Sat Sep 20 13:57:09 EDT 2003


On Sat, 20 Sep 2003, Ross Paterson wrote:

> On Sat, Sep 20, 2003 at 12:01:32PM +0100, Dominic Steinitz wrote:
> > Can anyone tell me why the following doesn't work (and what I have to do to
> > fix it)? I thought by specifying the type of coalw as rank-2 would allow it
> > to be used both at a and (a,b).
>
> Change the signature to
>
> 	coal_ :: (v -> [a]) -> (w -> [a]) -> Vector_ v w -> [a]
>
> Then you can define
>
> 	type Vector = Vector_ ()
>
> 	coal :: Vector a -> [a]
> 	coal = coal_ (const []) (:[])
> _______________________________________________
> Haskell mailing list
> Haskell at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell
>
>



More information about the Haskell mailing list