[Haskell-cafe] Lifting IO actions into Applicatives
Tue Oct 1 16:02:42 UTC 2013
On Tue, Oct 1, 2013 at 12:15 PM, Dan Burton <danburton.email at gmail.com>wrote:
> From what you've said, it sounds like you can already write:
> serverSide :: IO a -> Form a
> This seems elegant enough to me for your needs. Just encourage it as an
> idiom specific to Forms.
> myBlogForm = Blog <$> titleForm <*> serverSide getCurrentTime <*>
> Could you abstract `serverSide` out into a typeclass, such as
> ApplicativeIO? Sure. but why bother? The point is, you've got the
> specialization you need already.
Yes, I agree that to simply solve the problem in yesod-form, this would be
a great solution. But as to "why bother" with ApplicativeIO: my point in
sending this email was to see if other people have been bothered by this,
and if it's therefore worth coming up with a general purpose solution. If
there's no real interest in it, I don't see a need to create such a general
solution. On the other hand, if people think this is worth a general
ApplicativeIO class, I'd be happy to use that instead of defining an ad-hoc
function in yesod-form.
Thanks to everyone for this great discussion, I'm thoroughly enjoying
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe