
12 Sep
2009
12 Sep
'09
3:51 p.m.
I think there is no such function in standard library.
But you can also do the same by `maybe (Left err) Right (lookup key
assoc)` without defining eitherLookup.
HTH
-nwn
On Sun, Sep 13, 2009 at 12:14 AM, Michael Mossey
I want to use 'lookup' inside an Either String monad. So I want to write something like
eitherLookup :: Eq a => String -> a -> [(a,b)] -> Either String b eitherLookup s x ps = case lookup x ps of Just y -> Right y Nothing -> Left s
Is there such a function existing?
Thanks, Mike _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners