@@ -17,8 +17,8 @@ import qualified Data.Text as Text
18import SourceSyntax.Helpers (isSymbol)
18import SourceSyntax.Helpers (isSymbol)
19import SourceSyntax.Type (Type(..))
19import SourceSyntax.Type (Type(..))
20−import SourceSyntax.Declaration (Declaration(..), Assoc(..), Derivation(..))
20+import qualified SourceSyntax.Expression as E
21−import SourceSyntax.Expression (Def(..))
21+import qualified SourceSyntax.Declaration as D
23import Text.Parsec hiding (newline,spaces)
23import Text.Parsec hiding (newline,spaces)
24import Parse.Declaration (alias,datatype,infixDecl)
24import Parse.Declaration (alias,datatype,infixDecl)
@@ -77,10 +77,10 @@ moduleDocs = do
77 structure <- docComment
77 structure <- docComment
78 return (List.intercalate "." names, exports, structure)
78 return (List.intercalate "." names, exports, structure)
80−document :: IParser [(String, Declaration t v, String)]
80+document :: IParser [(String, D.ParseDeclaration, String)]
81document = onFreshLines (\t ts -> ts ++ [t]) [] docThing
81document = onFreshLines (\t ts -> ts ++ [t]) [] docThing
83−docThing :: IParser (String, Declaration t v, String)
83+docThing :: IParser (String, D.ParseDeclaration, String)
84docThing = uncommentable <|> commented <|> uncommented ""
84docThing = uncommentable <|> commented <|> uncommented ""
86 uncommentable = do
86 uncommentable = do
@@ -93,7 +93,7 @@ docThing = uncommentable <|> commented <|> uncommented ""
93 uncommented comment
93 uncommented comment
95 uncommented comment = do
95 uncommented comment = do
96− (src,def) <- withSource $ choice [ alias, datatype, Definition <$> typeAnnotation ]
96+ (src,def) <- withSource $ choice [ alias, datatype, D.Definition <$> typeAnnotation ]
97 return (comment, def, src)
97 return (comment, def, src)
@@ -121,7 +121,7 @@ collect infixes types aliases adts things =
122 nonCustomOps = Map.mapWithKey addDefaultInfix $ Map.difference types infixes
122 nonCustomOps = Map.mapWithKey addDefaultInfix $ Map.difference types infixes
123 addDefaultInfix name pairs
123 addDefaultInfix name pairs
124− | all isSymbol name = addInfix (L, 9 :: Int) pairs
124+ | all isSymbol name = addInfix (D.L, 9 :: Int) pairs
125 | otherwise = pairs
125 | otherwise = pairs
127 customOps = Map.intersectionWith addInfix infixes types
127 customOps = Map.intersectionWith addInfix infixes types
@@ -130,14 +130,14 @@ collect infixes types aliases adts things =
131 (comment, decl, source) : rest ->
131 (comment, decl, source) : rest ->
132 case decl of
132 case decl of
133− Fixity assoc prec name ->
133+ D.Fixity assoc prec name ->
134 collect (Map.insert name (assoc,prec) infixes) types aliases adts rest
134 collect (Map.insert name (assoc,prec) infixes) types aliases adts rest
135− Definition (TypeAnnotation name tipe) ->
135+ D.Definition (E.TypeAnnotation name tipe) ->
136 collect infixes (insert name [ "type" .= tipe ] types) aliases adts rest
136 collect infixes (insert name [ "type" .= tipe ] types) aliases adts rest
137− TypeAlias name vars tipe derivations ->
137+ D.TypeAlias name vars tipe derivations ->
138 let fields = ["typeVariables" .= vars, "type" .= tipe, "deriving" .= derivations ]
138 let fields = ["typeVariables" .= vars, "type" .= tipe, "deriving" .= derivations ]
139 in collect infixes types (insert name fields aliases) adts rest
139 in collect infixes types (insert name fields aliases) adts rest
140− Datatype name vars ctors derivations ->
140+ D.Datatype name vars ctors derivations ->
141 let tipe = Data name (map Var vars)
141 let tipe = Data name (map Var vars)
142 fields = ["typeVariables" .= vars
142 fields = ["typeVariables" .= vars
143 , "constructors" .= map (ctorToJson tipe) ctors
143 , "constructors" .= map (ctorToJson tipe) ctors
@@ -164,5 +164,5 @@ ctorToJson tipe (ctor, tipes) =
164 object [ "name" .= ctor
164 object [ "name" .= ctor
165 , "type" .= foldr Lambda tipe tipes ]
165 , "type" .= foldr Lambda tipe tipes ]
167−instance ToJSON Derivation where
167+instance ToJSON D.Derivation where
168 toJSON = toJSON . show
168 toJSON = toJSON . show