Skip to content

Latest commit

 

History

History
47 lines (32 loc) · 1.18 KB

File metadata and controls

47 lines (32 loc) · 1.18 KB

Haskell

Installation

Haskell can be installed through Homebrew pretty easily.

brew install ghc cabal-install

Extra steps that I needed to perform post install

cabal update
cabal install ghc-mod

source

Using Haskell

Haskell can be used by running the command GHCI which is GHC’s interactive environment where Haskell expression can be interactively evaluated and programs can be interpreted.

When declaring variables on the terminal you must declare each variable/function with let.


For example,

let var = 2
let function x = x * 2 -- where function is the name and x its parameter

When writing on a file the extension must be .hs and there you can’t use the let keyword. To load a file onto ghci you use the :load file.hs command

:load file.hs
var = 2
function x = x * 2

Haskell tutorial

I recommend that you read through this online tutorial