* record dot updates: update to new ghc-lib-parser
This updates the ghc-lib-parser library featuring record dot updates and
adds tests for the new feature.
CHANGELOG_BEGIN
CHANGELOG_END
* update snapshot after pin on windows
* added a test for error locations
* nested record puns test
* update ghc commit
* update of stack dependencies (linux)
* update stack snapshot(windows)
* Move builtin exceptions to a stable package.
This PR moves the built-in exceptions (GeneralError, ArithmeticError, ContractError) to a stable package in daml-prim, in preparation for removing them from LF proper.
Part of #8020.
changelog_begin
changelog_end
* Update tests
* rename the module
* couple that got away
* update hash
* Update dar reader test.
* typo
* questionable lint
* Switch from `@silent` to `@nowarn`.
This annotation is native to Scala 2.12.13+ and 2.13.2+. It replaces
most usages of `@silent`.
I had to get creative about a couple of use cases that didn't work.
Specifically:
1. Suppressing deprecation warnings works, but Scala 2.12 erroneously
complains that the `@nowarn` is unnecessary. I had to suppress
this warning too with `-Ywarn-unused:-nowarn`.
2. I can't seem to suppress the warning, "The outer reference in this
type test cannot be checked at run time." Instead, I have
refactored the code to remove the warning.
We still need to use the silencer plugin to suppress some warnings about
unused imports (because of compatibility between Scala 2.12 and 2.13),
but this means we no longer need the library, and therefore it is not a
transitive dependency that downstream consumers need to worry about.
CHANGELOG_BEGIN
CHANGELOG_END
* Add some comments around `@nowarn` support.
* language-support/scala: Fix a warning suppression.
* Revert to the default warnings.
Compatibility was complaining.
* Check visibility for by-key operation of local contracts
fixes#9454
I tried out two approaches for this:
1. The one here where we add a new callback. This has the advantage
that the engine remains oblivious to visibility checks. They are all
done outside and the engine doesn’t even know about the reading
parties.
2. Make the engine aware of the reading parties. A start of that is in
#9458.
Both work in principle but I ended up going for 1 in the end. Doing
half of the visibility checks outside the engine and half inside just
seems worse than the current state.
changelog_begin
- [Daml Engine] Fix a bug where it was possible to
fetch/lookup/exercise a local contract by key even if the reading parties
are not stakeholders. See #9454 for details.
changelog_end
* Disable new test on Canton
changelog_begin
changelog_end
* Exclude from compat tests
changelog_begin
changelog_end
* s/LocalLookup/LocalFetch/
changelog_begin
changelog_end
* Address review
changelog_begin
changelog_end
This focuses on the semantics rather than the display in Daml Studio
which needs more work (and seems not all that important at this
stage).
This already uncovered a bug which also applies outside of scenarios:
The consumedBy field was not affected by rollbacks which breaks the
mustBeActive check in partial transactions. This PR fixes this by
caching on try and restoring on rollback.
changelog_begin
changelog_end
* Pattern matching for RoundingMode
- Fix the order of RoundingMode constructors in GHC.Types to match the LF built-in order. Try to match this order across all code and documentation, and added a test for this order.
- Implements pattern matching for RoundingMode. The added machinery could also be useful for solving #5753 in the future.
- Implements Show instance for RoundingMode. (Mainly so we can use them in tests.) Moved BigNumeric Show instance to GHC.Show.
changelog_begin
changelog_end
* mkScrutineeEquality typo
* fix roundingModeLiteralMap order
* Use custom type for building case body
* Factor GeneralisedCaseAlternative into GeneralisedCasePattern
* Fix finalize
* Remove unused bindings
* daml build: add a --access-token-file for remote dependencies
This adds a `ledger.access-token-file` field in the `daml.yaml` project
file and a `--access-token-file` flag to `daml build` to authorize
querying/fetching of remote dependencies.
CHANGELOG_BEGIN
[daml build] A new flag `--access-token-file` is added for the `daml
build` command. It allows the specify the path to an access token to
authenticate against the ledger API. This is needed if the project
depends on a remote Daml package hosted on such a ledger. Alternatively,
the path to the token can also be specified in the `daml.yaml` project
file under the `ledger.access-token-file` field.
CHANGELOG_END
* Add sqrt to DA.Math
fixes#9149
Not a huge fan of DA.Math but this seems like a nicer fix to #9149
than removing the lint.
changelog_begin
changelog_end
* revert change to lints
changelog_begin
changelog_end
* Expose rounding modes as constructors.
This PR exposes the rounding modes as constructors for RoundingMode. Pattern matching for RoundingMode is not implemented and not critical (will open a separate issue).
This PR also adds documentation for BigNumeric.
changelog_begin
changelog_end
* Fix rounding mode literals
* Update data-types.rst
* expose constructors
* expose constructors (part 2)
* Update compiler/damlc/daml-prim-src/GHC/Types.daml
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* Try to improve `Numeric n` description.
* Add message for RoundingMode match and a test.
* Restrict RoundingMode test to 1.dev
* Update version numbers to 1.13
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* Syntax highlighting for exceptions.
* Add `exception`, `try`, and `catch` as keywords.
* Add `throw` as function name.
changelog_begin
changelog_end
* Updated wrong language definition.
* Add 'message'
* Add BigNumeric literals in Daml.
Adds support for BigNumeric literals (when available). Only literals that will fit in a single Numeric are supported for now.
I introduced the `IsNumeric t` typeclass because this is an easy way to restrict `fromRational` without moving it into its own typeclass. (Moving it into a typeclass causes some gnarly problems with the specializer -- it starts creating references to GHC.Real in an attempt to optimize the invocation, and that's a problem because GHC.Real doesn't exist in LF.)
I then added the "fromNumeric" and "fromBigNumeric" conversion functions in that class, since they seem really convenient, and it also means we could in the future make it so that any type that implements `IsNumeric` gains literals (via Numeric or BigNumeric literals). This would improve a lot of Numeric code, since it eliminates the need to annotate types so often! But for now only Numeric and BigNumeric literals are supported.
changelog_begin
changelog_end
* lint
* Add test for too large bigNumeric
* remote pkgs: resolve package names in data dependencies via ledger
This implements part 3) of #8976.
This adds the ability to specify package names/versions in daml.yaml in
the data-dependencies stanza. They are being resolved via the project
ledger and a daml.lock lock file.
CHANGELOG_BEGIN
[remote dependencies] Package names and versions, as well as package
ID's are allowed in the `data-dependencies` list of `daml.yaml`. These
packages are fetched from the project ledger. The auto-generated
`daml.lock` file keeps track of the package name/version to package
ID's resolution and should be checked in to version control of the
project.
CHANGELOG_END
* added docs
* Update compiler/damlc/lib/DA/Cli/Damlc/DependencyDb.hs
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* Update docs/source/daml/reference/packages.rst
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* suggestions
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* Don't mark dalfs in data-dependencies as main dalfs
This causes the LF version consistency check to fail on DALF data
dependencies that were generated with a different LF version and also
occur in dalfsFromDependencies. E.g. a dalf like `daml-prim-DA-Types`
triggers this issue.
changelog_begin
- [DAML Compiler] DALFs in data-dependencies that are imported directly
now require corresponding `--package` flags to make them visible. The
reason for this is that DALFs that are data-dependencies are no longer
treated as main DALFs.
changelog_end
* Daml script dump write DALFs instead of DARs
Produces DALFs for dependencies and adds them to the data-dependencies.
Package flags for main DALFs are added to the build options.
* Update test-cases
* address review
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
* Only walk list once in splitAt
No idea if that makes a significant difference anywhere but walking
the list twice is definitely not faster.
changelog_begin
changelog_end
* Avoid hardcoded locations in tests
changelog_begin
changelog_end
* Cleaning up BigNumeric somewhat.
Done in this PR:
- Moved BigNumeric and RoundingMode to GHC.Types to be alongside Numeric and Decimal
- Additive, Multiplicative, Number instances for BigNumeric
- Eq, Ord instances for BigNumeric and RoundingMode
Todo:
- BigNumeric literals in Daml
- Constructors and pattern matching for rounding mode
- Better documentation
changelog_begin
changelog_end
* remove ^ for now
* define (^) because it's required
* Error in (^) for negative powers.
* better error message
* import fromString and error
* Add -Wno-unused-imports because of compiling to different versions.
* add (fromString) and (error)
* Update bignumeric test.
* Add Ord instances for Any(Template|Choice|ContractKey)
This is useful to use them as map keys. We have a large application
that currently does a linear search over a potentially very large set
of contracts which can be replaced with a map lookup with this.
changelog_begin
changelog_end
* Match builtin equality for Any(Template|Choice|ContractKey)
changelog_begin
changelog_end
* Use primitives directly
changelog_begin
changelog_end
This provides variants of `dedup*` and `sort*` which rely on Daml-LF’s
builtin ordering (using Map internally). I don’t have microbenchmarks
but even in macrobenchmarks this is a measurable improvement which
isn’t particularly surprising.
changelog_begin
- [Daml Stdlib] Add `DA.List.Builtinorder` module. This module provides
variants of `sort*` and `dedup*` which rely on Daml-LF’s builtin
ordering and are significantly more efficient in some cases.
changelog_end
Haven’t tracked down when they broke. They used to work at some point
but atm they are very broken and don’t test anything.
This PR fixes the bash mess to parse the files correctly and fixes two
minor issues that creeped in by virtue of the doctests being broken.
changelog_begin
changelog_end
* Optimize mapOptional and add more efficient findOptional
Given that we don’t have list fusion catOptionals . map f is clearly
less efficient than this version.
I also added findOptional which can be pretty handy in certain cases.
changelog_begin
changelog_end
* more foldr
changelog_begin
changelog_end
* fix tests
changelog_begin
changelog_end
Both of these seem sufficiently common that it seems worth optimizing
them.
I realize I’m switching somewhat randomly between foldr and
hand-written recursion. Either should be better than traversing the
list twice but I think it’s a clear sign that we need some benchmarks
to establish the benefits or downsides of one over the other properly.
changelog_begin
changelog_end
* New transaction node: NodeRollback. Fixup every match with a crash + TODO.
changelog_begin
changelog_end
* remove 3 methods from NodeRollback which are not needed to fulfill its interface
* add override to remaining 4 methods implemented in body of NodeRollback
* remove unrequired 2nd type parameter (Cid) from NodeRollback
* add missing 8020 marker
* damlc pkg: use cache for already present packages
This only downloads packages from a remote ledger, if the package is not
already present in the dependency db as a normal dependency.
CHANGELOG_BEGIN
CHANGELOG_END
* damlc: Allow package IDs in data-dependencies.
This is the next step outlined in issue #8976. If package id's are
present in the `data-dependency` section of the daml.yaml file, we try
to fetch them (and their transitive dependencies) from the default
ledger of the project.
CHANGELOG_BEGIN
CHANGELOG_END
* Generate exception instances from syntax.
changelog_begin
changelog_end
* II
* III
* VII
* update ghc patch and add test
* VIII
* IX
* Remove DatatypeContexts
* X
* update stack snapshot
* don't need datatypecontexts warning anymore
* X-2
* XII
* XIII
This PR addresses the TODO to expose the actual exception values and
type instead of the message. This allows us to simply speedy a bit by
removing the continuation used for that but more importantly it means
we can now catch and handle the exception in Daml script.
changelog_begin
changelog_end
This untangles the dependency structure a bit so that //daml-lf no
longer ends up depending on daml script and sandbox and similar crap
which should improve build times in general.
changelog_begin
changelog_end
* Add new variant to Value.scala for builtin-exceptions.
final case class ValueBuiltinException[+Cid](tag: String, value: Value[Cid]) extends Value[Cid]
And push through the code consequences.
Most places fixed up.
A couple more things to do in this PR (marked NICK)
A couple of things which can be left for later (marked 8020)
fix build
fix another scala match
changelog_begin
changelog_end
* fix any match
* add marker of code which needs attending to in the PR
* extend ledger-api value.proto & fix LfEngineToApi
* undo/comment-out the change to value.proto
* add tests in HashSpec for BuiltinException
* code but dont yet enable value-gen for builtin exceptions
* address comments which suggest we crash in various places
* support BuiltinException in scenario_service.proto
* one more TODO 8020 tag
* daml pkg: split installation of deps and package db inititialization
This is the next step for the daml package manager program #8976.
This splits the installation of dependencies from the initialization of
the (ghc) package database.
CHANGELOG_BEGIN
CHANGELOG_END
This PR adds a hook in the compiler and the engine to allow easy prototyping of new features.
In particular by using this hook, one can add a new feature in 1.dev with modifying:
compiler
type checkers (both Haskell and Scala)
archive Protobuf
archive decoder
In addition of development speed, this also adds a bit of confidence, as the peaces enumerated above are not touched when adding the feature: The feature can be added by modifying only 1.dev Daml standard library and Speedy.
aa7991f8 shows a use case of this hook.
CHANGELOG_BEGIN
CHANGELOG_END
- Add `DA.Exception` module that re-exports `DA.Internal.Exception`
while hiding the `DamlException` class.
- Uncommented out the primitive calls in `DA.Internal.Exception`, so
the standard library is actually calling the underlying LF primitives.
- Expanded the `ExceptionDesugared` test to actually throw and catch
an exception. :-)
changelog_begin
changelog_end
We used to do this for some packages but it broke cpp. I don’t
actually know why it doesn’t do that anymore but I’ll gladly accept
that fact and turn it on everywhere.
changelog_begin
changelog_end
* Expose Daml stacktraces for Daml Script errors
This finally plugs together the pieces from the previous PRs to
provide stacktraces on any ScriptF command (and thereby anything
involving an interaction with the ledger).
fixes#8754
changelog_begin
- [Daml Script] When running Daml Script on the command line you will
now see a Daml stacktrace on failures to interact with the ledger
which makes it significantly easier to track down which of the calls
fails. By default, you will only get the callsite of functions like
`submit`. To extend the stack trace, add `HasCallStack` constraints
to functions and those will also be included.
changelog_end
* Fix non-determinism in tests
changelog_begin
changelog_end
* fmt
changelog_begin
changelog_end
As a first step for the daml package manager, we move all dalf files
from (data-)dependencies to a new `.daml/dependencies` directory.
CHANGELOG_BEGIN
CHANGELOG_END
* Improve errors on duplicate record field names
fixes#8994
changelog_begin
changelog_end
* Apparently I was wrong about names
changelog_begin
changelog_end
* hlint
changelog_begin
changelog_end
* newlines don’t render well in daml build
changelog_begin
changelog_end
* maybe I should test if my code compiles before pushing
changelog_begin
changelog_end