[Haskell-cafe] Make this code more idiomatic?

David Turner dct25-561bs at mythic-beasts.com
Wed Dec 30 22:18:00 UTC 2015


On 29 December 2015 at 10:32, David Turner <dct25-561bs at mythic-beasts.com>
wrote:

> As soon as I sent this, I think I hit on the answer. There's no getting
> away from having to write a strategy like this:
>
> evalActualsWith :: Strategy [ActualShift] -> Strategy User
> evalActualsWith strat user = do
>   actuals' <- strat $ actuals user
>   return $ user { actuals = actuals' }
>

Hang on, isn't evalActualsWith just the lens for the actuals field with a
slightly more specialised type?

That's pretty cool.

Cheers,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20151230/f355b28b/attachment.html>


More information about the Haskell-Cafe mailing list