@@ -17,8 +17,8 @@ import qualified Data.Text as Text
1717
1818import SourceSyntax.Helpers (isSymbol)
1919import SourceSyntax.Type (Type(..))
20−import SourceSyntax.Declaration (Declaration(..), Assoc(..), Derivation(..))
21−import SourceSyntax.Expression (Def(..))
20+import qualified SourceSyntax.Expression as E
21+import qualified SourceSyntax.Declaration as D
2222
2323import Text.Parsec hiding (newline,spaces)
2424import Parse.Declaration (alias,datatype,infixDecl)
@@ -77,10 +77,10 @@ moduleDocs = do
7777 structure <- docComment
7878 return (List.intercalate "." names, exports, structure)
7979
80−document :: IParser [(String, Declaration t v, String)]
80+document :: IParser [(String, D.ParseDeclaration, String)]
8181document = onFreshLines (\t ts -> ts ++ [t]) [] docThing
8282
83−docThing :: IParser (String, Declaration t v, String)
83+docThing :: IParser (String, D.ParseDeclaration, String)
8484docThing = uncommentable <|> commented <|> uncommented ""
8585 where
8686 uncommentable = do
@@ -93,7 +93,7 @@ docThing = uncommentable <|> commented <|> uncommented ""
9393 uncommented comment
9494
9595 uncommented comment = do
96− (src,def) <- withSource $ choice [ alias, datatype, Definition <$> typeAnnotation ]
96+ (src,def) <- withSource $ choice [ alias, datatype, D.Definition <$> typeAnnotation ]
9797 return (comment, def, src)
9898
9999
@@ -121,7 +121,7 @@ collect infixes types aliases adts things =
121121 where
122122 nonCustomOps = Map.mapWithKey addDefaultInfix $ Map.difference types infixes
123123 addDefaultInfix name pairs
124− | all isSymbol name = addInfix (L, 9 :: Int) pairs
124+ | all isSymbol name = addInfix (D.L, 9 :: Int) pairs
125125 | otherwise = pairs
126126
127127 customOps = Map.intersectionWith addInfix infixes types
@@ -130,14 +130,14 @@ collect infixes types aliases adts things =
130130
131131 (comment, decl, source) : rest ->
132132 case decl of
133− Fixity assoc prec name ->
133+ D.Fixity assoc prec name ->
134134 collect (Map.insert name (assoc,prec) infixes) types aliases adts rest
135− Definition (TypeAnnotation name tipe) ->
135+ D.Definition (E.TypeAnnotation name tipe) ->
136136 collect infixes (insert name [ "type" .= tipe ] types) aliases adts rest
137− TypeAlias name vars tipe derivations ->
137+ D.TypeAlias name vars tipe derivations ->
138138 let fields = ["typeVariables" .= vars, "type" .= tipe, "deriving" .= derivations ]
139139 in collect infixes types (insert name fields aliases) adts rest
140− Datatype name vars ctors derivations ->
140+ D.Datatype name vars ctors derivations ->
141141 let tipe = Data name (map Var vars)
142142 fields = ["typeVariables" .= vars
143143 , "constructors" .= map (ctorToJson tipe) ctors
@@ -164,5 +164,5 @@ ctorToJson tipe (ctor, tipes) =
164164 object [ "name" .= ctor
165165 , "type" .= foldr Lambda tipe tipes ]
166166
167−instance ToJSON Derivation where
167+instance ToJSON D.Derivation where
168168 toJSON = toJSON . show