Release of DAML SDK v0.13.21

DAML Compiler

  • Enable the language extension FlexibleContexts by default.
  • BREAKING CHANGE Enable the language extension MonoLocalBinds by default. let and where bindings introducing polymorphic functions that are used at different types now need an explicit type annotation. Without the type annotation the type of the first use site will be inferred and use sites at different types will fail with a type mismatch error.

Java Codegen

  • Fix bug that caused the generation of duplicate methods that affected sources with data constructors with type parameters that are either non-unique or not presented in the same order as in the corresponding data type declaration. See #2367.

Ledger

  • H2 Database support in the Ledger API Server.

Sandbox

  • The sandbox now properly sets the connection pool properties minimumIdlemaximumPoolSize, and connectionTimeout.

She sells sea shells : Pattern matching records

This is a brief survey of possibilities when pattern matching records in DAML.

This will help those looking to learn about features enabling succinct expressions involving records as arguments.

We start with the following data declaration to give us something to work with.

Suppose we want to write a function that calculates the number of items on a stack.

Consider the “canonical” way of writing this function where we attempt to be as explicit as possible.

2-1

[Note : Rule of thumb for formatting “with” blocks – Always indent under the ‘with’ and always drop back when the block is finished.]


DAML allows us to inline the function’s type signature like this.3-1

“Record field punning” (meaning, when the name of the variable coincides with the name of the field, you can omit it) is supported so we can remove the bindings of variable names and work directly with the field labels.3.1-1

The field top is unused so we can elide matching on it.4-1We can rewrite the above as a multi-equation equivalent (and we’ll drop the explicit type annotation for brevity).4.1

We can get the second equation down to a “one-liner” by switching to “record brace” syntax.


Lastly, we can employ “record wild cards” in the second equation to bring the field labels of the argument into the scope of the right hand side so that we can write simply this.


DAML provides flexibility for expressing patterns over records allowing the modeler to find their own “right” balance between readability and conciseness!

Release of DAML SDK v0.13.20

Documentation

  • Added platform-independent tips for testing

DAML Compiler

  • Some issues that caused damlc test to crash on shutdown have been fixed.
  • The DAML compiler was accidentally compiled without optimizations on Windows. This has been fixed which should improve the performance of damlc and daml studio on Windows.
  • damlc build should no longer leak file handles so ulimit workarounds should no longer be necessary.
  • Allow more contexts in generic templates. Specifically, template constraints can have arguments besides type variables, if the FlexibleContexts extension is enabled.

DAML-LF

  • Breaking Rename NUMERIC back to DECIMAL in Protobuf definition.

DAML Studio

  • damlc ide now also accepts --ghc-option arguments like damlc build so damlc ide --ghc-option -W launches the IDE with more warnings.
  • The VSCode extension now has a configuration field for passing extra arguments to damlc ide.

DAML Integration Kit

  • Participant State API and kvutils was extended with support for changing the ledger configuration. See changelog in respective package.scala files.

Sandbox

  • Fixed a bug that caused the reset service to hang for 10 seconds. See issue #2549.

Java Bindings

  • The Java Codegen now supports parametrized ContractIds. See #2258.

DAML Standard Library

  • Add stripInfix function to DA.List.

Release of DAML SDK v0.13.19

Sandbox

  • Fixed a bug that prevented the ledger from loading transactions with empty workflow ids.
  • Fixed internal shutdown order to avoid dead letter warnings when stopping Sandbox/Ledger API Server. See issue #1886.

DAML Studio

  • Added a new command for visualizing a project in the IDE.
  • Print stack trace when a scenario fails.
  • Various memory leaks have been fixed so long-running sessions should no longer show a significant increase in memory usage.

DAML Compiler

  • The --project-root option now works properly with relative paths in daml build.
  • Support generic template declarations and instances. Documentation for generic templates is still being worked on.
  • The --dump-pom flag from damlc package has been removed as packaging has not relied on POM files for a while.

Navigator

  • {"None": {}} and {"Some": value}, where previously accepted, are no longer supported or used for DAML Optional values. Instead, for simple cases, use the plain value for Some, and null for None. See issue #2361 for other cases.

HTTP JSON API

  • A new, more intuitive JSON format for DAML values is supported. See issue #2361.

Release of DAML SDK v0.13.18

DAML Docs

  • For damlc docs, the --template argument now takes the path to a Mustache template when generating Markdown, Rst, and HTML output. The template can use title and body variables to control the appearance of the docs.

DAML Assistant

  • Spaces in user names or other parts of file names should now be handled correctly.
  • The daml deploy and daml ledger experimental commands were added. Use daml deploy --help and daml ledger --help to find out more about them.
  • Fix a bug where daml studio did not launch VSCode on Windows.

Release of DAML SDK v0.13.16

DAML Compiler

  • BREAKING CHANGE Handwritten instances of Template and Choice typeclasses are no longer supported. All template constructs must be defined using declarations inside template syntax.

DAML Docs

  • The damlc docs command now produces docs to a folder by default. Use the new --combine flag to output a single file instead.
  • The damlc docs flag --prefix has been replaced with a --template flag which allows for a more flexible template.
  • The damlc docs flag --json has been dropped in favor of --format=json.

Extractor

  • BREAKING CHANGE Changed schema to accomodate removed field ExercisedEvent#contract_creating_event_id. Existing database schemas are not compatible anymore with the newer version. The extractor needs to be run on an empty schema from Ledger Begin.

Java Bindings

  • Add all packages of java bindings to the javadocs. See #2280.
  • BREAKING CHANGE Removed field ExercisedEvent#contract_creating_event_id. See #2068.

Ledger API

  • BREAKING CHANGE Removed field ExercisedEvent#contract_creating_event_id. See #2068.

Sandbox

  • The active contract service correctly serves stakeholders. See #2070.
  • Added the --maxInboundMessageSize CLI parameter to set the maximux size of messages received through the Ledger API. If the value is not set the current default is preserved (4 MB).
  • Makes package uploads idempotent and tolerate partial duplicates. See #2130.