The title is a double joke. It’s a pun with “lazy” and [data] types, but it’s also funny cause it’s true! This post was supposed to be about lazy evaluations in my pattern matching code, but I don’t feel like writing much about it.
And actually, there’s not a whole lot to write.
- the “type subtraction” has to be lazy, because one of the operands is a potentially-infinitely-recursive type. Trivial example:
IntSequence(head: Int, tail: IntSequence).
- for the sake of keeping expansions down, it’s better to defer forcing the evaluations as long as possible — but that was covered in my last post
- step three, profit I guess?
Anyway, point is there’s not much to say, so I’m just going to leave it at that.
My next step is t actually plug all this stuff into my compiler. I did a quick look the other day to remind myself what the compiler code actually looks like in that area, and I think it’s actually going to be easier than I feared. There’s already a decent abstraction of “the pattern that’s being matched,” with logic that takes that pattern and assigns variables to it and such, so with luck it’ll be pretty easy to swap in the new abstractions I’ve been using.