Going through the PS by Example book and doing the spago test
in Getting Started - PureScript by Example.
I get 89 warnings, starting with:
Warning 1 of 89:
in module Control.MonadZero
at .spago/control/v5.0.0/src/Control/MonadZero.purs:48:1 - 48:43 (line 48, column 1 - line 48, column 43)
A custom warning occurred while solving type class constraints:
'MonadZero' is deprecated, use 'Monad' and 'Alternative' constraints instead
in value declaration monadZeroArray
See https://github.com/purescript/documentation/blob/master/errors/UserDefinedWarning.md for more information,
or to contribute content related to this warning.
Warning 2 of 89:
in module Test.MySolutions
at test/MySolutions.purs:3:1 - 3:15 (line 3, column 1 - line 3, column 15)
The import of Prelude is redundant
See https://github.com/purescript/documentation/blob/master/errors/UnusedImport.md for more information,
or to contribute content related to this warning.
Why’s this happening? And can I just proceed?
You can ignore those (or all) warnings.
A lot of them (for example the one from Control.MonadZero
) will not be in your code anyway and you’ll probably never see those after the first compile again.
The one in Test.MySolutions
could be fixed by you (remove the import Prelude
line) - although I’d stick with it … sooner or later you’ll use something from Prelude and it will stop popping up ![:wink: :wink:](https://discourse.purescript.org/images/emoji/google/wink.png?v=10)
Thanks @CarstenKoenig. Very reassuring!
Any idea why these warning come for me, but are not mentioned in the book? Are they introduced with the current version of spago
or the the compiler?
on first run spago build
will pull all dependencies - those are not precompiled - you’ll get basically the source-code and then this is compiled.
All the warnings are there because the library-author(s) did not fix them (yet) ![:wink: :wink:](https://discourse.purescript.org/images/emoji/google/wink.png?v=10)
Once those dependencies are compiled (should be in your ./output
folder if you are curious) you’ll not see them again as these source files normally don’t change and don’t need to be rebuild.
If you nuke the output
folder you’ll see them again of course.
And yes some warnings are probably new (like the very first one you see: this is a rather recent warning) and where not there when the libraries where created.
If you want you could try to patch those and give the authors a pull-request (I guess they’ll be happy) - or you can just ignore them (I guess that’s what we all do … although we should do some PRs … well maybe later)
1 Like
The MonadZero
type class instance warning is to ensure people stop using it before we remove it in PureScript v0.15.0
(a breaking change). It’s an annoying but necessary warning.
The Prelude
import means you are imported a module but not using any of its functions, values, type classes, etc. So, the compiler is telling you, “Hey, for the code you’ve written at this point, you don’t need to import this.” However, once you do start using something from that module (which will be soon), that warning will go away.
1 Like
Makes total sense, @JordanMartinez and @CarstenKoenig. Thanks for the inside information!