[Haskell-cafe] Haskell-Cafe Digest, Vol 152, Issue 27
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.
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:
and Data.List has unfoldr: http://hackage.haskell.org/package/base-22.214.171.124/docs/Data-List.html#v:unfoldr <http://hackage.haskell.org/package/base-126.96.36.199/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!
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...
More information about the Haskell-Cafe