Open mgsloan opened 11 years ago
I lean towards the breaking change. We're up for a rather big major release anyway next time, so it feels like a time to Do It Right (tm).
An explicit representation for an empty SrcSpan
looks like a good thing to me.
I have serious doubts regarding SrcLoc
, though. Is there such a thing as an empty location?
grep tells that noLoc
isn't used anywhere HSE, so I'm not sure about its usefulness.
@mgsloan: What is the status for this ticket, is there code for this somewhere that should be merged? I agree with all of Roman's points.
I haven't done any work on this. Feel free to start work on it! I might get around to it sometime, though, if this becomes important for my usage of HSE. I also agree with Roman's points.
I will not fix this before the next release. It doesn't seem to be a blocker for your needs either.
There're a couple things in the way of having a proper
Monoid
forSrcSpan
andSrcSpanInfo
:noLoc = SrcLoc "" (-1) (-1)
sets a precedent for this representing an empty location / interval.mergeSrcSpan
had a special case for empty, then it would be a proper definition formappend
.combSpanInfo
/(<++>)
throw awaysrcInfoPoints
, which isn't so nice. You could still have a propermappend
, though, if they preservedsrcInfoPoints
when combined withmempty
.Maybe it would be better to have an explicit representation for empty
SrcLoc
andSrcSpan
? Main issue is that it would be quite a breaking change.