HLint program not found. Haskell - haskell

I am trying to setup haskell-linter for vs-code.
I have installed hlint using cabal. Location of hlint
~/.cabal/bin/hlint
I have also added the above path in setting.json of VSCode.
"haskell.hlint.executablePath": "~/.cabal/bin/hlint"
But still getting the following error in vs-code:
Cannot hlint the haskell file. The hlint program was not found. Use the 'haskell.hlint.executablePath' setting to configure the location of 'hlint'
I am using Mac os.
Can someone help ?
Edit 1 :
Also tried adding the full path but still no success.
"haskell.hlint.executablePath": "/Users/ujjwal/.cabal/bin/hlint"

This seems to work for me. (Mac Intel)
On macOS, opening my terminal and typing: which hlint
=> /Users/admin/.local/bin/hlint
If the command can't find hlint, you might want to find out where it's installed on your machine and add it to your PATH.
Then went to vscode settings (cmd + ,) -> extensions -> haskell-linter, then pasted /Users/admin/.local/bin/hlint as the "Executable Path". You will need to paste your own result from which hlint obviously.

Related

Setting up a path for Haskell-Linter in VS Code on windows 10

I am trying to make haskell-linter to work on VS Code on my windows 10 machine. Apparently you need to add a path to the .exe file for it to work. I get this error message.
Cannot hlint the haskell file. The hlint program was not found. Use the 'haskell.hlint.executablePath' setting to configure the location of 'hlint'
In the Dependencies options there is following information.
It expects a version of hlint >= 1.9.1 to be installed and already added to >the path. If it is installed but cannot be found, add the path to your >preferences as seen below"
"haskell.hlint.executablePath": "Path\To\Executable"
I tried adding a path in the system environment as such.
Variablename: haskell.hlint.executablePath
Variablevalue: C:\Users\name\.vscode\extensions\hoovercj.haskell-linter-0.0.6\node_modules\.bin
I am fairly sure the variable value is the thing wrong here. I think I need to find the path to the .exe file for for the extension, but I can't seem to find it in the folder containing the extension itself. There is probable an easy fix that I am just to inexperienced to see. Please help, and if you do, explain it as if I was 8. :)
Edit 1: I now know where to put the path to what i assume must be the .exe file for Haskell-linter, however i don't know where that file is. As stated i cant find any .exe files in the extension folder.
Edit 2: I reinstalled hlint and added the new path. it finally seems to work as intended.

QtCreator cannot find the emscripten compiler

I followed this guide and installed emscripten using emsdk and activated it.Then I configured my $PATH as instructed by the emsdk itself and also sourced emsdk-master/emsdk_env.sh.Now I can access both emcc and em++ in the terminal.The file ~/.emscripten is also present(this is the file that QtCreator will fetch to find the path of compilers for WASM).
The WebAssembly kit for Qt also has been installed by the Qt Maintenance Tool.
Now in the Kit configuration in the QtCreator I get this(QtCreator is opened via terminal after sourcing emsdk_env.sh):
It cannot determine the path of compilers by itself.
In the Compilers tab I manually added a compiler as follows:
But I get this error in the Kits tab after that:
What does that mean? What did I skip? Does anybody ever have the experience of doing this?
Also changing the compiler from em++ to wasm-32-wasi-clang++ or clang++ doesn't change anything.
By the way if I use that kit I get:
Error while parsing file whatever.pro. Giving up.
Project ERROR: Cannot run target compiler 'em++'. Output:
===================
===================
Maybe you forgot to setup the environment?
And please don't tell me that this question is the duplicate of this because it isn't(mine has more details) and there's no useful answer for that after 9 months at this time.
Any help is much appreciated.
Make sure you run:
emsdk install
and
emsdk activate
within emsdk folder, not from a relative path.
You have to setup the emsdk inside QtCreator => Preferences => Devices => WebAssembly. Afterwards the compiler should be auto-detected by Qt Creator.
I had the same problem and the solution was, that python was not correctly recognized.
In my case the symbolic link /usr/bin/python was not set
ln -sf /usr/bin/python3 /usr/bin/python
Afterwards the emsripten Toolchain is recognized automatically in QtCreator.

How to find where a linter is installed in order to work for SublimeLinter in Sublime 3?

So, I have installed cpplint in Sublime 3 via the Package Control, in a Windows 8.1 64bits machine.
However, it seems that cpplint cannot be found, as discussed in this troubleshooting page:
http://www.sublimelinter.com/en/latest/troubleshooting.html
More specifically, the page says that:
If the result says that the linter could not be found, that means the linter executable is in a directory which is not in your PATH, and SublimeLinter will not be able to find it. At this point you will have to find out what directory the executable was installed in from the linter’s documentation. Once you find that, you will need to augment your PATH by following the steps in Augmenting PATH below.
However, after hours trying I just can't find the"directory the executable was installed", in order to include in PATH. Yes, I found many questions about this online, but the only ones that have answers are giving solutions to Linux systems.
Any help would be very much appreciated.
In the sublime editor select Preferences -> Browse Packages
A folder will open listing the installed packages.

ide-haskell for atom editor isn't working

I'm trying to use the Ide-Haskell package for atom, but for some reason, it's not working.
First, I have ghc-mod and stylish haskell installed in sandboxes under ~/lib/. Here is what my config.cson file looks like:
athan#THETA ~> cat ~/.atom/config.cson
'global':
'exception-reporting':
'userId': '3b5a8a6c-7778-b310-6a5f-d8ecc314b30f'
'welcome':
'showOnStartup': false
'core':
'themes': [
'atom-dark-ui'
'seti-syntax'
]
'ide-haskell':
'ghcModPath': '/home/athan/lib/ghc-mod-5.2.1.1/.cabal-sandbox/bin/ghc-mod'
'stylishHaskellPath': '/home/athan/lib/stylish-haskell-0.5.11.0/.cabal-sandbox/bin/stylish-haskell'
'editor':
'fontSize': 14
'showIndentGuide': true
'showInvisibles': true
'softWrapAtPreferredLineLength': true
'invisibles': {}
I've tested those paths, and they're correct - I can call command --help, etc.
I'm also currently running linux, not Mac, so I had to add some keymappings:
athan#THETA ~> cat ~/.atom/keymap.cson
'.workspace':
'ctrl-alt-o': 'ide-haskell:toggle-output'
'.editor':
'ctrl-alt-s': 'ide-haskell:prettify-file'
These register just fine, and are visible in the ide-haskell's package settings. However, issuing the keystroke doesn't do anything (It used to open a file and save-as, respectively).
Where am I most likely to have screwed up? I installed ide-haskell before finishing the ghc-mod installation, but that shouldn't really matter... the links are correct. If anyone could help with this, I would be ecstatic :)
You need to create a cabal project in the directory you're working in. Just run cabal init and answer the questions. Then open atom in the current directory. The Haskell IDE menu should appear.
I know this is old but I want to mention that if you are using stack then you can run stack exec atom to run atom within your configured Haskell environment. That works great for me on Windows.

EclipseFP is searching for GHC and cannot find it

I have working Eclipse (Kepler Service Release 2) + EclipseFP (2.6.0) + Haskell Platform under Windows 8.1 x64.
In one moment after some cabal install, EclipseFP stopped working and showing me:
The program ghc version >=6.4 is required but it could not be found.
I have:
Uninstalled Haskell Platform
Deleted C:\Users\myuser\AppData\Roaming\cabal*
Deleted C:\Program Files (x86)\Haskell*
Install Haskell Platform 2013.2
Run Eclipse with my Haskell workspace
Try to build my project
It gave me this error about ghc and cannot build it.
EclipseFP configuration found all Haskell Helper executables. It found Cabal 1.16.0.2 and GHC 7.6.3 already. From command-line GHC and cabal are found and are working. "cabal build" is working on the project from command-line, too.
This message doesn't say almost anything! If I could see the path it is searching for GHC or where it get this path from...
EDIT:
Message from buildwrapper:
"C:\Users\home\AppData\Roaming\cabal\bin\buildwrapper.exe synchronize --force=false --tempfolder=.dist-buildwrapper --cabalpath=C:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\extralibs\bin\cabal.exe --cabalfile=D:\Project\haskell2\SomeGL\SomeGL.cabal --cabalflags= --logcabal=true
configuring because setup_config not present
"C:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\extralibs\bin\cabal.exe" "configure" "--verbose=1" "--user" "--enable-tests" "--enable-benchmarks" "--builddir=D:\Project\haskell2\SomeGL.dist-buildwrapper\dist"
cabal.exe: The program ghc version >=6.4 is required but it could not be found."
Calling exactly the last line from cmd.exe (as normal non-admin user) everything is working fine:
"C:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\extralibs\bin\cabal.exe" "configure" "--verbose=1" "--user" "--enable-tests" "--enable-benchmarks" "--builddir=D:\Project\haskell2\SomeGL\.dist-buildwrapper\dist"
EDIT:
To find the potential path environement that is used I tried to run GHCi console inside Eclipse and tried:
import System.Environment
x <- getEnvironment
filter (\ (a,_) -> a == "Path") x
and got something that is starting with:
[("Path","C:\Program Files (x86)\Haskell\bin;C:\Program Files
(x86)\Haskell Platform\2013.2.0.0\lib\extralibs\bin;C:\Program
Files (x86)\Haskell Platform\2013.2.0.0\bin;...")]
First folder is invalid, but Haskell Platform is valid and working.
Another thing I found. One of times I have run "Build All" command there was run Process in Eclipse with GHC and the path was:
Running executable C:\Program Files (x86)\Haskell
Platform\2013.2.0.0\bin\ghc.exe
I went to see this process details and it is run from the same user that is currently Eclipse run with. And the path is correct, but I still got the error:
The program ghc version >=6.4 is required but it could not be found.
Running from command-line still it is working. The program has errors, but only in command-line I see them.
Could someone help with finding this problem?
EDIT:
I found some interesting issue. Running "Build All" command is executing this command:
C:\Users\myuser\AppData\Roaming\cabal\bin\buildwrapper.exe synchronize
--force=false --tempfolder=.dist-buildwrapper --cabalpath=C:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\extralibs\bin\cabal.exe
--cabalfile=D:\haskell\SomeGL\SomeGL.cabal --cabalflags= --logcabal=true
Which run from command-line gives an error. The problem is that there are no quotes around cabalpath, because it has spaces in it. When I run it that way from command-line it works:
C:\Users\myuser\AppData\Roaming\cabal\bin\buildwrapper.exe synchronize --force=false --tempfolder=.dist-buildwrapper --cabalpath="C:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\extralibs\bin\cabal.exe" --cabalfile=D:\haskell\SomeGL\SomeGL.cabal --cabalflags= --logcabal=true
I think that all "--cabalfile" parameters should have quotes, because paths could have spaces in them. I still don't know if this is the problem under Eclipse.
I found the problem!
It is that EclipseFP 2.6.0 is using upper case "PATH" variable, but my Windows 8.1 use "Path" and programatically some kind it is possible to have valid two variables "PATH" and "Path" when executing BuildWrapper and Cabal. So something is messing up.
Workaround for this problem is if you rename from Control Panel | System | Environment variables for both User and System from "Path" to "PATH".
I hope this could be fixed in EclipseFP so it could in future work in any case.
Building your project means that under the scenes, cabal build is launched. If you activate the debugging mode in the Haskell helper executable preference page (show BuildWrapper responses), you should see the exact cabal build command being sent. It could be that the path used in Eclipse is different than the path used in the command line, check you eclipse shortcuts. EclipseFP can find the executables because it searches also in some well known folders on windows.
You can also take the current dev version of EclipseFP from github. It should now pass --with-ghc to cabal invocations to make sure the path detected in Eclipse is the one used.

Resources