Created
May 15, 2015 09:10
-
-
Save eamelink/0aa02b1a94130f270027 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import qualified Debug.Trace as T | |
import Control.Alt | |
import Control.Monad.Aff | |
import Control.Monad.Eff | |
import Control.Monad.Eff.Exception | |
import Control.Monad.Error.Class | |
import Data.Either | |
main :: forall e. Eff (trace :: T.Trace | e) Unit | |
main = launchAff $ do | |
(throwError (error "Foo!")) `catchError` (const $ trace "bork!") | |
trace :: forall e a. (Show a) => a -> Aff (trace :: T.Trace | e) a | |
trace a = do | |
liftEff' $ T.trace (show a) | |
return a | |
{- | |
Output: | |
Compiling Main | |
Error in module Main: | |
Error in value declaration main: | |
Error at src/Main.purs line 3, column 1 - line 4, column 1: | |
No instance found for Control.Monad.Error.Class.MonadError u48 (Control.Monad.Aff.Aff (trace :: Debug.Trace.Trace | e27)) | |
See https://github.com/purescript/purescript/wiki/Error-Code-NoInstanceFound for more information, or to contribute content related to this error. | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment