Unfortunately I don't have access to a *nix box at work or at home. The only way I can play with Haskell is on windows. Anyone here using Haskell on Windows? What's your setup?
We recommend running GHCi in a standard Windows console: select the GHCi option from the start menu item added by the GHC installer, or use Start->Run->cmd to get a Windows console and invoke ghci from there (as long as it's in your PATH ).
On Windows, all of GHC's files are installed in a single directory. You can override it, but by default this directory is c:/ghc/ghc- version . The executable binary for GHC will be installed in the bin/ sub-directory of the installation directory.
Open a command window and navigate to the directory where you want to keep your Haskell source files. Run Haskell by typing ghci or ghci MyFile. hs. (The "i" in "GHCi" stands for "interactive", as opposed to compiling and producing an executable file.)
DISCLAIMER: What's below was valid in Oct, 2013. So there is a good chance it might get outdated soon. Your edits and comments are welcome.
This is what I have done in order to get Haskell set up on my Windows 7 x64
Download and install the Haskell Platform from http://www.haskell.org/platform/windows.html
Download and install Sublime Text 3 from http://www.sublimetext.com/3
View
>> Show console
import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())
Tools
>> Command palette
Package Control: Install Package
SublimeHaskell
Cabal is the standard package manager for Haskell. What you need to do is:
Run:
cabal install cabal-install cabal update cabal install aeson cabal install haskell-src-exts cabal install ghc-mod cabal install cmdargs cabal install haddock
You can NOT install hdevtools on Windows by running: cabal instal hdevtools. What you need to do instead is:
Download the source code of hdevtools for Windows from https://github.com/mvoidex/hdevtools* (* Currently does not work with GHC 7.10. See this fork for building with GHC 7.10 and above)
Unpack it to some folder
Go to that folder and run:
runhaskell Setup.hs configure --user runhaskell Setup.hs build runhaskell Setup.hs install
Watch for the path (in the console output) where the hdevtools have been installed. You will need this path when setting up the SublimeHaskell plugin in Sublime. The path should look something like this: C:\Users\Aleksey Bykov\AppData\Roaming\cabal\bin
where Aleksey Bykov
is the name of the current user.
Preferences
>> Package settings
>> SumblimeHaskell
>> Settings - User
Make sure you configuration looks like:
{ "add_to_PATH": [ "C:/Users/Aleksey Bykov/AppData/Roaming/cabal/bin/" ], "enable_hdevtools": true }
where C:/Users/Aleksey Bykov/AppData/Roaming/cabal/bin/
is that path (you got at step 5) where hdevtools (all all other toolls have been installed) 4. Save the file and restart Sublime
hello-world.hs
Put the following code there:
main::IO() main = putStrLn "Hello world!"
Build and run by going Tools
>> Build
x 2 times (first it builds, second it runs)
There is another great article: http://howistart.org/posts/haskell/1
I've used Haskell on Windows, but only when forced to. Not because the combination Haskell+Windows is particularly bad, but just because I don't really like Windows.
My setup was basically the following:
As you can see I was trying to get an environment that was as similar to Unix as possible (without using cygwin, because I find it utterly confusing). Vim is my favourite editor. The reason for Visual Studio was that the C environment shipped with GHC doesn't cover all of Win32API. I used CMake to get a decent build environment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With