summaryrefslogtreecommitdiffstats
path: root/software/haskell.page
blob: 6911315c47263bdd361ecd1978d530b23545f0ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

Haskell
==================

Structure
------------
Haskell programs consist of monads, actions, modules, ???

Basic Syntax
---------------

A "type declaration":

    main :: IO ()

An action definition. Note that whitespace matters; the block extends to all
lines indented to the same position as the first non-whitespace after the
``do``:
    
    main = do
        stuff1
        stuff2


Compilation
------------
By default the "main" action of the "Main" module is the action that is
executed when a compiled haskell program is run by the operating system; 
this means that most haskell programs need to define these components. 

The `ghc` (Glasgow Haskell Compiler) is the most popular. To compile and 
execute a simple one file haskell program you will do something like:

    ghc -o hello helloworld.hs
    ./hello