
28 Sep
2007
28 Sep
'07
5:59 p.m.
On Fri, Sep 28, 2007 at 05:54:23PM +0100, Brian Hulley wrote:
Yes this type should be fine. To implement reversor though you'd still need to first convert from the concrete list to whatever foldable you're using, before reversing the foldable, or implement something more general eg:
reversor :: (Foldable f, Foldable g) :: f a -> g a
One cannot define such a function, as Foldable provides no way to build things. However one can define reversor :: Traversable f => f a -> f a which returns something of the same shape, but with the contents reversed.