infixl 5 (\\), (<<), (<+)
infix 4 (!=), (<), (<=), (>=), (>)
infixr 3 (&&), (&<&)
-infixr 2 (||), orElse, morelse
+infixr 2 (||), orElse, orElseM, morelse
infixr 1 (>>=), (>>), (:=), (>=>)
infixr 1 ($)
infixl 1 catch
/// MonadE ///
class (FunctorE m, Monad m) => MonadE m where
+ "An effectful version of the bind operator `(>>=)`"
bindE :: m a -> (a -> <e> m b) -> <e> m b
instance MonadE Maybe where
instance MonadE [] where
bindE l f = concatMap f l
+@inline
+"An effectful version of the Kleisli composition operator `(>=>)`"
+compE :: MonadE m => (a -> <e> m b) -> (b -> <f> m c) -> a -> <e,f> m c
+compE f g x = (f x) `bindE` g
+
/// MZeroE ///
class (MonadE m, MonadZero m) => MonadZeroE m where
showThrowable :: Throwable -> String
@private
@JavaName getMessage
- getMessageThrowable :: Throwable -> String
+ getMessageThrowable :: Throwable -> Maybe String
@private
@JavaName getCause
getCauseThrowable :: Throwable -> Maybe Throwable
toThrowable :: e -> Throwable
messageOfException :: Throwable e => e -> String
-messageOfException = getMessageThrowable . toThrowable
+messageOfException e = match getMessageThrowable $ toThrowable e with
+ Just m -> m
+ Nothing -> ""
+
+possibleMessageOfException :: Throwable e => e -> Maybe String
+possibleMessageOfException e = getMessageThrowable $ toThrowable e
causeOfException :: Throwable e => e -> Maybe Throwable
causeOfException = getCauseThrowable . toThrowable