Allow this syntax on the lhs:
(e1 `op` e2) e3 = ...
(bug reported by Ralf Hinze).
Add a test for it.
-- A variable binding is parsed as an RdrNamePatBind.
-isFunLhs (OpApp l (HsVar op) fix r) [] | not (isRdrDataCon op)
- = Just (op, True, [l,r])
+isFunLhs (OpApp l (HsVar op) fix r) es | not (isRdrDataCon op)
+ = Just (op, True, (l:r:es))
isFunLhs (HsVar f) es@(_:_) | not (isRdrDataCon f)
= Just (f,False,es)
isFunLhs (HsApp f e) es = isFunLhs f (e:es)
checkPrecMatch False fn match
= returnRn ()
-checkPrecMatch True op (Match _ [p1,p2] _ _)
+checkPrecMatch True op (Match _ (p1:p2:_) _ _)
+ -- True indicates an infix lhs
= getModeRn `thenRn` \ mode ->
-- See comments with rnExpr (OpApp ...)
case mode of
--- /dev/null
+module ShouldCompile where
+
+(<>) :: (a -> Maybe b) -> (b -> Maybe c) -> (a -> Maybe c)
+(m1 <> m2) a1 = case m1 a1 of
+ Nothing -> Nothing
+ Just a2 -> m2 a2