Skip to content

Commit

Permalink
Update CHANGES.md with recursive rows, roundtrip printer and effect s…
Browse files Browse the repository at this point in the history
…ugar (#1043)


Co-authored-by: Daniel Hillerström <[email protected]>
  • Loading branch information
samo-novak and dhil authored Aug 31, 2021
1 parent 1429872 commit 90d0c29
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,57 @@ The syntactic sugar for effect and record fields which lets one omit the `()` ha

It is now possible to annotate type variables with `Mono` restriction, e.g. `sig id : (a::(Any,Mono)) -> a::(Any,Mono)`.

### Recursive rows

* Effect variables can be recursive, e.g. `{ |(mu a.F:(() { |a}-> ()) {}-> b|c)}`.
* **Breaking change**: Recursive rows are no longer restricted to variant syntax, i.e. separating fields using `|`. Recursive record and effects rows separate fields using `,` now.
* Recursive variants with no directly exposed fields no longer require the vertical bar separating fields from the row variable, e.g. `[|(mu a. Foo)|]` is equivalent to `[| |(mu a . Foo)|]`.

## Roundtrip: New pretty printer for types

This version of Links introduces a new pretty printer for types, called Roundtrip. This fixes various round-tripping issues.

The Roundtrip printer is now active by default. The old printer is still present.

The printer(s) to be used can be selected using the setting `types_pretty_printer_engine`, with the following values:

* `roundtrip`: the new printer
* `old`: the original printer
* `derived`: no pretty printing - prints the OCaml representation of the types

Note that one can select multiple printers at once, for comparison; this is done by separating printer names by commas, e.g.:

```links
@set types_pretty_printer_engine "roundtrip,old";
```

## Effect Syntactic Sugar

This version implements enhanced syntactic sugar for effects. The changes influence both the Roundtrip printer (see above) and the desugaring passes (between parsing and typechecking).

(*Note: Most of effect sugar, and in particular the changes introduced in this version, requires the `effect_sugar` setting to be `true`.*)

There is a new setting `effect_sugar_policy` which allows one to set which components of effect sugar to use. The available options (with shortcuts for convencience) are:

* `presence_omit` [shotcut `pres`]: omit presence polymorphic operations within effect rows
* `alias_omit` [shortcut `alias`]: hide empty (and emptied using `pres`) shared effect rows in the last argument of aliases
* `arrows_show_implicit_effect_variable` [shortcut `show_implicit`]: display the imlicit shared effect on arrows
* `arrows_curried_hide_fresh` [shortcut `chf`]: in curried functions, argument collection arrows are assumed to have fresh effects and these are hidden
* `contract_operation_arrows` [shortcut `contract`]: contract operation arrows: `E:() {}-> a` to `E:a` and `E:(a) {}-> b` to `E:(a) -> b`
* `open_default` [shortcut `open`]: effect rows are open by default, closed with syntax `{ | .}`
* `final_arrow_shares_with_alias` [shortcut `final_arrow`]: final arrow and a following type alias may share implicit effects
* `all_implicit_arrows_share` [shortcut `all_arrows`]: all arrows with implicit effect vars will be unified, an experimental setting

Multiple of these can be selected, separated by commas, e.g.:

```links
@set effect_sugar_policy "pres,alias,contract";
```

A version of the above is also available by entering `@help effect_sugar_policy;` in Links.

These changes are explained in more depth and with examples in [Links GitHub Wiki/Effect Sugar](https://github.com/links-lang/links/wiki/Effect-Sugar).

## Other fixes

* Fixed a bug where the REPL would unconditionally print a stacktrace for unknown directives.
Expand Down

0 comments on commit 90d0c29

Please sign in to comment.