aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: d6dd1a942acd25d2d744ae57f7a6c869cbee34f2 (plain) (blame)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# clean-compiler

The [Clean][clean] compiler.

The official Clean compiler can be found at
[https://svn.cs.ru.nl/repos/clean-compiler/][cocl].
This is a fork to implement experimental new features.

---

## Contents

1\. [Syntactic sugar](#1-syntactic-sugar)  
1.1. [Lambda-case](#11-lambda-case)  
1.2. [Tuple constructors](#12-tuple-constructors)  
2\. [Syntax changes](#2-syntax-changes)  
2.1. [Use of module header keywords](#21-use-of-module-header-keywords)  

---

## 1. Syntactic sugar

### 1.1. Lambda-case

Similar to [GHC's LambdaCase][ghclambdacase], this is a sugar for lambda
expressions where the argument is only used in a `case .. of` expression. For
example,

```clean
\case of
	0 = "zero"
	1 = "one"
	_ = "many"
```

is transformed to

```clean
\x -> case x of
	0 = "zero"
	1 = "one"
	_ = "many"
```

where `x` is a fresh variable.

The extension to the grammar:

```
LambdaAbstr = ...
            | \case of {CaseAltDef}+
```

### 1.2. Tuple constructors

There are now tuple constructors that can be used curriedly, similar to GHC and
the way the tuple type could be curried already. For example:

```clean
import StdFunc
Start = flip (,) 5 10
```

## 2. Syntax changes

### 2.1. Use of module header keywords

Four keywords are now only recognised on the topmost level. This allows for
using them as a record field, for example:

```clean
:: MyType = { module :: Int }
```

The keywords are:

 - `module`
 - `definition`
 - `implementation`
 - `system`

It is not allowed to define a function named as one of these keywords.

[clean]: http://clean.cs.ru.nl
[cocl]: https://svn.cs.ru.nl/repos/clean-compiler/
[ghclambdacase]: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#lambda-case