Get a bit of sharing
[ghc-hetmet.git] / compiler / parser / Parser.y.pp
index 8d9f9ef..515c474 100644 (file)
@@ -1221,8 +1221,9 @@ decl      :: { Located (OrdList (LHsDecl RdrName)) }
                                                return (LL $ unitOL $ LL $ ValD ( 
                                                        PatBind (LL $ BangPat pat) (unLoc $3)
                                                                placeHolderType placeHolderNames)) } }
-       | infixexp opt_sig rhs          {% do { r <- checkValDef $1 $2 $3;
-                                               return (LL $! (unitOL $! (LL $ ValD r))) } }
+        | infixexp opt_sig rhs          {% do { r <- checkValDef $1 $2 $3;
+                                                let { l = comb2 $1 $> };
+                                                return $! (sL l (unitOL $! (sL l $ ValD r))) } }
         | docdecl                       { LL $ unitOL $1 }
 
 rhs    :: { Located (GRHSs RdrName) }
@@ -1977,7 +1978,7 @@ comb4 a b c d = combineSrcSpans (getLoc a) $ combineSrcSpans (getLoc b) $
 -- strict constructor version:
 {-# INLINE sL #-}
 sL :: SrcSpan -> a -> Located a
-sL span a = span `seq` L span a
+sL span a = span `seq` a `seq` L span a
 
 -- Make a source location for the file.  We're a bit lazy here and just
 -- make a point SrcSpan at line 1, column 0.  Strictly speaking we should