14 Apr
2011
14 Apr
'11
7:12 p.m.
Christopher Done <chrisdone@googlemail.com> wrote:
FWIW there is also Data.Either which has the either function.
Only few people seem to realize that 'maybe' and 'either' exist and how useful they are. They are defined in the Prelude, so no imports are necessary. either this that . maybe defValue foo $ someMaybeEitherValue They also help with monadic code: getStuff :: IO (Maybe String) getStuff >>= maybe (throwIO (MyError "Stuff not available")) putStrLn Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/