* Optimize mangleIdentifier
I am slightly embarassed by importing Data.Text.Internal and
Data.Text.Array. However, this does make a very measurable difference:
On my testcase it brought down the time encoding modules from 22s to
17s, so it’s a 5s improvement.
I did quickcheck this against the old implementation, so I’m confident
it behaves correctly. I also ran some criterion benchmarks to see the
difference and on its own it’s even more of a difference.
https://gist.github.com/cocreature/822114257227473ecff1638a88f07788
* GHC is stupid :(
* language: put hash in package directories
We put the package id of the main dalf of a package into the directory
names, where we store the files of that package in the package database.
This way we make sure that two equally named packages don't overwrite
their dependencies and files.
This is in preparation for #2326 as well as for splitting hie-core
into a separate repo. Given that, it explicitely avoids using our
dev-env.
We do need to install a few system packages, so for now this uses the
hosted builder so we can do this. Another option would be to just add
those to our builders. I don’t really have a preference either
way. The builds are < 5 minutes so I don’t expect issues from using
the hosted builders.
* Update ghc-libs to use new template desugaring
* Replace old template typeclasses with generic-friendly ones
* New template desugaring doc
* Fix tests
* Fix damldoc tests regarding Archive choice
* Update visualisation code to not traverse master dictionary
* Additional class method stubs to template instance declaration for upgrades
* Increase stack limit for bond trading compilation test
* Update hlint version
* Supporting producing sdist tarballs for the HS ledger bindings
The README.md has an explanation for how you can use this.
This should hopefully allow others to experiment with the bindings.
My benchmark is sadly extremely noisy which makes it hard to figure
out how much of an improvement this is but it does seem to at least be
a minor improvement.
* daml-lf: prepare archive proto for Numeric
* replace DECIMAL by NUMERIC in messages and fields
* add nat kind and nat type
* add builtins CAST_NUMERIC and SHIFT_NUMERIC
* daml-lf: remove new builtins from archive proto
* daml-lf: some more doc about numeric
* daml-lf: fix spec
Speed up file modification checks
Summary: `getModificationTime` from the `directory` package is really
slow. The `unix` package is faster but still slow. This PR brings the
time spent checking file modifications (which is required on every
change) from ~0.5s to ~0.15s.
* Add anchor self-links in Rst docs
* Refactor a little with unwords
* Fix silly type error
* Refactoring and better type rendering
* Rename rst renderer functions.
* Update tests
* lint
* language: a shake rule to get interface/hie files
This adds a shake rule to get module interfaces and hie files. This
gives more control on when to build them and also an opportunity to
change the package name after typechecking. This is used in the next
PR to add package hashes to the package name in the interface files.
* generate hie files only on demand
Currently, we call `force` on every result of a rule. This was
problematic for the rules that produce LF packages:
Even if only the top-level module changes, the package for that module
contains all its dependencies. This means that we end up RNFing every
module that the current module depends on. On a project with ~900
dependencies this added up to over 1s for both GeneratePackageDeps and
GeneratePackage which corresponded to more than half of the overall
runtime.
This PR introduces a newtype for packages that does not evaluate the
modules in a package to NF. With this PR both rules are below 0.02s so
his is quite a significant improvement. We do not introduce any
potential space leaks here since the modules are produced by rules
that already force them to NF.
* Improve debugging output
Displaying the exception makes it easier to figure out what is going
wrong.
I’ve also added a HasCallStack constraint to `locateRunfiles` since it
looked like that was failing. Turned out to be a call to `create` that
didn’t go via `locateRunfiles` but I think it’s useful either way.
Should be more useful with https://github.com/tweag/rules_haskell/pull/1007
* Update compiler/hie-core/src/Development/IDE/Core/Shake.hs
Co-Authored-By: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
* Upgrade ghc-lib
* Patch bazel_tools : hazel-include-paths patch, no-isystem patch.
* Provide "haskell_c2hs" for package name to cabal_haskell_package
* Package name haskell_c2hs => c2hs.
* Switch to less hacky patch for include dirs
* damlc visual: detect ledger actions at surface level
Instead of detecting the DAML-LF primitives for `create` and `exercise`,
we detect the corresponding surface DAML functions and ignore the
dictionaries for the `Template` and `Choice` classes. This will be
necessary for swiching to the new template desugaring.
This is the quickest way to get this working but might turn into a brittle
maintenance nightmare one day. If that happens, we should switch to doing
proper symbolic evaluation, which will we be a bit more code though.
* Fix explanation
Co-Authored-By: Rohan Jacob-Rao <rohanjr@gmail.com>
* Add explanation for special casing archive
* Support depending on potentially stale values in damlc
For now, this is opt-in and only enabled for the scenario service.
Locations should be properly mapped so if lines are inserted above a
scenario, the scenario link will move down.
* Erase key lookup methods implemented using magic as well
We're already erasing `create`, `fetch` and `exercise` methods. I've
missed the ones related to key lookups when I did that. This PR fixes
my mishap.
* Fix typo in docs.
Co-Authored-By: Rohan Jacob-Rao <rohanjr@gmail.com>
We want to discourage users to pin down a target DAML-LF version but rather
want them to always use the default version, which is typically the newest
version. Thus, we turn this into an expert flag that is mostly used for
testing by us.
The module was only used to format decimal numbers. The only impact the
formatting could have had was to add/strip trailing zeros from the
presentation of the number. However, manual testing shows this did not
happen. Thus, the whole module is now useless.
`template X` generates type class `XInstance` which contains a few methods
which are implemented in terms of `magic` and then rewritten during the
conversion to DAML-LF. The default implementations of these methods need to
be erase during the conversion to DAML-LF since `magic` is erased as well.
* language: added a merge command to damlc
This adds a 'merge-dars' command to damlc to merge two dars into one.
This is useful when you created an upgrade dar and want to ship it as
part of the latest version of a package.
* added a comment on nubSort for clarity
* hie-core/test: Dedicated test suite for hie-core
* Apply hlint suggestion
Use System.Environment.Blank's setEnv which has a non-overwrite mode
that implements precisely what we were doing with more code before.
* buildifier fixes
* hie-core-exe works on Windows now - ghc-paths was fixed
This is a refactoring-only PR in preparation for supporting stale
values in damlc so we can still produce some results if a rule fails
to produce a value but has a stale value stored.
While experimenting with the pure Haskell gRPC implementation I
noticed that there is a fair amount of duplication in PrettyScenario
so this PR cleans up some of that.
The gRPC library does not handle asynchronous exceptions properly and
ends up leaking things which causes various issues (segfaults,
assertion failures, weird backup poller timer messages, …) when
shutting down gRPC.
The switch to grpcShutdownBlocking is somewhat unrelated (the issues
happen with and without that and the fix seems to work both times) but
that function seems to be the right way to shut down gRPC in newer
versions and is what all the official language bindings switched to,
so I also made the switch.
I haven’t yet looked into the issues in the HS ledger bindings so not
sure if this helps with those as well.
* language: upgrades independent of stdlib
This fixes several issues in the code generation from dalfs. As a result
we can now generate upgrades independent of the stdlib source.