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

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.


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.


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