dramforever/vscode-ghc-simple

The plugin tries to use stty on Windows 10

mrakgr opened this issue · 8 comments

Status

  • A workaround is available: This error message about stty can be safely ignored. If it is however causing problems for you please reply below.
  • A fix is written
  • A fix is released
  • The fixed version is on the marketplace.

  • Version of vscode-ghc-simple: 0.1.13
  • Version of VSCode:

Version: 1.43.0 (user setup)
Commit: 78a4c91400152c0f27ba4d363eb56d2835f9903a
Date: 2020-03-09T19:47:57.235Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.17763

  • Version of Haskell-related tools:
    • GHC: 8.6.5
    • Stack: 2.1.3
    • Cabal: 2.4.1.0

Steps to reproduce

Build the Purs compiler then try to open "src\Language\PureScript.hs". I get the following error, probably because I am using Windows 10 and it is trying to use stty.

Starting GHCi with: "stack --color never repl --no-load purescript:lib purescript:exe:purs purescript:test:tests purescript-ast:lib purescript-cst:lib purescript-cst:test:tests"
(Under cwd c:\purescript)
    -> :set prompt ""
ghci | 'stty' is not recognized as an internal or external command,
ghci | operable program or batch file.
ghci | 
ghci | * * * * * * * *
ghci | Warning: There are cabal settings for this project which may prevent GHCi from loading your code properly.
ghci | In some cases it can also load some projects which would otherwise fail to build.
ghci | 
ghci | -XNoImplicitPrelude will be used, but GHCi will likely fail to build things which depend on the implicit prelude.
ghci | It is specified for:
ghci |     purescript:lib purescript:test:tests purescript-ast:lib purescript-cst:lib purescript-cst:test:tests
ghci | But not for: 
ghci |     purescript:exe:purs
ghci | 
ghci | -XOverloadedStrings will be used, but it can cause type ambiguity in code not usually compiled with it.
ghci | It is specified for:
ghci |     purescript:lib purescript:test:tests purescript-ast:lib purescript-cst:lib purescript-cst:test:tests
ghci | But not for: 
ghci |     purescript:exe:purs
ghci | 
ghci | -XTypeFamilies will be used, but it implies -XMonoLocalBinds, and so can cause type errors in code which expects generalized local bindings.
ghci | It is specified for:
ghci |     purescript-ast:lib
ghci | But not for: 
ghci |     purescript:lib purescript:exe:purs purescript:test:tests purescript-cst:lib purescript-cst:test:tests
ghci | 
ghci | To resolve, remove the flag(s) from the cabal file(s) and instead put them at the top of the haskell files.
ghci | 
ghci | It isn't yet possible to load multiple packages into GHCi in all cases - see
ghci | https://ghc.haskell.org/trac/ghc/ticket/10827
ghci | * * * * * * * *
ghci | 
ghci | The following GHC options are incompatible with GHCi and have not been passed to it: -O2 -threaded
ghci | Configuring GHCi with the following packages: purescript, purescript-ast, purescript-cst
ghci | 
ghci | Warning: Didn't find expected autogen file:
ghci |          C:\purescript\.stack-work\dist\e626a42b\build\tests\autogen\cabal_macros.h
ghci | 
ghci | Warning: Didn't find expected autogen file:
ghci |          C:\purescript\lib\purescript-cst\.stack-work\dist\e626a42b\build\tests\autogen\cabal_macros.h
ghci | GHCi, version 8.6.5: http://www.haskell.org/ghc/  :? for help
ghci | <command line>: cannot satisfy -package HUnit-1.6.0.0
ghci |     (use -v for more information)

Note, the bug report issue template has a typo in The fixed verison is on the marketplace.

verison should be version.

I'm sure it's stack that's doing it, and I'm also pretty sure it's the same problem at haskell/haskell-ide-engine#1704. Not sure why though.

This stty error shouldn't have prevented you from using the extension. Judging from the log it seems that there's something else that went wrong.

Note, the bug report issue template has a typo in The fixed verison is on the marketplace.

verison should be version.

Noted!

Judging from the log it seems that there's something else that went wrong.

Yeah, most likely. Since this one did not work for me and both of them have the same error I thought that Hie would also be the same, but it seems that Hie does work after you give it some time.

Trying the purescript compiler fails for me too, but with a completely different error. Somehow the REPL is configured to use purescript-ast but it's also hidden so the compiler can't find it, and it's hidden. This is going to be tricky.

But the stty error message is a red-herring here, I believe. The command does nothing, the result is ignored by stack, the output is ignored by the extension, and a pipe is not a terminal so stty doesn't matter even if it works. I've edited your original post with a workaround to just ignore it.

Log
Starting GHCi with: "stack --color never repl --no-load purescript:lib purescript:exe:purs purescript:test:tests purescript-ast:lib purescript-cst:lib purescript-cst:test:tests"
(Under cwd /home/dram/src/purescript)
    -> :set prompt ""
ghci | 
ghci | * * * * * * * *
ghci | Warning: There are cabal settings for this project which may prevent GHCi from loading your code properly.
ghci | In some cases it can also load some projects which would otherwise fail to build.
ghci | 
ghci | -XNoImplicitPrelude will be used, but GHCi will likely fail to build things which depend on the implicit prelude.
ghci | It is specified for:
ghci |     purescript:lib purescript:test:tests purescript-ast:lib purescript-cst:lib purescript-cst:test:tests
ghci | But not for: 
ghci |     purescript:exe:purs
ghci | 
ghci | -XOverloadedStrings will be used, but it can cause type ambiguity in code not usually compiled with it.
ghci | It is specified for:
ghci |     purescript:lib purescript:test:tests purescript-ast:lib purescript-cst:lib purescript-cst:test:tests
ghci | But not for: 
ghci |     purescript:exe:purs
ghci | 
ghci | -XTypeFamilies will be used, but it implies -XMonoLocalBinds, and so can cause type errors in code which expects generalized local bindings.
ghci | It is specified for:
ghci |     purescript-ast:lib
ghci | But not for: 
ghci |     purescript:lib purescript:exe:purs purescript:test:tests purescript-cst:lib purescript-cst:test:tests
ghci | 
ghci | To resolve, remove the flag(s) from the cabal file(s) and instead put them at the top of the haskell files.
ghci | 
ghci | It isn't yet possible to load multiple packages into GHCi in all cases - see
ghci | https://ghc.haskell.org/trac/ghc/ticket/10827
ghci | * * * * * * * *
ghci | 
ghci | The following GHC options are incompatible with GHCi and have not been passed to it: -O2 -threaded
ghci | Configuring GHCi with the following packages: purescript, purescript-ast, purescript-cst
ghci | GHCi, version 8.6.5: http://www.haskell.org/ghc/  :? for help
ghci | Loaded GHCi configuration from /home/dram/.ghci
ghci | ghci> 
ghci | ===ghci_barrier_0.3831065930913533===
    -> :set prompt-cont ""
ghci | 
ghci | ===ghci_barrier_0.33448143917331663===
    -> :set -fno-diagnostics-show-caret -fdiagnostics-color=never -ferror-spans
    |> :set -fdefer-type-errors -fdefer-typed-holes -fdefer-out-of-scope-variables
    |> :set -fno-hide-source-paths
    |> :set -Wno-error=missing-home-modules
ghci | 
ghci | ===ghci_barrier_0.26389115501217764===
    -> :show paths
ghci | current working directory: 
ghci |   /home/dram/src/purescript
ghci | module import search paths:
ghci |   /home/dram/src/purescript/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build
ghci |   /home/dram/src/purescript/src
ghci |   /home/dram/src/purescript/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/autogen
ghci |   /home/dram/src/purescript/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/global-autogen
ghci |   /home/dram/src/purescript/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/purs
ghci |   /home/dram/src/purescript/app
ghci |   /home/dram/src/purescript/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/purs/autogen
ghci |   /home/dram/src/purescript/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/purs/purs-tmp
ghci |   /home/dram/src/purescript/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/tests
ghci |   /home/dram/src/purescript/tests
ghci |   /home/dram/src/purescript/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/tests/autogen
ghci |   /home/dram/src/purescript/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/tests/tests-tmp
ghci |   /home/dram/src/purescript/lib/purescript-ast/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build
ghci |   /home/dram/src/purescript/lib/purescript-ast/src
ghci |   /home/dram/src/purescript/lib/purescript-ast/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/autogen
ghci |   /home/dram/src/purescript/lib/purescript-ast/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/global-autogen
ghci |   /home/dram/src/purescript/lib/purescript-cst/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build
ghci |   /home/dram/src/purescript/lib/purescript-cst/src
ghci |   /home/dram/src/purescript/lib/purescript-cst/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/autogen
ghci |   /home/dram/src/purescript/lib/purescript-cst/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/global-autogen
ghci |   /home/dram/src/purescript/lib/purescript-cst/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/tests
ghci |   /home/dram/src/purescript/lib/purescript-cst/tests
ghci |   /home/dram/src/purescript/lib/purescript-cst/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/tests/autogen
ghci |   /home/dram/src/purescript/lib/purescript-cst/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/tests/tests-tmp
ghci | 
ghci | ===ghci_barrier_0.12999489503567108===
Detected base path: /home/dram/src/purescript
    -> :set -fobject-code
    |> :load "*/home/dram/src/purescript/src/Language/PureScript.hs"
ghci | [ 26 of 122] Compiling Language.PureScript.CST.Types ( /home/dram/src/purescript/lib/purescript-cst/src/Language/PureScript/CST/Types.hs, /home/dram/src/purescript/.stack-work/odir/Language/PureScript/CST/Types.o )
ghci | 
ghci | /home/dram/src/purescript/lib/purescript-cst/src/Language/PureScript/CST/Types.hs:16:1-64: error:
ghci |     Could not load module ‘Language.PureScript.Names’
ghci |     It is a member of the hidden package ‘purescript-ast-0.1.0.0’.
ghci |     You can run ‘:set -package purescript-ast’ to expose it.
ghci |     (Note: this unloads all the modules in the current scope.)
ghci | 
ghci | /home/dram/src/purescript/lib/purescript-cst/src/Language/PureScript/CST/Types.hs:18:1-63: error:
ghci |     Could not load module ‘Language.PureScript.PSString’
ghci |     It is a member of the hidden package ‘purescript-ast-0.1.0.0’.
ghci |     You can run ‘:set -package purescript-ast’ to expose it.
ghci |     (Note: this unloads all the modules in the current scope.)
ghci | Failed, 25 modules loaded.
ghci | 
ghci | ===ghci_barrier_0.029882955101805386===
    -> :set -fbyte-code
    |> :set +c
    |> :load "*/home/dram/src/purescript/src/Language/PureScript.hs"
ghci | [ 26 of 122] Compiling Language.PureScript.CST.Types ( /home/dram/src/purescript/lib/purescript-cst/src/Language/PureScript/CST/Types.hs, interpreted )
ghci | 
ghci | /home/dram/src/purescript/lib/purescript-cst/src/Language/PureScript/CST/Types.hs:16:1-64: error:
ghci |     Could not load module ‘Language.PureScript.Names’
ghci |     It is a member of the hidden package ‘purescript-ast-0.1.0.0’.
ghci |     You can run ‘:set -package purescript-ast’ to expose it.
ghci |     (Note: this unloads all the modules in the current scope.)
ghci | 
ghci | /home/dram/src/purescript/lib/purescript-cst/src/Language/PureScript/CST/Types.hs:18:1-63: error:
ghci |     Could not load module ‘Language.PureScript.PSString’
ghci |     It is a member of the hidden package ‘purescript-ast-0.1.0.0’.
ghci |     You can run ‘:set -package purescript-ast’ to expose it.
ghci |     (Note: this unloads all the modules in the current scope.)
ghci | Failed, 25 modules loaded.
ghci | 
ghci | ===ghci_barrier_0.07686390974499857===

Oh your error message is caused by stack not getting test dependencies, which is already mentioned in #51. stack test --no-run-tests should bring you past that, but you'll probably then hit what I got.

Sorry for the extremely delayed response. I've recently started working on supporting multi-component/multi-package projects. I think your issue might be helped by this.

I am still trying to figure out if this means test targets will work correctly, but hopefully they will be fixed, at least along the way.

If you haven't abandoned vscode-ghc-simple, please consider testing out development versions of the vgs-bios branch. See more information in the discussion here: #87.

In short, you will need to install a development version of the vgs-bios branch and set up an hie.yaml file, with the same format as the one accepted by hie-bios to tell vscode-ghc-simple about your project structure. If you need help or find any problems please do consider reaching out.

Not everything is well-supported yet, but hopefully simple multi-component or multi-package setups will work. The same file should also help out those who use ghcide. Many projects already have an hie.yaml file, so these will hopefully work out of the box. See the discussion page linked above for details for more information.

Thanks for considering helping out!

Sorry for the extremely delayed response. I've recently started working on supporting multi-component/multi-package projects. I think your issue might be helped by this.

I am still trying to figure out if this means test targets will work correctly, but hopefully they will be fixed, at least along the way.

If you haven't abandoned vscode-ghc-simple, please consider testing out development versions of the vgs-bios branch. See more information in the discussion here: #87.

In short, you will need to install a development version of the vgs-bios branch and set up an hie.yaml file, with the same format as the one accepted by hie-bios to tell vscode-ghc-simple about your project structure. If you need help or find any problems please do consider reaching out.

Not everything is well-supported yet, but hopefully simple multi-component or multi-package setups will work. The same file should also help out those who use ghcide. Many projects already have an hie.yaml file, so these will hopefully work out of the box. See the discussion page linked above for details for more information.

Thanks for considering helping out!

Released in v0.2.0