~jojo/Carth

ref: 55fb4f948f1f3797078b584dc60b4f7dd68b37ed Carth/src d---------
Check `cast` in Infer instead of Gen

Using the new virtual typeclass `Cast a b`, which as a predicate is
true then `a` can be cast to `b`, which is the case from all primitive
numeric types to eachother, and from one type to itself.
Remove transmute size checking from Gen

since we do that using type class in Infer now!
Fix class constraint inference bug when explicit scheme given

See test/tests/bad/transmute-size-mismatch2.carth. This didn't fail
before. Users type sig was not respected, and (SameSize a b) was
inferred and added to the scheme implicitly.
(mostly) implement checking of same size for transmute in Infer

Preferably, all kinds of checking should happen as early as possible,
so we don't have to remember tons of polluting SrcPos:s in the AST for
later stages. This is a big step in removing positioning from Codegen.

Also, this lays much of the groundwork for supporting typeclasses more
generally!

The implementation is not quite correct/done though. Indeed, it
rejects transmutes for a pair of monotypes not of the same size, but
the inferring and scheme creating is a little broken. See
~test/tests/bad/transmute-size-mismatch2.carth~.
Infer: minor refactoring
Some compilation errors in genAppBuiltinVirtual should be ice
very minor refactoring
Remove unused definitions

No big ones. Mostly small stuff that might be convenient at some point
actually, but I'll just find them or rewrite them then. Shouldn't keep
unused code in the codebase, pretty much regardless of potential. We
use git for a reason.
Remove DWARF debugging metadata in LLVM output & make funcs External

Multiple reasons for removing the debugging symbols. 1) The
implementation was only partial and buggy. Line-by-line stepping
didn't work well, quite jumpy and buggy. 2) I'm not sure the
line-by-line stepping even *could* have worked well, due to the
expression oriented nature of the lang. 3) Having to remember source
positions this long is cumbersome. 4) less code for any reason =
good! 5) Even without the metadata, as long as the functions are
External (is this really required? I think so, but may be possible to
work around) the function names will be visible in gdb, and that's
really all that I need / can use that works well.
Don't generate simply numbered locals in LLVM

I.e., no more UnName 8 => "%8". Instead Name "tmp_8" => "%tmp_8". This
fixes the issue that LLVM expects all simply numbered locals to be
defined in order and without gaps. This means our .dbg.gen.ll won't
compile, which could have been useful.
Fix LLVM function visibility issue

Tried to compile the generated .ll. Clang was complaining when it was
both Private and Hidden. Just setting visibility to Default fixes
it. Don't think this is a problem, but I guess we will learn.
Refactor Def, Inst related stuff & fix debug AST print bug

Felt (Inst, WithPos _) was more appropriate than WithPos (Inst,
_). Also, fixed `ice` in Lower.lowerFun triggered when printing AST in
debug mode.
Move beta reduction from Codegen to Lower
Duplicate AST defs from Monomorphic to Low

Also had to add a bunch of basically no-op translation in Lower.hs
just to fix the types. Atm it's pointless, but it will serve as a base
to work on as the Low AST drifts from the Monomorphic AST.
Simplify Codegen by using classes for the tail-call stuff
rename Optimize{,d} -> Low{er,}
Add class Select

Pass some params implicitly when doing selections
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.
remove no longer applicable TODOs
Next