git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #1925 from bagl/fix-#1916

Fix #1916

commit5dad0d69601a58b3f2b8d8dc5825d4025973ba1e authorPhil Freeman <paf31@cantab.net> dateSun 13 Mar 2016, 14:29 (11 years ago) parentc89b9fd40aaca7
4 files changed+16−5
CONTRIBUTORS.md+1 examples/failing/OperatorSections.purs+8 src/Language/PureScript/AST/Declarations.hs+1−2 src/Language/PureScript/Sugar/Operators.hs+6−3
CONTRIBUTORS.md+1
@@ -9,6 +9,7 @@ This file lists the contributors to the PureScript compiler project, and the ter
99- [@anthok88](https://github.com/anthoq88) - My existing contributions and all future contributions until further notice are Copyright anthoq88, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license
1010- [@ardumont](https://github.com/ardumont) (Antoine R. Dumont) My existing contributions and all future contributions until further notice are Copyright Antoine R. Dumont, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
1111- [@aspidites](https://github.com/aspidites) (Edwin Marshall) My existing contributions and all future contributions until further notice are Copyright Edwin Marshall, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
12+- [@bagl](https://github.com/bagl) (Petr Vapenka) My existing contributions and all future contributions until further notice are Copyright Petr Vapenka, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
1213- [@balajirrao](https://github.com/balajirrao) (Balaji Rao) - My existing contributions and all future contributions until further notice are Copyright Balaji Rao, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
1314- [@bergmark](https://github.com/bergmark) (Adam Bergmark) - My existing contributions and all future contributions until further notice are Copyright Adam Bergmark, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
1415- [@Bogdanp](https://github.com/Bogdanp) (Bogdan Paul Popa) My existing contributions and all future contributions until further notice are Copyright Bogdan Paul Popa, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
examples/failing/OperatorSections.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith CannotApplyFunction
2+module Main where
3+
4+import Prelude
5+
6+main = do
7+ (true `not` _)
8+
src/Language/PureScript/AST/Declarations.hs+1−2
@@ -331,8 +331,7 @@ data Expr
331331 --
332332 | Parens Expr
333333 -- |
334− -- Operator section. This will be removed during desugaring and replaced with a partially applied
335− -- operator or lambda to flip the arguments.
334+ -- Operator section. This will be removed during desugaring and replaced with lambda.
336335 --
337336 | OperatorSection Expr (Either Expr Expr)
338337 -- |
src/Language/PureScript/Sugar/Operators.hs+6−3
@@ -189,8 +189,11 @@ desugarOperatorSections (Module ss coms mn ds exts) =
189189 (goDecl, _, _) = everywhereOnValuesM return goExpr return
190190
191191 goExpr :: Expr -> m Expr
192− goExpr (OperatorSection op (Left val)) = return $ App op val
193− goExpr (OperatorSection op (Right val)) = do
192+ goExpr (OperatorSection op eVal) = do
194193 arg <- freshIdent'
195− return $ Abs (Left arg) $ App (App op (Var (Qualified Nothing arg))) val
194+ let var = Var (Qualified Nothing arg)
195+ f2 a b = Abs (Left arg) $ App (App op a) b
196+ return $ case eVal of
197+ Left val -> f2 val var
198+ Right val -> f2 var val
196199 goExpr other = return other