~jojo/Carth

ref: 55fb4f948f1f3797078b584dc60b4f7dd68b37ed Carth/examples d---------
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.
Less desugaring in Parse (do in Infer instead), more concrete Parsed.

Step towards improving error messages. Among others, the function-related ones can
end up misleading due to bad SrcPos:s given to nodes generated from desugaring.
Add example list-monad to demo macro features & the do macro
Add example `count-lines.carth`. Like `wc -l`
Fix partitionWith reversing lists. Caused def order issue in genInit

genInit must genDefineGlobVar:s in topological order, but an earlier
call to partitionWith had accidentally reversed the topological order,
causing this to break:

    (define (main r) (bar r))
    (define bar bar1)
    (define bar1 foo)
    (define (foo r) [Unit r])
Make main IO Unit, i.e. (Fun RealWorld [Unit RealWorld])
Merge branch 'master' into ZST
New pair syntax. [a b] => [a b . Unit] => (Cons a (Cons b Unit))
Test that examples and benchmarks compile

So now, `stack test` will: test that programs in test/tests/bad/ don't
typecheck, and fail with the expected error variant; test that
programs in examples/ compile; and test that programs in test/bench/
compile.

Next: test that programs in test/tests/good/ run and produce the
expected output.
Minor refactor of sieve.carth
Add global variables

Previously, top-level definitions could only be functions. Now,
non-function variables are initialized with `carth_init` in `main`.

Could be interesting to initialize them at compile time instead, using
some kind of compile-time evaluation mechanism, probably using the JIT.
Add example sieve.carth with the Sieve of Eratosthenes

Not the prettiest, but still a pretty good example of the power of
Carth. Runs for quite long -- 17359 iterations last I tried. That's
pretty good, considering the filters just keep piling on.
Split std into separate files
Impl types Union, Bool using existing data-type mechanics

No more special cases in TPrim, just implement them as normal
data-types instead. They're declared in Check.hs, and we ensure
they're generated in initInsts in Monomorphize.hs. Other than that,
the compiler barely has to know they exist!
Run with MCJIT with `carth run`
Add `unit` pattern literal
Rename start to main by mapping "main" to "_main" in mangleName

I tried having the carth-level entrypoint be called "main" before, but
it didn't work out since I tried having it compile to "main", and then
add a wrapping main that compiled to something like "outer_main", and
then redefine the entrypoint to "outer_main" when calling clang. That
was messy due to startfiles-related issues, but this way of simply
mapping "main" to "_main" via mangleName seems to work really well!
Impl all error-tests of err.carth as proper tests in CheckSpec.hs
Add error for duplicate var defs at top-level and in let
Update error-examples for "newly" added type errors

Some were added a while ago, I've just not paid err.carth enough
attention.
Next