git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Desugar unqualified BinaryNoParens constructors
908a6f8Phil Freeman
src/Language/PureScript/Sugar/Names.hs+8−2
@@ -190,8 +190,14 @@ renameInModule imports exports (Module mn decls exps) =
190 ValueDeclaration name nameKind [] Nothing <$> everywhereWithContextM' [] (mkS bindFunctionArgs `extS` bindBinders) val
190 ValueDeclaration name nameKind [] Nothing <$> everywhereWithContextM' [] (mkS bindFunctionArgs `extS` bindBinders) val
191 where
191 where
192 bindFunctionArgs bound (Abs (Left arg) val') = return (arg : bound, Abs (Left arg) val')
192 bindFunctionArgs bound (Abs (Left arg) val') = return (arg : bound, Abs (Left arg) val')
193− bindFunctionArgs bound (Var name'@(Qualified Nothing ident)) | ident `notElem` bound = (,) bound <$> (Var <$> updateValueName name')
193+ bindFunctionArgs bound (Var name'@(Qualified Nothing ident)) | ident `notElem` bound =
194+ (,) bound <$> (Var <$> updateValueName name')
194− bindFunctionArgs bound (Var name'@(Qualified (Just _) _)) = (,) bound <$> (Var <$> updateValueName name')
195+ bindFunctionArgs bound (Var name'@(Qualified (Just _) _)) =
196+ (,) bound <$> (Var <$> updateValueName name')
197+ bindFunctionArgs bound (BinaryNoParens name'@(Qualified Nothing ident) v1 v2) | ident `notElem` bound =
198+ (,) bound <$> (BinaryNoParens <$> updateValueName name' <*> pure v1 <*> pure v2)
199+ bindFunctionArgs bound (BinaryNoParens name'@(Qualified (Just _) _) v1 v2) =
200+ (,) bound <$> (BinaryNoParens <$> updateValueName name' <*> pure v1 <*> pure v2)
195 bindFunctionArgs bound other = return (bound, other)
201 bindFunctionArgs bound other = return (bound, other)
196 bindBinders :: [Ident] -> CaseAlternative -> Either String ([Ident], CaseAlternative)
202 bindBinders :: [Ident] -> CaseAlternative -> Either String ([Ident], CaseAlternative)
197 bindBinders bound c@(CaseAlternative bs _ _) = return (binderNames bs ++ bound, c)
203 bindBinders bound c@(CaseAlternative bs _ _) = return (binderNames bs ++ bound, c)