Monday, March 06, 2017

Haskell on Visual Studio Code for Windows

I am happy to hear a news about Haskell support on Windows via Visual Studio Code and its extension called Haskelly. These days, my main operating system has been Windows 7 and 10. Linux is for running a web server, and Mac is for an old laptop. My students have extensively used Windows OS. For me to teach Haskell programming, I have no option but to find an appropriate IDE necessarily running on Windows. Sometime ago, I recommended Eclipse and Haskell plugin on it. Now I believe I will recommend Visual Studio Code and its extension called Haskelly for Haskell programming to my Windows-favored students.

[Haskelly]

  • https://marketplace.visualstudio.com/items?itemName=UCL.haskelly


[Installation instructions]
  • Install Visual Studio Code
  • Run Visual Studio Code to activate the Haskelly extension
  • Download a stack installer and run it
  • Launch your CMD window or Windows PowerShell
  • Run "stack install intero QuickCheck stack-run --install-ghc"
    • stack : the name of a command for Haskell tool stack
    • intero : a tool for auto-completion of names in Haskell programs
    • QuickCheck : a property-based testing tool
    • stack-run : an option to direct stack to compile the source codes and to run the default executable
    • --install-ghc : an option to install GHC (Glasgow Haskell compiler)
  • Rerun Visual Studio Code
  • Open a new file named Main.hs extension to write the following
    • module Main where
    • main = putStrLn "Hello Haskell"
  • Run it!

Note. I guess you will meet some error messages: infero does not work.  But VS code may work partially for Haskell programming, though type information is not properly displayed by infero when you hover a mouse cursor over some function.

In this error, you may try the following

  • Run "stack build intero", "stack build QuickCheck", "stack build stack-run" separately. 
  • It may help you to build intero and QuickCheck at least. 
  • But I failed to build stack-run with an error message like "In the dependencies for unix-2.7.2.1: unbuildable must match <0, but the stack configuration has no specified version"
  • I do not know what solution is available for the problem. 



No comments: