You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the heart of the handlers is the monad they run in, namely `ExceptT ServantErr IO`
607
-
([haddock documentation for `ExceptT`](http://hackage.haskell.org/package/mtl-2.2.1/docs/Control-Monad-Except.html#t:ExceptT)), which is aliased as `Handler`.
606
+
At the heart of the handlers is the monad they run in, namely a newtype `Handler` around `ExceptT ServantErr IO`
607
+
([haddock documentation for `ExceptT`](http://hackage.haskell.org/package/mtl-2.2.1/docs/Control-Monad-Except.html#t:ExceptT)).
608
608
One might wonder: why this monad? The answer is that it is the
609
609
simplest monad with the following properties:
610
610
@@ -626,7 +626,7 @@ action that either returns an error or a result.
626
626
627
627
The module [`Control.Monad.Except`](https://hackage.haskell.org/package/mtl-2.2.1/docs/Control-Monad-Except.html#t:ExceptT)
628
628
from which `ExceptT` comes is worth looking at.
629
-
Perhaps most importantly, `ExceptT` is an instance of `MonadError`, so
629
+
Perhaps most importantly, `ExceptT` and `Handler` are an instances of `MonadError`, so
630
630
`throwError` can be used to return an error from your handler (whereas `return`
631
631
is enough to return a success).
632
632
@@ -636,8 +636,8 @@ kind and abort early. The next two sections cover how to do just that.
636
636
637
637
### Performing IO
638
638
639
-
Another important instance from the list above is `MonadIO m => MonadIO
640
-
(ExceptT e m)`.
639
+
Another important instances from the list above are `MonadIO m => MonadIO
640
+
(ExceptT e m)`, and therefore also `MonadIO Handler` as there is `MonadIO IO` instance..
0 commit comments