checkValDef
:: LHsExpr RdrName
-> Maybe (LHsType RdrName)
- -> GRHSs RdrName
+ -> Located (GRHSs RdrName)
-> P (HsBind RdrName)
-checkValDef lhs opt_sig grhss
+checkValDef lhs opt_sig (L rhs_span grhss)
| Just (f,inf,es) <- isFunLhs lhs []
= if isQual (unLoc f)
then parseError (getLoc f) ("Qualified name in function definition: " ++
showRdrName (unLoc f))
else do ps <- checkPatterns es
- return (FunBind f inf [L (getLoc f) (Match ps opt_sig grhss)])
- -- TODO: span is wrong
+ let match_span = combineSrcSpans (getLoc lhs) rhs_span
+ return (FunBind f inf [L match_span (Match ps opt_sig grhss)])
+ -- the span of the match covers the entire equation. That isn't
+ -- quite right, but it'll do for now.
| otherwise = do
lhs <- checkPattern lhs
return (PatBind lhs grhss)
+
checkValSig
:: LHsExpr RdrName