[Haskell-cafe] Haskell-Cafe Digest, Vol 152, Issue 27
Julian Leviston
julian at getcontented.com.au
Sat Apr 23 12:36:04 UTC 2016
There were quite a few responses to you so far, but no one seemed to mention that what you actually asked for are called anamorphisms.
https://en.wikipedia.org/wiki/Anamorphism <https://en.wikipedia.org/wiki/Anamorphism>
They’re not a *class* per se (as in… they’re not a typeclass), but rather they’re a kind of higher-order function which we call unfold (the kind-of “opposite" action to a fold).
Here’s a nice little thing I found which is quite helpful as an explanation:
https://gist.github.com/CMCDragonkai/b586ee9ecce297ceeeb3
and Data.List has unfoldr: http://hackage.haskell.org/package/base-4.8.2.0/docs/Data-List.html#v:unfoldr <http://hackage.haskell.org/package/base-4.8.2.0/docs/Data-List.html#v:unfoldr>
If you google around for either "anamorphism Haskell” or “unfold Haskell” you’ll find some nice explanatory resources.
Hope that helps!
Julian
http://www.happylearnjavascripttutorial.com/ <http://www.happylearnjavascripttutorial.com/> - begin programming with JavaScript today using our awesome new method!
http://www.happylearnhaskelltutorial.com/ <http://www.happylearnhaskelltutorial.com/> - begin programming with Haskell today using our awesome new method!
> On 23 Apr 2016, at 10:00 PM, haskell-cafe-request at haskell.org wrote:
>
> Hi. I'm more in the shallow end of the Haskell pool right now, so
> forgive me if this is really basic... In Haskell, what is the class for
> things that can provide an infinite sequence? I mean, things that
> produce a value as well as function for producing the next value?
> Clearly RandomGen does this, but what is the next level of abstraction
> above RandomGen (i.e., RandomGen minus the randomness aspect).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160423/182b58b9/attachment.html>
More information about the Haskell-Cafe
mailing list