
http://www.haskell.org/ghc/docs/7.6.2/html/libraries/base/Control-Exception.... says: do r <- tryJust (guard . isDoesNotExistError) $ getEnv "HOME" case r of Left e -> ... Right home -> ... That is misleading, because it doesn't actually allow you to do something with the error: e is always (), because guard returns unit. That should be changed in the docs. "Well", thinks the Haskeller, "I shall use tryJust fromException then", but that doesn't work because you can't do that for thinks like "file does not exist", that's why we have isDoesNotExistError after all. What that example actually means is do r <- tryJust (\e -> if isDoesNotExistError then Just e else Nothing) $ getEnv "HOME" case r of Left e -> ... Right home -> ... How elegant.