I'm trying to build a simple Purescript app, and I cannot figure out why I keep getting a typeclass instance error.
Specifically, inside of my Component
I am defining the eval
function to operate on my query algebra. In the process, I just log something to the console for fun.
type AppEffects eff = (HalogenEffects (console :: CONSOLE | eff))
data Query a = DoSomething a
eval :: Query ~> H.ComponentDSL State Query (Aff (AppEffects eff))
eval (DoSomething a) = do
liftEff $ log "print me out!"
-- do some stuff with the action
pure next
When I run this, the compiler shouts:
No type class instance was found for
Control.Monad.Eff.Class.MonadEff ( "console" :: CONSOLE
| t0
)
(Free
(HalogenFP EventSource
{ "someState" :: String
}
Query
(Aff
( "avar" :: AVAR
, "err" :: EXCEPTION
, "dom" :: DOM
, "console" :: CONSOLE
| eff1
)
)
)
)
The instance head contains unknown type variables. Consider adding a type annotation.
So I specified a type:
tryPrint :: Eff (console :: CONSOLE | eff) Unit
tryPrint = log "print me out!"
However, the compiler still tells me I need to implement an instance for the MonadEff
typeclass. I don't really understand this error. Could anyone point me in the right direction?