mirror of
https://github.com/github/semantic.git
synced 2024-11-27 12:57:49 +03:00
Assign lambdas
This commit is contained in:
parent
00e299ad25
commit
c53dab76cf
@ -69,6 +69,7 @@ type Syntax = '[
|
||||
, Syntax.KindFunctionType
|
||||
, Syntax.KindListType
|
||||
, Syntax.KindSignature
|
||||
, Syntax.Lambda
|
||||
, Syntax.ListComprehension
|
||||
, Syntax.ListConstructor
|
||||
, Syntax.Module
|
||||
@ -234,6 +235,7 @@ expressionChoices = [
|
||||
, integer
|
||||
, kind
|
||||
, kindSignature
|
||||
, lambda
|
||||
, listConstructor
|
||||
, listComprehension
|
||||
, listExpression
|
||||
@ -391,6 +393,12 @@ kindListType = makeTerm <$> symbol KindListType <*> children (Syntax.KindListTyp
|
||||
kindSignature :: Assignment
|
||||
kindSignature = makeTerm <$> symbol KindSignature <*> children (Syntax.KindSignature <$ token Annotation <*> kind)
|
||||
|
||||
lambda :: Assignment
|
||||
lambda = makeTerm <$> symbol Lambda <*> children (Syntax.Lambda <$> lambdaHead <*> lambdaBody)
|
||||
where
|
||||
lambdaHead = symbol LambdaHead *> children (expressions)
|
||||
lambdaBody = symbol LambdaBody *> children (expressions)
|
||||
|
||||
listComprehension :: Assignment
|
||||
listComprehension = makeTerm <$> symbol ListComprehension <*> children (Syntax.ListComprehension <$> expression <*> manyTerm expression)
|
||||
|
||||
|
@ -542,3 +542,12 @@ instance Ord1 Do where liftCompare = genericLiftCompare
|
||||
instance Show1 Do where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
instance Evaluatable Do
|
||||
|
||||
data Lambda a = Lambda { lambdaHead :: a, lambdaBody :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
|
||||
|
||||
instance Eq1 Lambda where liftEq = genericLiftEq
|
||||
instance Ord1 Lambda where liftCompare = genericLiftCompare
|
||||
instance Show1 Lambda where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
instance Evaluatable Lambda
|
||||
|
@ -70,9 +70,6 @@
|
||||
{ (ConstructorIdentifier)
|
||||
->(ConstructorIdentifier) }
|
||||
(TypeParameters))
|
||||
{+(Constructor
|
||||
{+(ConstructorIdentifier)+}
|
||||
{+(TypeParameters)+})+}
|
||||
(Constructor
|
||||
{ (ConstructorIdentifier)
|
||||
->(ConstructorIdentifier) }
|
||||
@ -83,6 +80,9 @@
|
||||
{+(Constructor
|
||||
{+(ConstructorIdentifier)+}
|
||||
{+(TypeParameters)+})+}
|
||||
{+(Constructor
|
||||
{+(ConstructorIdentifier)+}
|
||||
{+(TypeParameters)+})+}
|
||||
{-(Constructor
|
||||
{-(ConstructorIdentifier)-}
|
||||
{-(TypeParameters)-})-}
|
||||
|
@ -70,6 +70,10 @@
|
||||
{ (ConstructorIdentifier)
|
||||
->(ConstructorIdentifier) }
|
||||
(TypeParameters))
|
||||
(Constructor
|
||||
{ (ConstructorIdentifier)
|
||||
->(ConstructorIdentifier) }
|
||||
(TypeParameters))
|
||||
{+(Constructor
|
||||
{+(ConstructorIdentifier)+}
|
||||
{+(TypeParameters)+})+}
|
||||
@ -79,12 +83,6 @@
|
||||
{+(Constructor
|
||||
{+(ConstructorIdentifier)+}
|
||||
{+(TypeParameters)+})+}
|
||||
{+(Constructor
|
||||
{+(ConstructorIdentifier)+}
|
||||
{+(TypeParameters)+})+}
|
||||
{-(Constructor
|
||||
{-(ConstructorIdentifier)-}
|
||||
{-(TypeParameters)-})-}
|
||||
{-(Constructor
|
||||
{-(ConstructorIdentifier)-}
|
||||
{-(TypeParameters)-})-}
|
||||
|
@ -40,3 +40,11 @@ parseJSON (JSON.Object r) = IncPK <$>
|
||||
f = do
|
||||
a <- b =<< c
|
||||
b <- e >>= g
|
||||
|
||||
f = \ x -> x
|
||||
|
||||
f = \ (Just a) -> a
|
||||
|
||||
f = \ x -> x : a : xs
|
||||
|
||||
f = \ g a b -> g <$> a <*> b
|
||||
|
@ -40,3 +40,11 @@ parseJSON (JSON.Object s) = IncPK <$>
|
||||
g = do
|
||||
b <- d =<< e
|
||||
c <- f >>= h
|
||||
|
||||
g = \ x -> x
|
||||
|
||||
g = \ (Just a) -> a
|
||||
|
||||
g = \ x -> x : a : xs
|
||||
|
||||
g = \ g a b -> g <$> a <*> b
|
||||
|
119
test/fixtures/haskell/corpus/expressions.diffA-B.txt
vendored
119
test/fixtures/haskell/corpus/expressions.diffA-B.txt
vendored
@ -239,48 +239,31 @@
|
||||
->(VariableIdentifier) }
|
||||
(ConstructorOperator
|
||||
(ConstructorSymbol)))))
|
||||
{+(Function
|
||||
{+(VariableIdentifier)+}
|
||||
{+(Statements
|
||||
{+(LeftOperatorSection
|
||||
{+(VariableIdentifier)+}
|
||||
{+(ConstructorOperator
|
||||
{+(ConstructorSymbol)+})+})+})+})+}
|
||||
{+(Function
|
||||
{+(VariableIdentifier)+}
|
||||
{+(Statements
|
||||
{+(InfixOperatorApp
|
||||
{+(VariableIdentifier)+}
|
||||
{+(VariableOperator
|
||||
{+(InfixVariableIdentifier)+})+}
|
||||
{+(VariableIdentifier)+})+})+})+}
|
||||
{+(Function
|
||||
{+(VariableIdentifier)+}
|
||||
{+(Statements
|
||||
{+(QualifiedConstructorIdentifier
|
||||
{+(ModuleIdentifier)+}
|
||||
{+(ConstructorIdentifier)+})+})+})+}
|
||||
{-(Function
|
||||
{-(VariableIdentifier)-}
|
||||
{-(Statements
|
||||
{-(LeftOperatorSection
|
||||
{-(VariableIdentifier)-}
|
||||
{-(ConstructorOperator
|
||||
{-(ConstructorSymbol)-})-})-})-})-}
|
||||
{-(Function
|
||||
{-(VariableIdentifier)-}
|
||||
{-(Statements
|
||||
{-(InfixOperatorApp
|
||||
{-(VariableIdentifier)-}
|
||||
{-(VariableOperator
|
||||
{-(InfixVariableIdentifier)-})-}
|
||||
{-(VariableIdentifier)-})-})-})-}
|
||||
{-(Function
|
||||
{-(VariableIdentifier)-}
|
||||
{-(Statements
|
||||
{-(QualifiedConstructorIdentifier
|
||||
{-(ModuleIdentifier)-}
|
||||
{-(ConstructorIdentifier)-})-})-})-}
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(LeftOperatorSection
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(ConstructorOperator
|
||||
(ConstructorSymbol)))))
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(VariableOperator
|
||||
(InfixVariableIdentifier))
|
||||
(VariableIdentifier))))
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(QualifiedConstructorIdentifier
|
||||
(ModuleIdentifier)
|
||||
(ConstructorIdentifier))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(ConstructorPattern
|
||||
@ -352,4 +335,54 @@
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) })))))))
|
||||
->(VariableIdentifier) })))))
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(Lambda
|
||||
(VariableIdentifier)
|
||||
(VariableIdentifier))))
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(Lambda
|
||||
(ConstructorPattern
|
||||
(Statements
|
||||
(ConstructorIdentifier)
|
||||
(VariableIdentifier)))
|
||||
(VariableIdentifier))))
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(Lambda
|
||||
(VariableIdentifier)
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(ConstructorOperator
|
||||
(ConstructorSymbol))
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(ConstructorOperator
|
||||
(ConstructorSymbol))
|
||||
(VariableIdentifier))))))
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(Lambda
|
||||
(Statements
|
||||
(VariableIdentifier)
|
||||
(VariableIdentifier)
|
||||
(VariableIdentifier))
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
(VariableIdentifier))))))))
|
||||
|
@ -239,20 +239,15 @@
|
||||
->(VariableIdentifier) }
|
||||
(ConstructorOperator
|
||||
(ConstructorSymbol)))))
|
||||
{+(Function
|
||||
{+(VariableIdentifier)+}
|
||||
{+(Statements
|
||||
{+(LeftOperatorSection
|
||||
{+(VariableIdentifier)+}
|
||||
{+(ConstructorOperator
|
||||
{+(ConstructorSymbol)+})+})+})+})+}
|
||||
{-(Function
|
||||
{-(VariableIdentifier)-}
|
||||
{-(Statements
|
||||
{-(LeftOperatorSection
|
||||
{-(VariableIdentifier)-}
|
||||
{-(ConstructorOperator
|
||||
{-(ConstructorSymbol)-})-})-})-})-}
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(LeftOperatorSection
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(ConstructorOperator
|
||||
(ConstructorSymbol)))))
|
||||
{-(Function
|
||||
{-(VariableIdentifier)-}
|
||||
{-(Statements
|
||||
@ -332,12 +327,16 @@
|
||||
{-(VariableOperator
|
||||
{-(VariableSymbol)-})-}
|
||||
{-(VariableIdentifier)-})-})-})-}))
|
||||
{+(Function
|
||||
{+(VariableIdentifier)+}
|
||||
{+(Statements
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
{+(QualifiedConstructorIdentifier
|
||||
{+(ModuleIdentifier)+}
|
||||
{+(ConstructorIdentifier)+})+})+})+}
|
||||
{+(ConstructorIdentifier)+})+}
|
||||
{-(Lambda
|
||||
{-(VariableIdentifier)-}
|
||||
{-(VariableIdentifier)-})-}))
|
||||
{+(Function
|
||||
{+(VariableIdentifier)+}
|
||||
{+(ConstructorPattern
|
||||
@ -397,4 +396,53 @@
|
||||
{+(VariableIdentifier)+}
|
||||
{+(VariableOperator
|
||||
{+(VariableSymbol)+})+}
|
||||
{+(VariableIdentifier)+})+})+})+})+})+}))
|
||||
{+(VariableIdentifier)+})+})+})+})+})+}
|
||||
{+(Function
|
||||
{+(VariableIdentifier)+}
|
||||
{+(Statements
|
||||
{+(Lambda
|
||||
{+(VariableIdentifier)+}
|
||||
{+(VariableIdentifier)+})+})+})+}
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(Lambda
|
||||
(ConstructorPattern
|
||||
(Statements
|
||||
(ConstructorIdentifier)
|
||||
(VariableIdentifier)))
|
||||
(VariableIdentifier))))
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(Lambda
|
||||
(VariableIdentifier)
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(ConstructorOperator
|
||||
(ConstructorSymbol))
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(ConstructorOperator
|
||||
(ConstructorSymbol))
|
||||
(VariableIdentifier))))))
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(Lambda
|
||||
(Statements
|
||||
(VariableIdentifier)
|
||||
(VariableIdentifier)
|
||||
(VariableIdentifier))
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
(VariableIdentifier))))))))
|
||||
|
@ -275,6 +275,52 @@
|
||||
(VariableIdentifier)))
|
||||
(BindPattern
|
||||
(VariableIdentifier)
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
(VariableIdentifier))))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(Lambda
|
||||
(VariableIdentifier)
|
||||
(VariableIdentifier))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(Lambda
|
||||
(ConstructorPattern
|
||||
(Statements
|
||||
(ConstructorIdentifier)
|
||||
(VariableIdentifier)))
|
||||
(VariableIdentifier))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(Lambda
|
||||
(VariableIdentifier)
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(ConstructorOperator
|
||||
(ConstructorSymbol))
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(ConstructorOperator
|
||||
(ConstructorSymbol))
|
||||
(VariableIdentifier))))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(Lambda
|
||||
(Statements
|
||||
(VariableIdentifier)
|
||||
(VariableIdentifier)
|
||||
(VariableIdentifier))
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(VariableOperator
|
||||
|
@ -277,6 +277,52 @@
|
||||
(VariableIdentifier)))
|
||||
(BindPattern
|
||||
(VariableIdentifier)
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
(VariableIdentifier))))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(Lambda
|
||||
(VariableIdentifier)
|
||||
(VariableIdentifier))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(Lambda
|
||||
(ConstructorPattern
|
||||
(Statements
|
||||
(ConstructorIdentifier)
|
||||
(VariableIdentifier)))
|
||||
(VariableIdentifier))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(Lambda
|
||||
(VariableIdentifier)
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(ConstructorOperator
|
||||
(ConstructorSymbol))
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(ConstructorOperator
|
||||
(ConstructorSymbol))
|
||||
(VariableIdentifier))))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(Lambda
|
||||
(Statements
|
||||
(VariableIdentifier)
|
||||
(VariableIdentifier)
|
||||
(VariableIdentifier))
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
(InfixOperatorApp
|
||||
(VariableIdentifier)
|
||||
(VariableOperator
|
||||
|
@ -52,17 +52,17 @@
|
||||
(TypeConstructorIdentifier))
|
||||
(TypePattern
|
||||
(TupleConstructor)))
|
||||
(TypeSynonym
|
||||
(Statements
|
||||
(TypeConstructorIdentifier))
|
||||
(TypePattern
|
||||
{ (FunctionConstructor)
|
||||
->(TupleConstructor) }))
|
||||
{+(TypeSynonym
|
||||
{+(Statements
|
||||
{+(TypeConstructorIdentifier)+})+}
|
||||
{+(TypePattern
|
||||
{+(TupleConstructor)+})+})+}
|
||||
(TypeSynonym
|
||||
(Statements
|
||||
{ (TypeConstructorIdentifier)
|
||||
->(TypeConstructorIdentifier) })
|
||||
(TypePattern
|
||||
(FunctionConstructor)))
|
||||
{+(FunctionConstructor)+})+})+}
|
||||
(TypeSynonym
|
||||
(Statements
|
||||
(TypeConstructorIdentifier))
|
||||
|
@ -52,11 +52,12 @@
|
||||
(TypeConstructorIdentifier))
|
||||
(TypePattern
|
||||
(TupleConstructor)))
|
||||
{+(TypeSynonym
|
||||
{+(Statements
|
||||
{+(TypeConstructorIdentifier)+})+}
|
||||
{+(TypePattern
|
||||
{+(FunctionConstructor)+})+})+}
|
||||
(TypeSynonym
|
||||
(Statements
|
||||
(TypeConstructorIdentifier))
|
||||
(TypePattern
|
||||
{ (TupleConstructor)
|
||||
->(FunctionConstructor) }))
|
||||
{+(TypeSynonym
|
||||
{+(Statements
|
||||
{+(TypeConstructorIdentifier)+})+}
|
||||
@ -114,11 +115,14 @@
|
||||
{+(TypeConstructorIdentifier)+}
|
||||
{+(TypeVariableIdentifier)+})+})+}
|
||||
{+(Empty)+})+})+})+})+})+}
|
||||
{+(TypeSynonym
|
||||
{+(Statements
|
||||
{+(TypeConstructorIdentifier)+}
|
||||
{+(TypeConstructorIdentifier)+})+}
|
||||
{+(TextElement)+})+}
|
||||
(TypeSynonym
|
||||
(Statements
|
||||
{ (TypeConstructorIdentifier)
|
||||
->(TypeConstructorIdentifier) }
|
||||
{+(TypeConstructorIdentifier)+})
|
||||
{ (TypePattern
|
||||
{-(FunctionConstructor)-})
|
||||
->(TextElement) })
|
||||
{+(TypeSynonym
|
||||
{+(Statements
|
||||
{+(TypeConstructorIdentifier)+}
|
||||
@ -167,16 +171,6 @@
|
||||
{+(TypeConstructorIdentifier)+}
|
||||
{+(TypeVariableIdentifier)+}
|
||||
{+(TypeVariableIdentifier)+})+})+})+})+}
|
||||
{-(TypeSynonym
|
||||
{-(Statements
|
||||
{-(TypeConstructorIdentifier)-})-}
|
||||
{-(TypePattern
|
||||
{-(TupleConstructor)-})-})-}
|
||||
{-(TypeSynonym
|
||||
{-(Statements
|
||||
{-(TypeConstructorIdentifier)-})-}
|
||||
{-(TypePattern
|
||||
{-(FunctionConstructor)-})-})-}
|
||||
{-(TypeSynonym
|
||||
{-(Statements
|
||||
{-(TypeConstructorIdentifier)-})-}
|
||||
|
Loading…
Reference in New Issue
Block a user