Amulet 0.6.0.0 "None : option release_joke"
Pre-releaseYou can get this release here or through the usual means.
Changes since last release:
-
The REPL will only reload changed files (#211)
-
--test-tc
dumps the Typed AST and stops before lowering (e87e40a) -
The type checker supports lifted booleans, tuples and lists (shorthand for a series of
Nil
/Cons
applications) (5363e95) -
Type error messages involving type functions will print the reduced type along with the application (6aa99ff)
-
The standard library has list manipulation functions (
amulet/list.ml
), support for enumerations and ranges (data/enumeration.ml
), thefoldable
andtraversable
type classes (data/foldable.ml
/data/traversable.ml
resp.),typeable
support functions (data/typeable.ml
), bindings to the Lua I/O facilities (lua/io.ml
), and exception support (amulet/exception.ml
). -
The type checker knows of the
typeable
class for exposing type information at run-time. This is opt-in: The programmer can ask for their types to betypeable
with aderiving instance typeable T
declaration. (8d5826f) -
Idiom bracket handling was moved to the type checker, which means
(| x + y |)
is now handled correctly (and(| x |)
became a shorthand forpure x
). (0bba8c3) -
The compiler understands
include
statements as a way toopen
a module while also exposing the contents of the module. (424b24a, #207) -
Added more bugs
The typeable
class
The typeable class is wired-in, and deeply magical. Users are not allowed to define instances of typeable
since that would compromise type safety. It doesn't even get an Amulet definition, but it would be something like this:
(* A representation of 'x *)
type type_rep 'x
class typeable 'x begin
val type_of : 'proxy 'x -> type_rep 'x
end
The compiler also has a wired-in definition for comparing type_rep
s, but using the standard library module amulet/typeable.ml
is recommended:
val is_same_type :
forall 'a 'b.
typeable 'a * typeable 'b =>
proxy 'a -> proxy 'b -> option ('a :~: 'b)
val cast :
forall 'a 'b.
typeable 'a * typeable 'b =>
'a -> option 'b
The amulet/typeable.ml
support module also defines a dynamic
type, for boxing a value along with a type representation for the value.
The typeable support module is exported from the prelude as module Typeable
.