
26 Jan
2013
26 Jan
'13
4:26 p.m.
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