@@ -84,7 +84,7 @@ data Declaration = Declaration
8484 , declComments :: Maybe String
8585 , declSourceSpan :: Maybe P.SourceSpan
8686 , declChildren :: [ChildDeclaration]
87− , declFixity :: Maybe (P.Fixity, Maybe String)
87+ , declFixity :: Maybe P.Fixity -- TODO: remove in 0.9
8888 , declInfo :: DeclarationInfo
8989 }
9090 deriving (Show, Eq, Ord)
@@ -126,6 +126,12 @@ data DeclarationInfo
126126 -- members are represented as child declarations.
127127 --
128128 | TypeClassDeclaration [(String, Maybe P.Kind)] [P.Constraint]
129+
130+ -- |
131+ -- An operator alias declaration, with the member the alias is for and the
132+ -- operator's fixity.
133+ --
134+ | AliasDeclaration (P.Qualified P.Ident) P.Fixity
129135 deriving (Show, Eq, Ord)
130136
131137declInfoToString :: DeclarationInfo -> String
@@ -134,6 +140,7 @@ declInfoToString (DataDeclaration _ _) = "data"
134140declInfoToString (ExternDataDeclaration _) = "externData"
135141declInfoToString (TypeSynonymDeclaration _ _) = "typeSynonym"
136142declInfoToString (TypeClassDeclaration _ _) = "typeClass"
143+declInfoToString (AliasDeclaration _ _) = "alias"
137144
138145data ChildDeclaration = ChildDeclaration
139146 { cdeclTitle :: String
@@ -307,12 +314,10 @@ asDeclaration =
307314 <*> key "fixity" (perhaps asFixity)
308315 <*> key "info" asDeclarationInfo
309316
310−asFixity :: Parse PackageError (P.Fixity, Maybe String)
311−asFixity = do
312− fixity <- P.Fixity <$> key "associativity" asAssociativity
313− <*> key "precedence" asIntegral
314− alias <- keyMay "alias" asString
315− return (fixity, alias)
317+asFixity :: Parse PackageError P.Fixity
318+asFixity =
319+ P.Fixity <$> key "associativity" asAssociativity
320+ <*> key "precedence" asIntegral
316321
317322parseAssociativity :: String -> Maybe P.Associativity
318323parseAssociativity str = case str of
@@ -341,6 +346,9 @@ asDeclarationInfo = do
341346 "typeClass" ->
342347 TypeClassDeclaration <$> key "arguments" asTypeArguments
343348 <*> key "superclasses" (eachInArray asConstraint)
349+ "alias" ->
350+ AliasDeclaration <$> key "for" asQualifiedIdent
351+ <*> key "fixity" asFixity
344352 other ->
345353 throwCustomError (InvalidDeclarationType other)
346354
@@ -394,6 +402,9 @@ asConstraint = (,) <$> nth 0 asQualifiedProperName
394402asQualifiedProperName :: Parse e (P.Qualified P.ProperName)
395403asQualifiedProperName = fromAesonParser
396404
405+asQualifiedIdent :: Parse e (P.Qualified P.Ident)
406+asQualifiedIdent = fromAesonParser
407+
397408asBookmarks :: Parse BowerError [Bookmark]
398409asBookmarks = eachInArray asBookmark
399410
@@ -478,6 +489,7 @@ instance A.ToJSON DeclarationInfo where
478489 ExternDataDeclaration kind -> ["kind" .= kind]
479490 TypeSynonymDeclaration args ty -> ["arguments" .= args, "type" .= ty]
480491 TypeClassDeclaration args super -> ["arguments" .= args, "superclasses" .= super]
492+ AliasDeclaration for fixity -> ["for" .= for, "fixity" .= fixity]
481493
482494instance A.ToJSON ChildDeclarationInfo where
483495 toJSON info = A.object $ "declType" .= childDeclInfoToString info : props