Search code examples
haskellhaskell-lens

How to check if map has a key using lens syntax?


How to check if map has a key using lens syntax?

import qualified Map as Map

let x = Map.member "bla" m

How to write this using lenses?


Solution

  • Use has.

    M.fromList [("bla", ())] & has (ix "bla")