Is there a function in the standard library that allows me to map
over Optional
s or Either
s?
I didn’t find it in the documentation and the following snippet also doesn’t compile:
testEMap : Script ()
testEMap = script do
let x : Either Int Int = Right 42
let x2 = map (\val -> show x <> "hello") x
pure ()
It fails with couldn't match expected type ‘[a0]’ with actual type ‘Either Int Int’
(I know how I could write a map
function myself, I am just surprised I can’t find one.)