kritzcreek / pscid

A lightweight, fast and unintrusive PureScript file-watcher
GNU Lesser General Public License v3.0
133 stars 16 forks source link

"An error inside psaPrinter" when "bind" is left out of explicit Prelude imports and "bind" is used #43

Closed jamieyung closed 5 years ago

jamieyung commented 6 years ago

A minimal example causing the error:

module Main where

import Prelude (pure) -- "bind" is left out

f = do
    _ <- pure 1 -- bind is used here
    pure 2

The correct error is:

Compiling Main
[1/1 UnknownName] Main

  Unknown value bind. You're probably using do-notation, which the compiler replaces
with calls to the bind function. Please import bind from module Prelude

           Src   Lib   All
Warnings   0     0     0
Errors     0     0     1
* ERROR: Subcommand terminated with exit code 1

Invoking a full build with b produces the correct error.

kritzcreek commented 6 years ago

This is a case of https://github.com/natefaubion/purescript-psa/pull/38 and has been fixed inside purescript-psa-utils I just need to bump the dependency and move the project to 0.12. I'll do that myself, thanks for reporting!

kritzcreek commented 6 years ago

Should be fixed in 2.6.0. Please let me know if it worked

jamieyung commented 6 years ago

Hm, leaving bind out still gives An error inside psaPrinter.

Here are the steps I took:

  1. I upgraded pscid to 2.6.0: npm i -D pscid@2.6.0
  2. Started it up: bower_components/.bin/pscid
  3. Removed bind from the Prelude import, saved the file.

I tried the steps again after removing bower_components and node_modules and got the same result. Is there anything else I should have done?

EDIT: I'm using v0.12.0 of the compiler (psvm use v0.12.0).

kritzcreek commented 6 years ago

Hmm, no you're doing all the right things. It looks like psa is guarding against these cases outside of its utils package, so we'll either have to duplicate the logic inside this project, or fix the compiler's broken error spans.

Feel free to see if you can debug the failure and find a simple workaround/fix in pscid. If I find some more time I'll rather spend it on fixing the compiler.

kritzcreek commented 5 years ago

Pretty sure all of these have been fixed in 0.12.2, so I'll close this. If we find more errors without positions we should open a new issue.