Skip to content

Monoid for SrcSpan and SrcSpanInfo? #48

Open
@mgsloan

Description

@mgsloan

There're a couple things in the way of having a proper Monoid for SrcSpan and SrcSpanInfo:

  • A good representation for empty. The existence of noLoc = SrcLoc "" (-1) (-1) sets a precedent for this representing an empty location / interval.
  • If mergeSrcSpan had a special case for empty, then it would be a proper definition for mappend. combSpanInfo / (<++>) throw away srcInfoPoints, which isn't so nice. You could still have a proper mappend, though, if they preserved srcInfoPoints when combined with mempty.

Maybe it would be better to have an explicit representation for empty SrcLoc and SrcSpan? Main issue is that it would be quite a breaking change.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions