Currently disabled in the parser (see comment inside the block parser), but had to switch off namespace parsing which caused IOSource to no longer work. Currently working through errors there, might just disable IOSource temporarily.
- The ability for this is a built in reference, rather than a declared
definition, so it won't be possible to handle it without some
additional work. The plan is for it not to be possible to handle it,
though.
- Functions using the ability are directly implemented, rather than
going through indirections.
- We need to rebuild the right patterns, and effect declarations
don't actually have the 'pure' case in them (which is uniform
across all effects), so they need slightly different handling.
- Also duplicate a bit more 'builtin' logic to avoid threading
around Either values where only one branch makes sense in any
situation
- It doesn't work very well with the data declaration information
that is tracked by unison
- Also include a previously uncommitted change from data declarations,
which now gives the number of fields that a constructor has (this is
the only information the pattern compiler now relies on; previously
it was assuming the Reference for the type of each field could be
determined from the DataDecl).
- Created a function for extracting references from LabeledDependency
with an indication of whether it's a term or type reference
- Use a custom runtime exception type in the new runtime instead of
erroring
- Create a new entry point to the runtime that applies a combinator
* This function returns a closure result for watch expression use
- Use the pretty error type for decompile errors
- Names and backreferences for bultins
- Current runtime interface expects no actual referenced terms (just
one large letrec). Some steps are in place for changing this, though.
After fixing this, some serialization round trip tests started failing. This ended up being due to the Eq instance for ABT being busted due to its use of rename, which has a subtle variable capture bug that @dolio spotted a while ago https://github.com/unisonweb/unison/issues/1277#1277 needs a proper fix but in the meantime, I've tweaked the Eq instance to be a bit more efficient and also avoid the #1277 bug in this particular case.
- Codebase functions are now parameterized by Reference.Id or Referent.Id
(a Referent that doesn't refer to a built-in) where appropriate, to
enforce at the type level that Codebases can't contain builtins, and
to eliminate jank that was enforcing or assuming this at runtime.
ditto CodeLookup
ditto `UnisonFile` and `TypecheckedUnisonFile`; with some backwards-
compatible functions and pattern synonyms to support the old types,
and some new functions for the new types.
- Codebase.getRootBranch and .getBranchForHash return a sum type instead
of a magic value (`Branch.empty`) on error. `BranchLoadMode` goes away.
`getRootBranch`'s result distinguishes between "I don't know what the
head is supposed to be" vs "I do know what it is supposed to be but
couldn't find it".
- Not strictly related to Referent.Id (oops) but I moved the actual
builtin Decls from `unison-core/Unison.DataDeclaration` to
`unison-parser-typechecker/Unison.Builtin.Decls`.
I left these qualified as `DD` to minimize diffs, although it may
make it harder to know which module a `DD.` definition is coming from.
- Revamped LinkI and UnlinkI - the md value is a HashQualified, so you can unlink by hash only now
- Support unnamed metadata in the diff display
- Remove HQ'.unsafeFromHQ, which was used in one place and was causing a crash
- Better output messages for various link/unlink failures
- ANF handle construct takes direct branching, and corresponds to
surface syntax matching on `Request`. This is the location where
we know which abilities are in play and can install handlers
without complicated information passing.
- The ANF handle is distinct from other case analysis because the
scrutinee need not already be evaluated. One could conceive of
this as being call-by-name case analysis rather than call-by-value,
although that is not how it will be implemented.
- This means that a function that does Request matching essentially
needs to have a call-by-name argument, and the surface-level handle
construct is a form of call-by-name application. Therefore, it
compiles into a by-name correspondent to let.
- However, this also probably means that Request and handle are
inessential in the surface syntax. `Request {e} a` is essentially
the same as `'{e} a`, handle quotes its body, and ability matching
forces the suspended computation. If the type checker were modified
such that matching could provide abilities to its scrutinee, this
scheme would work with quote and !.
Exploded Codebase.referencesByPrefix into three functions:
- referencesByPrefix :: Text -> m (Set Reference.Id)
+ termReferencesByPrefix :: ShortHash -> m (Set Reference.Id)
+ typeReferencesByPrefix :: ShortHash -> m (Set Reference.Id)
+ termReferentsByPrefix :: ShortHash -> m (Set (Referent' Reference.Id))
for top-level terms, top-level types, and for Ref/Con mix.
They only return "derived" references, the thinking is that builtins will
come from a higher level api.
Exploded Command.ReferencesByShortHash into three functions
- ReferencesByShortHash :: ShortHash -> Command m i v (Set Reference.Id)
+ TypeReferencesByShortHash :: ShortHash -> Command m i v (Set Reference)
+ TermReferencesByShortHash :: ShortHash -> Command m i v (Set Reference)
+ TermReferentsByShortHash :: ShortHash -> Command m i v (Set Referent)
I actually don't remember why it was ok that it was Reference.Id before
but isn't now. Maybe we hadn't wanted to auto-complete Builtin names?
I don't remember.
controversial?
* Added a type arg `r` to `Referent`; type alias and patterns for compat.
* Deleted BranchUtil.getTermByShortHash because I'm guessing we no longer
want to limit such searches to the branch? Uncertain.
* Reference.fromShortHash rejects inputs with ctorIds in them; seemed
better than ignoring them, but I could imagine there being a case for
each.
- Moved variable occurrences out of the ABT structure. Since the
variable type gets passed directly to the shape functor, it's not
necessary for the ABT to handle variable occurences, and the
factorization was interfering with the structure of the algorithm.
- Made the ABT and Term types directly recursive. There doesn't seem to
be a reason for them not to be
- Factored the ANF shape functor into two types to ensure that there is
no let binding with a let directly inside it. Instead lets must be
linearized. This is arguably more normalized, and should correspond
closer to CPS.
- Uses a new, explicitly normalized representation of terms.
- Also assumes that the terms have already been compiled to
supercombinators, as there is no representation of local
lambdas or letrec.