Previously, it was hardcoded at 'compile' time (in as much
Python has that). This would make it more difficult to add
stuff to it. Also, in a lot of places we made assumptions
about prelude instead of checking properly.
This also removes the InternalPassAsPointer experiment.
This also fixes that u8 values were stores as 32 bits
in structs and tuples (but not dynamic arrays since that
is special cased as bytes).
Also, fixes allocation issue wi th dynamic arrays, it
would allocate quadratic amount of memory.
bytes continues to be the preferred name for u8[...].
Also, putting bytes values into the VM and taking them
out still uses Python bytes values.
This also lets used use the len function on them, for
whatever that's worth.
Foldable take a TypeConstructor. The first argument must be a
NatNum.
The FunctionSignatureRouter wasn't completely on point, instead
this commit adds an TypeClassArgsRouter lookup router. This
makes sense since the only available arguments we have to find
a router is the list of type class arguments.
Before this commit, finding the implementation for a type
class method was done with a simple lookup table.
This commit adds a router based on function signature.
This also paves the way for adding type constructor
arguments in function signatures.
And it removes quite a few references to the prelude out
of the compiler.
Also adds a bunch of helper methods to render signatures
as strings.
By annotating types with the constructor application
that was used to create them.
Later on we can use the router to replace compiler's
INSTANCES or for user defined types.
Before, a type class was a property of a type.
But that doesn't make any sense for multi parameter
type classes.
Had to make a hacky way for type classes with
type constructors.
Also adds the remaining unexposed WebAssembly opcodes as
comments (eqz, clz, ctz, popcnt, copysign).
This also means that BinaryOp.operator is now always
a type class method.
This is because Haskell defines negate, abs and signum
for Num, but they don't work with our unsigned number
types. (abs would be a noop.) Haskell has Word32 / Word64,
but there negate doesn't make much sense to me.
Implemented neg and abs.
Implemented a type class inheritance check.
Removed Integral from u8 and i8 since it wasn't implemented.