1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 01:47:01 +03:00

Assign annotated type variables

This commit is contained in:
Rick Winfrey 2018-06-06 17:03:27 -07:00
parent fc7c578b9b
commit bd43959cb0
11 changed files with 76 additions and 34 deletions

View File

@ -33,6 +33,7 @@ type Syntax = '[
, Literal.Float
, Literal.Integer
, Literal.TextElement
, Syntax.AnnotatedTypeVariable
, Syntax.Class
, Syntax.Context
, Syntax.Context'
@ -83,6 +84,9 @@ algebraicDatatypeDeclaration = makeTerm
<|> pure [])
<*> (derivingClause <|> emptyTerm))
annotatedTypeVariable :: Assignment
annotatedTypeVariable = makeTerm <$> symbol AnnotatedTypeVariable <*> children (Syntax.AnnotatedTypeVariable <$> typeVariableIdentifier <* token Annotation <*> (kind <|> type'))
character :: Assignment
character = makeTerm <$> symbol Char <*> (Literal.Character <$> source)
@ -117,6 +121,7 @@ expression = term (handleError (choice expressionChoices))
expressionChoices :: [Assignment.Assignment [] Grammar Term]
expressionChoices = [
algebraicDatatypeDeclaration
, annotatedTypeVariable
, character
, comment
, context'

View File

@ -234,3 +234,12 @@ instance Ord1 QualifiedTypeConstructorIdentifier where liftCompare = genericLift
instance Show1 QualifiedTypeConstructorIdentifier where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable QualifiedTypeConstructorIdentifier
data AnnotatedTypeVariable a = AnnotatedTypeVariable { annotatedTypeVariableIdentifier :: a, annotatedTypeVariableannotation :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 AnnotatedTypeVariable where liftEq = genericLiftEq
instance Ord1 AnnotatedTypeVariable where liftCompare = genericLiftCompare
instance Show1 AnnotatedTypeVariable where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable AnnotatedTypeVariable

View File

@ -80,10 +80,6 @@
{ (Identifier)
->(Identifier) }
(TypeParameters))
{+(Constructor
{+(Empty)+}
{+(Identifier)+}
{+(TypeParameters)+})+}
(Constructor
(Empty)
{ (Identifier)
@ -93,10 +89,11 @@
{+(Empty)+}
{+(Identifier)+}
{+(TypeParameters)+})+}
{-(Constructor
{-(Empty)-}
{-(Identifier)-}
{-(TypeParameters)-})-}
(Constructor
(Empty)
{ (Identifier)
->(Identifier) }
(TypeParameters))
{-(Constructor
{-(Empty)-}
{-(Identifier)-}

View File

@ -80,6 +80,11 @@
{ (Identifier)
->(Identifier) }
(TypeParameters))
(Constructor
(Empty)
{ (Identifier)
->(Identifier) }
(TypeParameters))
{+(Constructor
{+(Empty)+}
{+(Identifier)+}
@ -88,14 +93,6 @@
{+(Empty)+}
{+(Identifier)+}
{+(TypeParameters)+})+}
{+(Constructor
{+(Empty)+}
{+(Identifier)+}
{+(TypeParameters)+})+}
{-(Constructor
{-(Empty)-}
{-(Identifier)-}
{-(TypeParameters)-})-}
{-(Constructor
{-(Empty)-}
{-(Identifier)-}

View File

@ -11,5 +11,5 @@ data Number a where
Ratio :: !Prelude.Rational -> Number Prelude.Rational
Decimal :: !Scientific -> Number Scientific
data Union r v where
data Union (r :: [ * -> * ]) (v :: *) where
Union :: {-# UNPACK #-} !Int -> t v -> Union r v

View File

@ -11,5 +11,5 @@ data Number' a where
Ratio' :: !Prelude.Rational -> Number Prelude.Rational
Decimal' :: !Scientific -> Number Scientific
data Union r v where
data Union (r :: [ * -> * ]) (v :: *) where
Union :: {-# UNPACK #-} !Integer -> t v -> Union r v

View File

@ -167,8 +167,17 @@
(Type
(Identifier)
(Statements
(Identifier)
(Identifier))
(AnnotatedTypeVariable
(Identifier)
(KindListType
(KindFunctionType
(Kind
(Star))
(Kind
(Star)))))
(AnnotatedTypeVariable
(Identifier)
(Star)))
(Empty))
(Statements
(GADTConstructor

View File

@ -167,8 +167,17 @@
(Type
(Identifier)
(Statements
(Identifier)
(Identifier))
(AnnotatedTypeVariable
(Identifier)
(KindListType
(KindFunctionType
(Kind
(Star))
(Kind
(Star)))))
(AnnotatedTypeVariable
(Identifier)
(Star)))
(Empty))
(Statements
(GADTConstructor

View File

@ -155,8 +155,17 @@
(Type
(Identifier)
(Statements
(Identifier)
(Identifier))
(AnnotatedTypeVariable
(Identifier)
(KindListType
(KindFunctionType
(Kind
(Star))
(Kind
(Star)))))
(AnnotatedTypeVariable
(Identifier)
(Star)))
(Empty))
(Statements
(GADTConstructor

View File

@ -156,8 +156,17 @@
(Type
(Identifier)
(Statements
(Identifier)
(Identifier))
(AnnotatedTypeVariable
(Identifier)
(KindListType
(KindFunctionType
(Kind
(Star))
(Kind
(Star)))))
(AnnotatedTypeVariable
(Identifier)
(Star)))
(Empty))
(Statements
(GADTConstructor

View File

@ -49,10 +49,12 @@
{+(Identifier)+}
{+(Statements
{+(Float)+})+})+}
{+(Function
{+(Identifier)+}
{+(Statements
{+(Float)+})+})+}
(Function
{ (Identifier)
->(Identifier) }
(Statements
{+(Float)+}
{-(Integer)-}))
{+(Function
{+(Identifier)+}
{+(Statements
@ -283,10 +285,6 @@
{-(Identifier)-}
{-(Statements
{-(Integer)-})-})-}
{-(Function
{-(Identifier)-}
{-(Statements
{-(Integer)-})-})-}
{-(Function
{-(Identifier)-}
{-(Statements