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
This PR adds stack traces to all ScriptF commands and handles those in
the converter. Those stack traces are not yet used. To ease review,
I’ve left that for a separate PR. The plan is to use this to tackle
https://github.com/digital-asset/daml/issues/8754.
changelog_begin
changelog_end
* feature: damlc lints all files in project directory
fixes#8887.
This changes the input options of `damlc lint` to take several files. If
no file is given, all `.daml` files contained in the directory are
linted.
CHANGELOG_BEGIN
CHANGELOG_END
Pure shuffling around there is no logic change in here. I keep getting
lost in the 1.4k LedgerInteraction file so this client splits it up
into a 4 different files to make it a bit easier to navigate.
changelog_begin
changelog_end
fixes#8966
changelog_begin
- [Daml Studio] Failed scripts (and scenarios) now also offer the
option to view the table view at the state before the failing
transaction to ease debugging.
changelog_end
* damlc test: feature: add --all flag.
This adds a flag `--all` that will test all present scenarios/scripts in
the code and also report code coverage with respect to all present
templates/choices, whereas without the flag, code coverage is reported
relative to a single package.
CHANGELOG_BEGIN
[damlc test] Added a `--all` flag to test all present scripts/scenarios.
CHANGELOG_END
* Fix closure references in Daml Repl
Turns out the comment "we probably need to extend this to merge the
modules from each line" was exactly correct: If the result evaluates
to a closure (or a value including a closure), it can reference
definitions from the current module. This happens if the simplifier
lifted something out of the current definition (otherwise we have only
one and it cannot be recursive so no chance of leaking a reference).
This PR fixes this by checking whether the result references the
current module and if it does, we keep it around.
changelog_begin
changelog_end
* Address review comments
changelog_begin
changelog_end
* fmt
changelog_begin
changelog_end
CHANGELOG_BEGIN
- [LF] Release LF 1.12. This version reduce the size of transaction
- [Compiler]: Change the default LF output from 1.8 to 1.11.
CHANGELOG_END
Not perfect but probably much cleaner than what we had before. Some
of the orders can definitely be debated and I don’t have strong
feelings beyond the first 5 so if someone feels strongly, I’m open to
changing things.
New output:
Usage: damlc repl [DAR] [-i|--import PACKAGE]
[--ledger-host ARG --ledger-port ARG]
[--access-token-file TOKEN_PATH] [--application-id ARG]
[--tls] [--cacrt ARG] [--pem ARG --crt ARG]
[--max-inbound-message-size ARG]
[(-w|--wall-clock-time) | (-s|--static-time)]
[--project-root ARG] [--project-check]
[--include INCLUDE-PATH] [--package-db LOC-OF-PACKAGE-DB]
[--shake-profiling PROFILING-REPORT] [--jobs THREADS]
[--debug] [--ghc-option OPTION]
Launch the Daml REPL.
Available options:
-h,--help Show this help text
DAR DAR to load in the repl
-i,--import PACKAGE Import modules of these packages into the REPL
--ledger-host ARG Host of the ledger API
--ledger-port ARG Port of the ledger API
--access-token-file TOKEN_PATH
Path to the token-file for ledger authorization
--application-id ARG Application ID used for command submissions
--tls Enable TLS for the connection to the ledger. This is
implied if --cacrt, --pem or --crt are passed
--cacrt ARG The crt file to be used as the trusted root CA.
--pem ARG The pem file to be used as the private key in mutual
authentication.
--crt ARG The crt file to be used as the cert chain in mutual
authentication.
--max-inbound-message-size ARG
Optional max inbound message size in bytes.
-w,--wall-clock-time Use wall clock time (UTC). (this is the default)
-s,--static-time Use static time.
--project-root ARG Path to the root of a project containing daml.yaml.
You should prefer the DAML_PROJECT environment
variable over this option.See
https://docs.daml.com/tools/assistant.html#running-commands-outside-of-the-project-directory
for more details.
--project-check Check if running in Daml project.
--include INCLUDE-PATH Path to an additional source directory to be included
--package-db LOC-OF-PACKAGE-DB
use package database in the given location
--shake-profiling PROFILING-REPORT
Directory for Shake profiling reports
--jobs THREADS The number of threads to run in parallel. When -j is
not passed, 1 thread is used. If -j is passed, the
number of threads defaults to the number of
processors. Use --jobs=N to explicitely set the
number of threads to N. Note that the output is not
deterministic for > 1 job.
--debug Enable debug output
--ghc-option OPTION Options to pass to the underlying GHC
changelog_begin
changelog_end
* Ledger API test tool: test against legacy and preview version.
+ use dictionary instead of alias to map version keywords to LF version
CHANGELOG_BEGIN
CHANGELOG_END
improve previous generalization from #8695
- use lf version instead keyword (like 'stable', 'latest', 'dev') to
tag actual target. This will allow two keywords to map to the same
versions without doing twice the compilation/test work.
- use alias to map keywords tag target to versioned tag target.
- move package manage dar to test_commong.
CHANGELOG_BEGIN
CHANGELOG_END
* Draw the rest of the Scala 2.13 owl
Not quite but pretty close and this switches us over from inclusions
to exclusions which makes it much easier to track.
Ledger API test tool should be fixed by #8821. Non-repudiation needs a
tiny bit of work since unwrapArray doesn’t work the same on 2.13 but
shouldn’t be hard to fix.
changelog_begin
changelog_end
* Fix ScriptService tests
Those tests were all dumb. They asserted on a fixed order while the
function to sort the things was broken so we ended up with the random
Map order which is unsurprisingly not the same.
This is easily fixed by fixing the sort function.
There is also a second issue with query not sorting.
changelog_begin
changelog_end
* Turns out if you fix one test the next one breaks
And clearly nobody ever tested this or give this a second thought.
changelog_begin
changelog_end
* damlc: fix: catch UserError instead IOException
When the package-db metadata can not be parsed, an exception is thrown
and needs to be catched. Previously we were catching IOException, but
in this case it's actually a UserError that is thrown.
CHANGELOG_BEGIN
CHANGELOG_END
* damlc test: show full coverage report
We add a flag `show-coverage` to `damlc-test` to show templates that
are never created and choices that are never executed during the tests.
CHANGELOG_BEGIN
[damlc test] A new flag `show-coverage` shows full test coverage
reports.
CHANGELOG_END
changelog_begin
- [DLint] You can now disable dlint hints for a specific functions in
the form `{- DLINT ignore functionName "hintName" -}`, e.g.,
```
{- DLINT ignore noHint "Use concatMap" -}
noHint f xs = concat (map f xs)
```
Note: The undocumented {- HLINT -} pragmas are no longer supported.
changelog_end
* damlc: show test coverage
We add output to show percentage of created templates and executed
choices for `damlc test`.
This fixes#6370.
CHANGELOG_BEGIN
[damlc] Feature: Test coverage is reported for `damlc test`.
CHANGELOG_END
* added a test
* Update compiler/damlc/lib/DA/Cli/Damlc/Test.hs
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* suggestions
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
This uses a "DamlException" tag to annotate which types should
be exported as exceptions. This tag will be added during the
desugaring of exceptions.
The code that scrapes for the HasMessage instance is based on the
corresponding template instance scraping code, but simplified since
we only have to pick up one instance. If we decide to pack more
information into the DefException structure in the future, we can
easily extend this.
This PR also adds a small test to make sure that a user-defined
exception is exported as such.
changelog_begin
changelog_end