Enable MonoLocalBinds and FlexibleContexts by default in DAML (#2678)

Both language extension are needed to improve the UX of generic templates.
Without them templates a la
```
template Template (A t) => B t with
```
would produce an error that we need `FlexibleContexts` for the
`Template (A t)` context and a warning suggesting to simplify it to
`AInstance t`. The latter would expose an implementation detail we prefer
to hide.
This commit is contained in:
Martin Huschenbett 2019-08-28 12:21:54 +02:00 committed by mergify[bot]
parent 5f98347a73
commit 016b73b3de
3 changed files with 26 additions and 1 deletions

View File

@ -147,8 +147,10 @@ xExtensionsSet =
, DataKinds, KindSignatures, RankNTypes, TypeApplications
, ConstraintKinds
-- type classes
, MultiParamTypeClasses, FlexibleInstances, GeneralizedNewtypeDeriving, TypeSynonymInstances
, MultiParamTypeClasses, FlexibleContexts, FlexibleInstances, GeneralizedNewtypeDeriving, TypeSynonymInstances
, DefaultSignatures, StandaloneDeriving, FunctionalDependencies, DeriveFunctor
-- let generalization
, MonoLocalBinds
-- replacing primitives
, RebindableSyntax, OverloadedStrings
-- strictness

View File

@ -0,0 +1,21 @@
-- Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
-- Check that the `Template (A t)` context for template `B` does not cause
-- any warnings. (If we turned of `MonoLocalBinds` there would be warning
-- suggesting to simplify the context to `AInstance t`, which would expose
-- an implementation detail we prefer to hide.)
daml 1.2
module GenTemplContext where
template A t with
x : t
p : Party
where
signatory p
template Template (A t) => B t with
x : t
p : Party
where
signatory p

View File

@ -12,3 +12,5 @@ HEAD — ongoing
+ [Sandbox] The sandbox now properly sets the connection pool properties ``minimumIdle``, ``maximumPoolSize``, and ``connectionTimeout``.
+ [Java codegen] Fix bug 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 <https://github.com/digital-asset/daml/issues/2367>`__.
* [Dev Tooling] `daml-sdk-head` now installs current-workdir versions of all the published JARs (as version `100.0.0`) to the local Maven repo (`~/.m2`), to allow local testing of unreleased versions of the SDK against JVM-based applications. (Disable with `--skip-jars`)
+ [DAML Compiler] Enable the language extension ``FlexibleContexts`` by default.
+ [DAML Compiler] **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.