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
moduleConfigwhereimportPreludeimportControl.Monad.Reader.Class (MonadReader, ask)
dataEnvironment=Production | Test | DevelopmentnewtypeConfig=Config{environment::Environment}classHasConfigawheregetConfig::a->ConfigclassHasEnvironmentawheregetEnvironment::a->EnvironmentinstancehasEnvironmentEnvironment :: HasEnvironmentEnvironmentwhere
getEnvironment = id
instancehasConfigConfig :: HasConfigConfigwhere
getConfig = id
instancehasEnvironmentConfig :: HasEnvironmentConfigwhere
getEnvironment (Config c) = c.environment
baseURL::forallmr . (MonadReaderrm, HasEnvironmentr) =>mString
baseURL = do
somethingThatHasEnvironment <- ask
return $ baseURL' (getEnvironment somethingThatHasEnvironment)
wherebaseURL'::Environment->String
baseURL' Development = "http://127.0.0.1/"
baseURL' _ = "http://example.com/"
I get the following error:
Error in module Config:
No instance found for
Control.Monad.Reader.Class.MonadReader _38
m28
See https://github.com/purescript/purescript/wiki/Error-Code-NoInstanceFound for more information, or to contribute content related to this error.
Is this a fundamental limitation with Purescript? Or is this just a bug?
In Haskell, the following code works fine:
But this similar Purescript code is not working:
I get the following error:
Is this a fundamental limitation with Purescript? Or is this just a bug?
If it is a fundamental limitation with Purescript, it would be nice to have it described on the wiki page: https://github.com/purescript/purescript/wiki/Differences-from-Haskell
The text was updated successfully, but these errors were encountered: