Skip to content

Instantly share code, notes, and snippets.

@kakkun61
Last active August 29, 2015 14:26
Show Gist options
  • Save kakkun61/d79036cb4d5f8db1ba8a to your computer and use it in GitHub Desktop.
Save kakkun61/d79036cb4d5f8db1ba8a to your computer and use it in GitHub Desktop.
How to import effects explicitly in PureScript?
-- This is not OK.
module MainNG where
import Prelude (Unit)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)
main :: forall eff. Eff (console :: CONSOLE | eff) Unit
main = log "Hi"
-- Error:
-- Error in module Main:
-- Error at line 6, column 1 - line 7, column 1:
-- Unknown type class Control.Monad.Eff.Eff
-- See https://github.com/purescript/purescript/wiki/Error-Code-UnknownTypeClass for more information, or to contribute content related to this error.
-- This is OK.
module MainOK where
import Prelude
import Control.Monad.Eff
import Control.Monad.Eff.Console
main :: forall eff. Eff (console :: CONSOLE | eff) Unit
main = log "Hi"
module Solution where
import Prelude (Unit())
import Control.Monad.Eff (Eff())
import Control.Monad.Eff.Console (CONSOLE(), log)
main :: forall eff. Eff (console :: CONSOLE | eff) Unit
main = log "Hi"
@kakkun61
Copy link
Author

kakkun61 commented Aug 3, 2015

import Control.Monad.Eff (Eff())

https://twitter.com/paf31/status/628276419617906688

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment