[Haskell-cafe] lens and Maybe value

David Feuer david.feuer at gmail.com
Tue Dec 20 16:18:12 UTC 2022


Please clarify your question. Your code doesn't compile, and I can't tell
what it's supposed to do.

On Tue, Dec 20, 2022, 11:13 AM PICCA Frederic-Emmanuel <
frederic-emmanuel.picca at synchrotron-soleil.fr> wrote:

> Hello,
>
> I have a data whcih contain a Maybe value
>
> data A = A (_a = Maybe a)
>
> I would like to use a lens in order to merge two values with this log
>
> replace the value only if it is a (Just a)
>
> So My question is
>
> is there something more elegant than
>
> let myA' = case ma of
>               Nothing  -> conf
>               (Just na) -> (a .~ na) myA
>
> Thanks for your help
>
> Frederic
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20221220/fb9d770b/attachment.html>


More information about the Haskell-Cafe mailing list