Amulet 0.4.0.0 "Open Import Tariffs.ml"
Pre-releaseNote: Amulet now needs multiple files to work correctly. Please refer to the installation instructions for information on how to set it up.
Changes since the last release:
-
The note informing the programmer when a
match
can be safely converted into alet
(similarly forfunction
/fun
) is now properly generated. -
Breaking: Applications of type functions and polymorphic types are disallowed in instance heads.
-
There is now built-in syntax for using Applicative functors. The syntax
(| f x y z |)
(called an idiom bracket) desugars topure f <*> x <*> y <*> z
, using whateverpure
and(<*>)
are in scope. See the paper that introduced Applicative for more details. -
Amulet has a new module system: see below.
-
The compiler driver was changed to use sub-commands instead of the mess of flags we had before. See
amc --help
for more details. -
The compiler driver and the REPL can print their version, including which commit the release was generated from.
-
Minor changes to the constraint solver should help with type function behaviour in instance definitions.
-
Some operator precedence issues were fixed in the Lua parser. Moreover, the backend will print
if
statements in a single line when possible. -
An issue relating to sharing clauses in pattern lowering was fixed, thus generating faster code (at the expense of uglier-looking Lua)
Amulet's New Module System
The old module system (which treated modules as extensible namespaces) was completely replaced by a proper, saner module system:
-
Modules can no longer be extended—redefining a module will shadow it, as with any other definition. As a result, declaring a nested module (i.e.
module X.Y = begin .. end
) is no longer valid. -
External files can be imported, and treated as another module using the
import
construct. This supports both resolution according to a library path (import "my_lib.ml"
), or relative to the current file (import "./my_lib.ml"
). -
As the module language is now more unified,
import
module terms can also be used withinlet open
expressions. -
Most of the built-ins were axed from the compiler and moved to a ML file, except for those that need special type checker syntax. The
prelude
is loaded automatically in the REPL, but needs to be imported explicitly in compiled code:open import "prelude.ml"
results in the old compiler behaviour w.r.t. builtin names. -
There are bindings to some Lua libraries under the
lua/
directory of the standard library. -
The REPL now has a
:compile
command for writing the currently-loaded code to a file.