darcs patch: Make toList a member of Foldable

Eelis van der Weegen eelis at eelis.net
Tue Apr 27 19:46:29 EDT 2010

On 2010-04-28 01:30, Ross Paterson wrote:
> On Wed, Apr 28, 2010 at 12:21:58AM +0100, Ross Paterson wrote:
>> The definition in Data.Foldable is
>>   toList :: Foldable t => t a -> [a]
>>   toList t = build (\ c n -> foldr c n t)
>> For lists, this Data.Foldable.foldr should be inlined to Data.List.foldr.
> For NonEmptyList this should become
>   toList t = build (\ c n -> c h (Data.List.foldr c n t))
> I'd expect the rest of the steps to still apply, but these RULES are tricky.

I checked, and with your version of foldr for NonEmptyList, it does seem
to work beautifully, so that's fantastic! Thank you for the explanation
and solution.

I'll ask the maintainer of the NonEmptyList package to use this version.

More information about the Libraries mailing list