Compilation error on a fresh project
Closed this issue · 6 comments
Hi,
I'm starting to explore Purescript and I run into compilation errors with purescript-affjax
. I tried with a fresh installation and it's still failing…
I just run:
mkdir purescript
cd purescript
pulp init
bower install purescript-affjax --save
pulp build
And I got:
* Building project in /tmp/purescript
Error 1 of 2:
in module Control.Monad.Aff.Console
at /tmp/purescript/bower_components/purescript-aff/src/Control/Monad/Aff/Console.purs line 36, column 1 - line 36, column 34
No type class instance was found for
Control.Monad.Eff.Class.MonadEff ( console :: CONSOLE
| t0
)
(Aff
( console :: CONSOLE
| eff1
)
)
The instance head contains unknown type variables. Consider adding a type annotation.
while checking that expression (compose liftEff) warnShow
has type forall a eff.
(Show a) => a
-> Aff
( console :: CONSOLE
| eff
)
Unit
while applying a function compose
of type forall b c d a. (Semigroupoid a) => a c d -> a b c -> a b d
to argument liftEff
in value declaration warnShow
where eff1 is a rigid type variable
bound at line 36, column 1 - line 36, column 34
t0 is an unknown type
See https://github.com/purescript/purescript/wiki/Error-Code-NoInstanceFound for more information,
or to contribute content related to this error.
Error 2 of 2:
in module Network.HTTP.Affjax
at /tmp/purescript/bower_components/purescript-affjax/src/Network/HTTP/Affjax.purs line 190, column 1 - line 231, column 32
No type class instance was found for
Control.Monad.Eff.Class.MonadEff ( ref :: REF
| t3
)
(Aff
( ajax :: AJAX
, avar :: AVAR
, ref :: REF
| e4
)
)
The instance head contains unknown type variables. Consider adding a type annotation.
while checking that expression \policy ->
\run ->
\req ->
let
...
...
in ...
has type forall e a b.
(Requestable a) => { timeout :: Maybe Int
, delayCurve :: Int -> Int
, shouldRetryWithStatusCode :: StatusCode -> Boolean
}
-> ({ method :: Either Method CustomMethod
, url :: String
, headers :: Array RequestHeader
, content :: Maybe a
, username :: Maybe String
, password :: Maybe String
, withCredentials :: Boolean
}
-> Aff
( ajax :: AJAX
, avar :: AVAR
, ref :: REF
| e
)
{ status :: StatusCode
, headers :: Array ResponseHeader
, response :: b
}
)
-> { method :: Either Method CustomMethod
, url :: String
, headers :: Array RequestHeader
, content :: Maybe a
, username :: Maybe String
, password :: Maybe String
, withCredentials :: Boolean
}
-> Aff
( ajax :: AJAX
, avar :: AVAR
, ref :: REF
| e
)
{ status :: StatusCode
, headers :: Array ResponseHeader
, response :: b
}
while applying a function (bind (#dict Bind t28)) (((map (...)) retryState) (attempt (run req)))
of type (t0 -> t1 t2) -> t1 t2
to argument \$1 ->
case $1 of
result -> case result of
...
...
in value declaration retry
where e4 is a rigid type variable
bound at line 190, column 1 - line 231, column 32
t1 is an unknown type
t2 is an unknown type
t0 is an unknown type
t3 is an unknown type
See https://github.com/purescript/purescript/wiki/Error-Code-NoInstanceFound for more information,
or to contribute content related to this error.
Compiling Control.Monad.Aff.Console
Compiling Network.HTTP.Affjax
* ERROR: Subcommand terminated with exit code 1
This is my versions:
Pulp version 9.0.1
psc version 0.10.0 using /usr/bin/psc
Am I missing something?
Thanks.
For now you'll need to use PureScript 0.9.x - the libraries are still in the process of being updated for 0.10.
A fix was made to the typechecker that means inference fails for classes like MonadEff
and MonadAff
with the current set of libraries (it shouldn't have worked in the first place - the addition of functional dependencies in 0.10 means we can handle it correctly now too).
Thanks for you quick response! :-)
Do you know if there is a way to run a different psc
executable with pulp
?
I think it could be a good idea to put this information in the README for newcomers, I can open a PR if you want?
Hmm, I'm not sure - I think pulp
always takes whatever you have on your PATH
. You could try installing the older psc
via npm
, and see if pulp
uses that version when invoked via an npm
script?
We could add that info to the README, but currently the same problem applies to probably about 50 libraries, so I'm not sure if the libraries are the best place to communicate it. Hopefully things won't stay out of date for too much longer! The core libraries are over half way done, we should have the rest done by the end of the week and then I'll be spending some time at the weekend updating libraries like this one.
Looks like purescript-aff
and purescript-argonaut
are already bumped to 0.10, are there other unfinished dependencies?
purescript-form-urlencoded
is pending, although there's a PR for it. Ideally I'd like to finish up purescript-http-headers
and use that too!
I just went with the version-bump style update for now, the headers thing can wait for another time!