~jojo/Carth

ref: ae1d242d7d48292779dcbd953e5864bb4211e1ca Carth/src/Subst.hs -rw-r--r-- 2.0 KiB
Update stackage release & use default-extensions in cabal file

Also, fix some minor breakages caused by ghc update, fix the
literate.org example, fix some new warnings, and get rid of the need
for a bunch of Data implementations by using basic parsing functions
in SystemSpec.hs.
Infer: Minor refactor
Infer: Separate constraint solver from inference logic

Sdiehl suggested it in a tutorial. Makes sense. Performance mostly
unchanged. Need to make solving faster / do less work.
Greatly improve performance by "shrinking" Infer.St.substs

Substs were remembered for longer than they had to be, which increased
the size of the Map, which significantly impacted a bunch of
operations like composeSubsts.
Make some strict Map:s lazy, and some lazy State:s strict

No great reason. Just seemed more reasonable. No obvious performance impact.
Make deref and store builtin virtual functions as well
Make transmute a builtin virtual instead of a whole AST variant
Change formatting: 90 cols, IndentPolicyFree, etc. Add brittany.yaml

Most people have pretty wide and high res screens at this point. I
can't fit two windows with 100 line length next to eachother with my
font size, but 90 works and most people have smaller font size than me
I think.

Also, change brittanys indentation policy to Free. This almost always
looks better. I just had to disable formatting of imports -- I don't
want to align those, but IndentationPolicyFree insists.

Finally, actually add a project-local brittany config file, so that
anyone (or me in the future / on another computer) can use the same
formatting rules.
Refactor global & let definitions

Instead of jumbling together function and var defs and just checking
which is which at the end in Codegen, treat them very separately and
remember the grouping for recursive defs.

For now, just moves around complexity really. I don't remember how
exactly, but I thought this would be necessary for the next feature,
which is allowing patterns in left hand side of var defs.
Replace `box` special form with `sizeof`

The special forms `sizeof` + `store` can be used together with a call
to the function `GC_malloc` to implement `box` as a standard library
function.
Add `store` special form to write to `Box` pointer
Add `transmute` special form

Use to change the type of an expression without modifying the bits in
any way -- just interpret them as if they represented the new type.

Example:
    (: (transmute (: 4623716258932001341 Int)) F64)
results in
    (: 13.37 F64)
Preserve topolog. order from Infer to Codegen. Important in genLet

Unlike for global definitions, the bindings of a `let` may be
non-function variables. In the generated code, these variabled must be
defined in topological order, as they'll just be reading undefined
stuff otherwise.
Add rudimentary DWARF debugging

Can now view stacktrace with line numbers in GDB. Can step
line-by-line and see position in source with `gdb -tui` (although it's
somewhat crippled by not being statement-based like C etc).
Improve module names. Ast -> Parsed, AnnotAst -> Inferred, and more
Refactor desugaring, remove AnnotAst.{Fun,Match}
Allow pattern matching on uninhabited types, which returns Absurd

The following is now legal:

```
(type Bottom)

(define: bottom-elimination
    (forall (a) (Fun Bottom a))
  (fun-match))
```
Move decision tree compilation of pattern matches to separate pass

This is better because the types of the AST must be fully inferred
before doing this, so unless it happens in a separate pass after
inference and substitution, we have to do "inline" substitution, which
is hacky.
Fix subst not applied to accesses of varbindings of DLeaf
Remove remnants of AnnotAst.Fun
Next