Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 625
Vagif Verdi Avatar asked Oct 29 '25 07:10

Vagif Verdi


1 Answers

Use has.

M.fromList [("bla", ())] & has (ix "bla")
like image 182
Anthony Avatar answered Nov 01 '25 14:11

Anthony



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!