[Haskell-beginners] Idiomatic way of working with Either and lists
Emmanuel Surleau
emmanuel.surleau at gmail.com
Sat Jan 26 17:26:26 CET 2013
Hi,
I'm trying to figure out the best way to work with Either and lists.
I have a function f which goes:
f :: a -> Either SomeError b
Now, I'd like to do:
applyF :: [a] -> (a -> Either SomeError b) -> Either SomeError [b]
That is, map f over a list and return either a list or the first error found.
The function should stop at the first error. I have implemented applyF with a
fold, but I'm sure there must be something like this already, being a fairly
generic pattern.
Thanks,
Emm
More information about the Beginners
mailing list