[Haskell-cafe] [Haskell] ANN: io-memoize 1.1

Kim-Ee Yeoh ky3 at atamo.com
Fri Jun 13 03:31:23 UTC 2014


SimonM, SimonH, Dan: thank you all for the responses! Really helpful when
deciding to use this package.

-- Kim-Ee


On Fri, Jun 13, 2014 at 2:16 AM, Dan Burton <danburton.email at gmail.com>
wrote:

> I created io-memoize a few years ago, around the same time that I also
> created runmemo <http://hackage.haskell.org/package/runmemo>. I was
> interested in "memoization" at the time, and was exploring various
> memoization techniques. It was just for theory/fun and had no motivating
> use case at the time.
>
> I've been following various pipes/conduit discussions, and one particular
> discussion about WAI involved an interest in a "call once" callback. It's
> hard to enforce that sort of thing at the compile time without using
> hardcore solutions such as linear types or indexed monads, so the obvious
> solution is to use something like io-memoize to enforce it at runtime
> instead.
>
>
> http://www.reddit.com/r/haskell/comments/246e39/disemboweling_wai_aka_gutting_out_conduit/ch4cv55
>
> Something else I've been working on lately is "the observer pattern" in
> Haskell. When you subscribe to an observer, it will give you a
> "subscription", which is just an action you can run to "unsubscribe"
> yourself. Again, there's potential for "once" to be useful here for
> implementing the unsubscribe action. If I manage to create something solid
> and novel out of this observer pattern stuff, then I'll release it to
> hackage as the "observable" package, or something like that.
>
> Coincidentally, Simon pinged me about io-memoize with his use case in
> HSpec. So it's something that's been on my mind, but Simon came to me with
> a fresh Real Code use case that motivated the recent tweaks and the 1.1
> release.
>
>
> On Thu Jun 12 2014 at 3:28:47 AM, Simon Hengel <sol at typeful.net> wrote:
>
>> Hi Kim-Ee,
>>
>> > I may want a one-time only IO action, although so far the need hasn't
>> > arisen yet. ;)
>> >
>> > In the spirit of pilfering while the buns are still hot out of the
>> oven, is
>> > there a backstory for this package you could possibly sketch out? Some
>> > canonical use case maybe?
>>
>> I use it to implement beforeAll/beforeAllWith[1] in Hspec[2].  I have
>> been reluctant to add them because used in the wrong way they lead to
>> bad/order dependent test cases.  But there are some valid use cases.  So
>> I decided to finally add them.
>>
>> Cheers,
>> Simon
>>
>> [1] https://github.com/hspec/hspec/pull/173
>> [2] http://hspec.github.io/
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140613/8d9c0300/attachment.html>


More information about the Haskell-Cafe mailing list