Haskell
Code written in Haskell is guaranteed to have no side effects ... because no one will ever run it? -- XKCD 1312
Install Haskell
- Homebrew
- GHCup (officially supported)
Paste the following command to your Terminal window:
brew install ghc cabal-install haskell-stack haskell-language-server
This make take a while to install all necessary Haskell components. Once finished, let's test your installation:
- Type
ghci
in terminal. This will open Prelude - Haskell's interactive shell. - Type
2022 + 1
and hitEnter
. - Enjoy Haskell telling you the current year! Woooah! 🥳
To close Prelude, simply hit Ctrl
+D
. Just like in Python!
We need to install GHCup, which includes all necessary components to execute Haskell code. Run the following command in a Terminal window:
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
Once you see the message "Welcome to Haskell!", you'll be prompted about updating your $PATH
variable, installing HLS and better integration with GHCup. Please choose all the default values:
The download and installation may take a couple of minutes. Once all components are installed, test your Haskell by launching its interactive shell with ghci
and typing 1 + 1
:
Get VS Code extension
JetBrains do not have an IDE for Haskell, but VS Code works very well with the official Haskell extension!
Cool! You're all set to start your journey with functional programming. Psst... There is a pretty good online guide to Haskell: Learn You A Haskell for Great Good! 📚