Had to implement both functions as arguments and type
place holders (variables) for type constructors.
Had to implement functions as a type as well.
Still have to figure out how to pass functions around.
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.
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.
They look a lot like placeholders, but they exist before
the typing system takes place. And there's a (much smaller)
context to deal with.
For now, removes Placeholders in user function definitions
as they were not implemented.
Adds signature to function to try to get them closer to
type class methods. Already seeing some benefit in the
constraint generator.
Stricter zipping for safety.
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.
"An arithmetic shift is usually equivalent to
multiplying the number by a positive or a negative
integral power of the radix." -- Federal Standard 1037C
"This is the same as multiplying x by 2**y."
"A right shift by n bits is defined as floor division
by pow(2,n). A left shift by n bits is defined as
multiplication with pow(2,n)."
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.