[TTG - SrcLocs] The Initial Setting and Implementing for HsPat
AbandonedPublic

Authored by shayan-najd on Jul 12 2018, 11:52 PM.
shayan-najd created this revision.Jul 12 2018, 11:52 PM
  • [TTG - SrcLocs] minor
alanz added a comment.Jul 15 2018, 3:05 PM

Some initial comments.

compiler/basicTypes/SrcLoc.hs
546

I wonder if it would not be better to call it getLoc instead of getSrcSpan. Then the NamedThing function could keep its name. And it opens the door to different ways of storing the location in future, if needed.

This would also do away with the need for setRealSrcSpan.

617

Would it not be more natural to define these as

composeSrcSpan   :: SrcSpan,(SrcSpanLess a ) -> a
decomposeSrcSpan :: a -> (SrcSpan,SrcSpanLess a )

This ties up closer to the existing usage of Located. and would make things like dL simpler, being just

dL :: HasSrcSpan a => a -> (SrcSpan , SrcSpanLess a)
dL e =  decomposeSrcSpan e
-- instead of
dL :: HasSrcSpan a => a -> (SrcSpan , SrcSpanLess a)
dL e =  let (x , y) = decomposeSrcSpan e in (y , x)
shayan-najd abandoned this revision.Aug 2 2018, 4:38 AM