
1 Oct
2013
1 Oct
'13
8:27 a.m.
Dan Burton 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 <*> contentsForm
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.
In my opinion, this is the nicest answer to the original question about yesod forms. But the more general question that it led to is an interesting and important one. -Yitz