Open dmwit opened 7 years ago
Oops. Good catch.
This issue is a shame, since codomain
isn't denotative (cannot be explained via the denotation). Brings any use of codomain
into question. Are you using it?
I am using it, but only on maps whose source type is infinite. codomain
should be denotative on such maps.
A potential fix for this would be to change the implementation from a thin layer over Data.Map to a tree that divides the domain exhaustively into non-overlapping intervals that are each assigned a value. It's a pretty involved fix, but it does have other advantages (like, you could potentially represent more functions than just the finitely supported ones)
I had completely forgotten about this bug. I guess I didn't give this operation much thought at the time. I'm somewhat inclined to excise this operation altogether, since the point of total-map was to have and adhere to a precise and simple denotation. We can discuss principled alternatives.
I just released a new version with codomain
renamed to "range
" and range
deprecated as non-denotative.
This issue doesn't actually affect me, but I thought of it in the shower this morning and thought it would be worth recording.
I don't have many good ideas about fixes, either -- perhaps the only sensible thing to do is to document this wart.