[Haskell-cafe] lens and Maybe value

PICCA Frederic-Emmanuel frederic-emmanuel.picca at synchrotron-soleil.fr
Tue Dec 20 16:35:34 UTC 2022


import           Control.Lens                       (makeLenses)

data A = A { _a = (Maybe Int) }

makeLenses A

myA = A Nothing

ma = Just 1

newA = case ma of
         Nothing -> myA
         (Just _) -> (a .~ ma) myA
 


More information about the Haskell-Cafe mailing list