aboutsummaryrefslogtreecommitdiff

clean-compiler

The Clean compiler.

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


Contents

1. Syntactic sugar
1.1. Lambda-case
1.2. Tuple constructors
2. Syntax changes
2.1. Use of module header keywords


1. Syntactic sugar

1.1. Lambda-case

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

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

is transformed to

\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:

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:

:: MyType = { module :: Int }

The keywords are:

  • module
  • definition
  • implementation
  • system

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