[Haskell-cafe] ANN: unfoldable-0.4.0

Sjoerd Visscher sjoerd at w3future.com
Thu Apr 26 23:03:49 CEST 2012


On Apr 26, 2012, at 9:34 PM, Tillmann Rendel wrote:
>> 
>>   class Unfoldable t where
>>     unfold :: Unfolder f =>  f a ->  f (t a)
> 
> Just to be sure: That's not a generalization of Data.List.unfoldr, or is it somehow?

Yes, it is. unfoldr is quite specifically tailored to lists, so it doesn't work well generically. I did include it in the package, but it does a breadth-first search for the first value that has exactly enough positions to store the elements ('a's), and there might not be one.

> 
>> Different unfolders provide different ways of generating values, for example:
>>  - Random values
>>  - Enumeration of all values (depth-first or breadth-first)
>>  - Convert from a list
>>  - An implementation of QuickCheck's arbitrary should also be possible (still working on that)
> 
> Can this be extended to provide a single API that allows testing à la SmallCheck, LazySmallCheck and/or QuickCheck without duplicating properties or instances?


Well, the idea is to unify all ways of unfolding (i.e. all ways of generating values). So those parts of the checkers could use the same API, but there's a lot more to checking than that.

By the way, I uploaded 0.5.0 a few hours ago, which contains a generic arbitrary implementation.

greetings,
--
Sjoerd Visscher
https://github.com/sjoerdvisscher/blog








More information about the Haskell-Cafe mailing list