Skip to content
This repository has been archived by the owner on Oct 18, 2021. It is now read-only.

Amulet 0.6.0.0 "None : option release_joke"

Pre-release
Pre-release
Compare
Choose a tag to compare
@plt-amy plt-amy released this 30 Oct 15:55
· 1209 commits to master since this release

You 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), the foldable and traversable 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 be typeable with a deriving 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 for pure x). (0bba8c3)

  • The compiler understands include statements as a way to open a module while also exposing the contents of the module. (424b24a, #207)

  • Several correctness fixes (#210, 553c368, c72f151, 27f8bad)

  • 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_reps, 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.