This went pretty smoothly, I just followed the compiler errors after
substituting Integer for Int in the type definition.
The only tricky thing is that the div and mod functions for Integer
return Maybe Integer rather than just Integer, so I need to wrap those
or something? (For now I just put in add to get it to compile.)
Oh, and "not equal" is not correct? The compiler didn't complain.
Like a total newbie I put the call to the interpreter in the view
function instead of the update function! I thought it was weird having
to specify the HTML twice, but I figured I was just doing it wrong. I
was, but not in the way I suspected.
In any event, I like how this make it clear that errors can't affect the
dictionary.
This is mostly for fun, but I bet it comes in handy, eh?
At the very least, it's a nice catalog of the possible errors that the
basic Joy system might encounter.
Just sqr for now, but it shows that it works.
I would like to return Results from add_def but it makes using foldl
slightly tricky, not a lot, just slightly, and my brainpower is low at
the mo'.
I don't like passing the stack through isnt_int but that let's you chain
with andThen.
There's probably a clever or idiomatic way to not do that and couple the
stack to the result without passing it through the type checker function
but I don't know what it is right now, and this works.