@@ -16,8 +16,8 @@ import qualified Data.Map as Map
1616import qualified Data.ByteString.Lazy as BS
1717import qualified Data.Text as Text
1818
19−import SourceSyntax.Helpers (isSymbol)
20−import SourceSyntax.Type (Type(..))
19+import qualified SourceSyntax.Helpers as Help
20+import qualified SourceSyntax.Type as T
2121import qualified SourceSyntax.Expression as E
2222import qualified SourceSyntax.Declaration as D
2323
@@ -122,7 +122,7 @@ collect infixes types aliases adts things =
122122 where
123123 nonCustomOps = Map.mapWithKey addDefaultInfix $ Map.difference types infixes
124124 addDefaultInfix name pairs
125− | all isSymbol name = addInfix (D.L, 9 :: Int) pairs
125+ | all Help.isSymbol name = addInfix (D.L, 9 :: Int) pairs
126126 | otherwise = pairs
127127
128128 customOps = Map.intersectionWith addInfix infixes types
@@ -139,7 +139,7 @@ collect infixes types aliases adts things =
139139 let fields = ["typeVariables" .= vars, "type" .= tipe ]
140140 in collect infixes types (insert name fields aliases) adts rest
141141 D.Datatype name vars ctors ->
142− let tipe = Data name (map Var vars)
142+ let tipe = T.Data name (map T.Var vars)
143143 fields = ["typeVariables" .= vars
144144 , "constructors" .= map (ctorToJson tipe) ctors ]
145145 in collect infixes types aliases (insert name fields adts) rest
@@ -148,28 +148,28 @@ collect infixes types aliases adts things =
148148 obj name fields =
149149 [ "name" .= name, "raw" .= source, "comment" .= comment ] ++ fields
150150
151−instance ToJSON Type where
151+instance ToJSON T.Type where
152152 toJSON tipe =
153153 object $
154154 case tipe of
155− Lambda t1 t2 ->
155+ T.Lambda t1 t2 ->
156156 [ "tag" .= ("function" :: Text.Text)
157− , "input" .= toJSON t1
158− , "output" .= toJSON t2
157+ , "args" .= toJSON (T.collectLambdas t1)
158+ , "result" .= toJSON t2
159159 ]
160160
161− Var x ->
161+ T.Var x ->
162162 [ "tag" .= ("var" :: Text.Text)
163163 , "name" .= toJSON x
164164 ]
165165
166− Data name ts ->
166+ T.Data name ts ->
167167 [ "tag" .= ("adt" :: Text.Text)
168168 , "name" .= toJSON name
169169 , "args" .= map toJSON ts
170170 ]
171171
172− Record fields ext ->
172+ T.Record fields ext ->
173173 [ "tag" .= ("record" :: Text.Text)
174174 , "fields" .= toJSON (map (toJSON . second toJSON) fields)
175175 , "extension" .= toJSON ext
@@ -177,4 +177,4 @@ instance ToJSON Type where
177177
178178ctorToJson tipe (ctor, tipes) =
179179 object [ "name" .= ctor
180− , "type" .= foldr Lambda tipe tipes ]
180+ , "type" .= foldr T.Lambda tipe tipes ]