Polymorphic Recursion / Rank-2 Confusion
Dominic Steinitz
dominic.steinitz at blueyonder.co.uk
Sun Sep 21 09:44:50 EDT 2003
Ross,
Thanks very much. I was going to use
coal :: Vector a -> [a]
coal = coal_ (\() -> []) (\x -> [x])
but I prefer your definitions.
Dominic.
----- Original Message -----
From: "Ross Paterson" <ross at soi.city.ac.uk>
To: "Dominic Steinitz" <dominic.steinitz at blueyonder.co.uk>
Cc: <haskell at haskell.org>
Sent: Saturday, September 20, 2003 5:19 PM
Subject: Re: Polymorphic Recursion / Rank-2 Confusion
> 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 []) (:[])
More information about the Haskell
mailing list