git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Desugar unqualified BinaryNoParens constructors
commit908a6f8137edd74244b4a9636cd4ca0e1780a848 authorPhil Freeman <paf31@cantab.net> dateTue 18 Mar 2014, 15:21 (13 years ago) parenta15f086
1 file changed+8−2
src/Language/PureScript/Sugar/Names.hs+8−2
src/Language/PureScript/Sugar/Names.hs+8−2
@@ -190,8 +190,14 @@ renameInModule imports exports (Module mn decls exps) =
190190 ValueDeclaration name nameKind [] Nothing <$> everywhereWithContextM' [] (mkS bindFunctionArgs `extS` bindBinders) val
191191 where
192192 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')
194− bindFunctionArgs bound (Var name'@(Qualified (Just _) _)) = (,) bound <$> (Var <$> updateValueName name')
193+ bindFunctionArgs bound (Var name'@(Qualified Nothing ident)) | ident `notElem` bound =
194+ (,) 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)
195201 bindFunctionArgs bound other = return (bound, other)
196202 bindBinders :: [Ident] -> CaseAlternative -> Either String ([Ident], CaseAlternative)
197203 bindBinders bound c@(CaseAlternative bs _ _) = return (binderNames bs ++ bound, c)