From 7c38ddf4a20c84e77741fd259cdb7954b8cde02e Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 12 Jun 2018 14:16:25 -0700 Subject: [PATCH] Assign infix operator applications --- src/Language/Haskell/Assignment.hs | 4 ++++ src/Language/Haskell/Syntax.hs | 1 + 2 files changed, 5 insertions(+) diff --git a/src/Language/Haskell/Assignment.hs b/src/Language/Haskell/Assignment.hs index 6fc9ce827..39c49b405 100644 --- a/src/Language/Haskell/Assignment.hs +++ b/src/Language/Haskell/Assignment.hs @@ -214,6 +214,7 @@ expressionChoices = [ , generator , importAlias , importDeclaration + , infixOperatorApp , infixOperatorPattern , infixVariableIdentifier , integer @@ -342,6 +343,9 @@ importDeclaration = makeTerm importSpec :: Assignment.Assignment [] Grammar [Term] importSpec = symbol ImportSpec *> children (manyTerm import') +infixOperatorApp :: Assignment +infixOperatorApp = makeTerm <$> symbol InfixOperatorApplication <*> children (Syntax.InfixOperatorApp <$> expression <*> expression <*> expression) + infixOperatorPattern :: Assignment infixOperatorPattern = makeTerm <$> symbol InfixOperatorPattern <*> children (Syntax.InfixOperatorPattern <$> expression <*> operator <*> expression) diff --git a/src/Language/Haskell/Syntax.hs b/src/Language/Haskell/Syntax.hs index 8e679a7e7..7bb2b3634 100644 --- a/src/Language/Haskell/Syntax.hs +++ b/src/Language/Haskell/Syntax.hs @@ -448,6 +448,7 @@ instance Show1 ImportAlias where liftShowsPrec = genericLiftShowsPrec instance Evaluatable ImportAlias data App a = App { appLeft :: a, appRight :: a } + | InfixOperatorApp { appLeft :: a, infixOperator :: a, appRight :: a } deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable) instance Eq1 App where liftEq = genericLiftEq