@@ -122,10 +122,10 @@ data DeclarationInfo
122122 | TypeSynonymDeclaration [(String, Maybe P.Kind)] P.Type
123123
124124 -- |
125− -- A type class, with its type arguments and its superclasses. Instances and
126− -- members are represented as child declarations.
125+ -- A type class, with its type arguments, its superclasses and functional
126+ -- dependencies. Instances and members are represented as child declarations.
127127 --
128− | TypeClassDeclaration [(String, Maybe P.Kind)] [P.Constraint]
128+ | TypeClassDeclaration [(String, Maybe P.Kind)] [P.Constraint] [([String], [String])]
129129
130130 -- |
131131 -- An operator alias declaration, with the member the alias is for and the
@@ -141,7 +141,7 @@ declInfoToString (ValueDeclaration _) = "value"
141141declInfoToString (DataDeclaration _ _) = "data"
142142declInfoToString (ExternDataDeclaration _) = "externData"
143143declInfoToString (TypeSynonymDeclaration _ _) = "typeSynonym"
144−declInfoToString (TypeClassDeclaration _ _) = "typeClass"
144+declInfoToString (TypeClassDeclaration _ _ _) = "typeClass"
145145declInfoToString (AliasDeclaration _ _) = "alias"
146146
147147isTypeClass :: Declaration -> Bool
@@ -413,6 +413,7 @@ asDeclarationInfo = do
413413 "typeClass" ->
414414 TypeClassDeclaration <$> key "arguments" asTypeArguments
415415 <*> key "superclasses" (eachInArray asConstraint)
416+ <*> keyOrDefault "fundeps" [] asFunDeps
416417 "alias" ->
417418 AliasDeclaration <$> key "fixity" asFixity
418419 <*> key "alias" asFixityAlias
@@ -430,6 +431,11 @@ asKind = fromAesonParser
430431asType :: Parse e P.Type
431432asType = fromAesonParser
432433
434+asFunDeps :: Parse PackageError [([String], [String])]
435+asFunDeps = eachInArray asFunDep
436+ where
437+ asFunDep = (,) <$> nth 0 (eachInArray asString) <*> nth 1 (eachInArray asString)
438+
433439asDataDeclType :: Parse PackageError P.DataDeclType
434440asDataDeclType =
435441 withString $ \s -> case s of
@@ -556,7 +562,7 @@ instance A.ToJSON DeclarationInfo where
556562 DataDeclaration ty args -> ["dataDeclType" .= ty, "typeArguments" .= args]
557563 ExternDataDeclaration kind -> ["kind" .= kind]
558564 TypeSynonymDeclaration args ty -> ["arguments" .= args, "type" .= ty]
559− TypeClassDeclaration args super -> ["arguments" .= args, "superclasses" .= super]
565+ TypeClassDeclaration args super fundeps -> ["arguments" .= args, "superclasses" .= super, "fundeps" .= fundeps]
560566 AliasDeclaration fixity alias -> ["fixity" .= fixity, "alias" .= alias]
561567
562568instance A.ToJSON ChildDeclarationInfo where