@@ -3,6 +3,7 @@ module Test.TypeQuery where
3import Docs.Search.TypeDecoder (Constraint(..), QualifiedName(..), Type(..))
3import Docs.Search.TypeDecoder (Constraint(..), QualifiedName(..), Type(..))
4import Docs.Search.TypeQuery (Substitution(..), TypeQuery(..), getFreeVariables, parseTypeQuery, penalty, typeVarPenalty)
4import Docs.Search.TypeQuery (Substitution(..), TypeQuery(..), getFreeVariables, parseTypeQuery, penalty, typeVarPenalty)
5import Docs.Search.TypeShape (ShapeChunk(..), shapeOfType, shapeOfTypeQuery)
5import Docs.Search.TypeShape (ShapeChunk(..), shapeOfType, shapeOfTypeQuery)
6+import Docs.Search.Types (Identifier(..))
7import Prelude
8import Prelude
@@ -25,193 +26,195 @@ tests = do
26 test "test #0" do
27 test "test #0" do
27 let input = "a"
28 let input = "a"
28− assertRight (parseTypeQuery input) (QVar "a")
29+ assertRight (parseTypeQuery input) (qVar "a")
30 test "test #1" do
31 test "test #1" do
31 let input = "ab"
32 let input = "ab"
32− assertRight (parseTypeQuery input) (QVar "ab")
33+ assertRight (parseTypeQuery input) (qVar "ab")
34 test "test #2" do
35 test "test #2" do
35 let input = "a b"
36 let input = "a b"
36− assertRight (parseTypeQuery input) (QApp (QVar "a") (QVar "b"))
37+ assertRight (parseTypeQuery input) (QApp (qVar "a") (qVar "b"))
38 test "test #3" do
39 test "test #3" do
39 let input = "a b c"
40 let input = "a b c"
40− assertRight (parseTypeQuery input) (QApp (QApp (QVar "a") (QVar "b")) (QVar "c"))
41+ assertRight (parseTypeQuery input) (QApp (QApp (qVar "a") (qVar "b")) (qVar "c"))
42 test "test #4" do
43 test "test #4" do
43 let input = "a -> b"
44 let input = "a -> b"
44− assertRight (parseTypeQuery input) (QFun (QVar "a") (QVar "b"))
45+ assertRight (parseTypeQuery input) (QFun (qVar "a") (qVar "b"))
46 test "test #5" do
47 test "test #5" do
47 let input = "a -> b c"
48 let input = "a -> b c"
48− assertRight (parseTypeQuery input) (QFun (QVar "a") (QApp (QVar "b") (QVar "c")))
49+ assertRight (parseTypeQuery input) (QFun (qVar "a") (QApp (qVar "b") (qVar "c")))
50 test "test #6" do
51 test "test #6" do
51 let input = "a b -> c"
52 let input = "a b -> c"
52− assertRight (parseTypeQuery input) (QFun (QApp (QVar "a") (QVar "b")) (QVar "c"))
53+ assertRight (parseTypeQuery input) (QFun (QApp (qVar "a") (qVar "b")) (qVar "c"))
54 test "test #7" do
55 test "test #7" do
55 let input = "a b"
56 let input = "a b"
56− assertRight (parseTypeQuery input) (QApp (QVar "a") (QVar "b"))
57+ assertRight (parseTypeQuery input) (QApp (qVar "a") (qVar "b"))
58 test "test #8" do
59 test "test #8" do
59 let input = "a (b c)"
60 let input = "a (b c)"
60− assertRight (parseTypeQuery input) (QApp (QVar "a") (QApp (QVar "b") (QVar "c")))
61+ assertRight (parseTypeQuery input) (QApp (qVar "a") (QApp (qVar "b") (qVar "c")))
62 test "test #9" do
63 test "test #9" do
63 let input = "(a b) (c d)"
64 let input = "(a b) (c d)"
64 assertRight (parseTypeQuery input)
65 assertRight (parseTypeQuery input)
65− (QApp (QApp (QVar "a") (QVar "b"))
66+ (QApp (QApp (qVar "a") (qVar "b"))
66− (QApp (QVar "c") (QVar "d")))
67+ (QApp (qVar "c") (qVar "d")))
68 test "test #10" do
69 test "test #10" do
69 let input = "a ( b c )"
70 let input = "a ( b c )"
70− assertRight (parseTypeQuery input) (QApp (QVar "a") (QApp (QVar "b") (QVar "c")))
71+ assertRight (parseTypeQuery input) (QApp (qVar "a") (QApp (qVar "b") (qVar "c")))
72 test "test #11" do
73 test "test #11" do
73 let input = "aaa"
74 let input = "aaa"
74− assertRight (parseTypeQuery input) (QVar "aaa")
75+ assertRight (parseTypeQuery input) (qVar "aaa")
76 test "test #12" do
77 test "test #12" do
77 let input = "aaa ( bbb ccc )"
78 let input = "aaa ( bbb ccc )"
78− assertRight (parseTypeQuery input) (QApp (QVar "aaa") (QApp (QVar "bbb") (QVar "ccc")))
79+ assertRight (parseTypeQuery input) (QApp (qVar "aaa") (QApp (qVar "bbb") (qVar "ccc")))
80 test "test #13" do
81 test "test #13" do
81 let input = "(a -> b) -> (c -> d)"
82 let input = "(a -> b) -> (c -> d)"
82− assertRight (parseTypeQuery input) (QFun (QFun (QVar "a") (QVar "b"))
83+ assertRight (parseTypeQuery input) (QFun (QFun (qVar "a") (qVar "b"))
83− (QFun (QVar "c") (QVar "d")))
84+ (QFun (qVar "c") (qVar "d")))
85 test "test #14" do
86 test "test #14" do
86 let input = "a -> b -> c -> d"
87 let input = "a -> b -> c -> d"
87− assertRight (parseTypeQuery input) (QFun (QVar "a")
88+ assertRight (parseTypeQuery input) (QFun (qVar "a")
88− (QFun (QVar "b")
89+ (QFun (qVar "b")
89− (QFun (QVar "c") (QVar "d"))))
90+ (QFun (qVar "c") (qVar "d"))))
91 test "test #15" do
92 test "test #15" do
92 let input = "a -> b -> c"
93 let input = "a -> b -> c"
93− assertRight (parseTypeQuery input) (QFun (QVar "a")
94+ assertRight (parseTypeQuery input) (QFun (qVar "a")
94− (QFun (QVar "b")
95+ (QFun (qVar "b")
95− (QVar "c")))
96+ (qVar "c")))
97 test "test #16" do
98 test "test #16" do
98 let input = "forall a b c. c"
99 let input = "forall a b c. c"
99− assertRight (parseTypeQuery input) (QForAll (nl "a" ["b", "c"]) (QVar "c"))
100+ assertRight (parseTypeQuery input) (QForAll (nl "a" ["b", "c"]) (qVar "c"))
101 test "test #17" do
102 test "test #17" do
102 let input = "forall a. Maybe a"
103 let input = "forall a. Maybe a"
103− assertRight (parseTypeQuery input) (QForAll (nl "a" $ []) (QApp (QConst "Maybe") (QVar "a")))
104+ assertRight (parseTypeQuery input) (QForAll (nl "a" $ []) (QApp (qConst "Maybe") (qVar "a")))
105 test "test #18" do
106 test "test #18" do
106 let input = "forall m a. Monad m => a -> m a"
107 let input = "forall m a. Monad m => a -> m a"
107 assertRight (parseTypeQuery input)
108 assertRight (parseTypeQuery input)
108 (QForAll (nl "m" ["a"])
109 (QForAll (nl "m" ["a"])
109− (QConstraint "Monad" (l [QVar "m"])
110+ (qConstraint "Monad" (l [qVar "m"])
110− (QFun (QVar "a")
111+ (QFun (qVar "a")
111− (QApp (QVar "m") (QVar "a")))))
112+ (QApp (qVar "m") (qVar "a")))))
113 test "test #19" do
114 test "test #19" do
114 let input = "{ a :: Int }"
115 let input = "{ a :: Int }"
115 assertRight (parseTypeQuery input)
116 assertRight (parseTypeQuery input)
116− (QApp (QConst "Record") (QRow (pure (Tuple "a" (QConst "Int")))))
117+ (QApp (qConst "Record") (QRow (pure (Tuple (Identifier "a") (qConst "Int")))))
118 test "test #20" do
119 test "test #20" do
119 let input = "{a::Int}"
120 let input = "{a::Int}"
120 assertRight (parseTypeQuery input)
121 assertRight (parseTypeQuery input)
121− (QApp (QConst "Record") (QRow (pure (Tuple "a" (QConst "Int")))))
122+ (QApp (qConst "Record") (QRow (pure (Tuple (Identifier "a") (qConst "Int")))))
123 test "test #21" do
124 test "test #21" do
124 let input = "Int"
125 let input = "Int"
125− assertRight (parseTypeQuery input) (QConst "Int")
126+ assertRight (parseTypeQuery input) (qConst "Int")
127 test "test #22" do
128 test "test #22" do
128 let input = "a->b"
129 let input = "a->b"
129− assertRight (parseTypeQuery input) (QFun (QVar "a") (QVar "b"))
130+ assertRight (parseTypeQuery input) (QFun (qVar "a") (qVar "b"))
131 test "test #23" do
132 test "test #23" do
132 let input = "forall m a. MonadRec m => Process m a -> m a"
133 let input = "forall m a. MonadRec m => Process m a -> m a"
133 assertRight (parseTypeQuery input) (QForAll (nl "m" ("a" : Nil))
134 assertRight (parseTypeQuery input) (QForAll (nl "m" ("a" : Nil))
134− (QConstraint "MonadRec" (l [QVar "m"])
135+ (qConstraint "MonadRec" (l [qVar "m"])
135− (QFun (QApp (QApp (QConst "Process")
136+ (QFun (QApp (QApp (qConst "Process")
136− (QVar "m")) (QVar "a"))
137+ (qVar "m")) (qVar "a"))
137− (QApp (QVar "m") (QVar "a")))))
138+ (QApp (qVar "m") (qVar "a")))))
139 test "test #24" do
140 test "test #24" do
140 let input = "forall t f a. Foldable1 t => Apply f => f"
141 let input = "forall t f a. Foldable1 t => Apply f => f"
141 assertRight (parseTypeQuery input) (QForAll (nl "t" ["f", "a"])
142 assertRight (parseTypeQuery input) (QForAll (nl "t" ["f", "a"])
142− (QConstraint "Foldable1" (l [QVar "t"])
143+ (qConstraint "Foldable1" (l [qVar "t"])
143− (QConstraint "Apply" (l [QVar "f"]) (QVar "f"))))
144+ (qConstraint "Apply" (l [qVar "f"]) (qVar "f"))))
145 test "test #25" do
146 test "test #25" do
146 let input = "forall m a.MonadRec m=>Process m a->m a"
147 let input = "forall m a.MonadRec m=>Process m a->m a"
147 assertRight (parseTypeQuery input) ((QForAll (nl "m" ("a" : Nil))
148 assertRight (parseTypeQuery input) ((QForAll (nl "m" ("a" : Nil))
148− (QConstraint "MonadRec" (l [QVar "m"])
149+ (qConstraint "MonadRec" (l [qVar "m"])
149− (QFun (QApp (QApp (QConst "Process")
150+ (QFun (QApp (QApp (qConst "Process")
150− (QVar "m")) (QVar "a"))
151+ (qVar "m")) (qVar "a"))
151− (QApp (QVar "m") (QVar "a"))))))
152+ (QApp (qVar "m") (qVar "a"))))))
153 test "test #26" do
154 test "test #26" do
154 let input = "m a -> (a -> m b) -> m b"
155 let input = "m a -> (a -> m b) -> m b"
155− assertRight (parseTypeQuery input) (QFun (QApp (QVar "m") (QVar "a")) (QFun (QFun (QVar "a") (QApp (QVar "m") (QVar "b"))) (QApp (QVar "m") (QVar "b"))))
156+ assertRight (parseTypeQuery input) (QFun (QApp (qVar "m") (qVar "a")) (QFun (QFun (qVar "a") (QApp (qVar "m") (qVar "b"))) (QApp (qVar "m") (qVar "b"))))
157 test "test #27" do
158 test "test #27" do
158 let input = "forall f a. Alternative f => Lazy (f (List a)) => f a -> f (List a)"
159 let input = "forall f a. Alternative f => Lazy (f (List a)) => f a -> f (List a)"
159 assertRight (parseTypeQuery input) ((QForAll (nl "f" ["a"]))
160 assertRight (parseTypeQuery input) ((QForAll (nl "f" ["a"]))
160− (QConstraint "Alternative" (l [QVar "f"])
161+ (qConstraint "Alternative" (l [qVar "f"])
161− (QConstraint "Lazy" (l [QApp (QVar "f")
162+ (qConstraint "Lazy" (l [QApp (qVar "f")
162− (QApp (QConst "List") (QVar "a"))])
163+ (QApp (qConst "List") (qVar "a"))])
163− (QFun (QApp (QVar "f") (QVar "a"))
164+ (QFun (QApp (qVar "f") (qVar "a"))
164− (QApp (QVar "f")
165+ (QApp (qVar "f")
165− (QApp (QConst "List") (QVar "a")))))))
166+ (QApp (qConst "List") (qVar "a")))))))
167 test "test #28" do
168 test "test #28" do
168 let input = "forall f a. Alternative f => Lazy(f (List a))=>f a -> f (List a)"
169 let input = "forall f a. Alternative f => Lazy(f (List a))=>f a -> f (List a)"
169 assertRight (parseTypeQuery input) ((QForAll (nl "f" ["a"]))
170 assertRight (parseTypeQuery input) ((QForAll (nl "f" ["a"]))
170− (QConstraint "Alternative" (l [QVar "f"])
171+ (qConstraint "Alternative" (l [qVar "f"])
171− (QConstraint "Lazy" (l [QApp (QVar "f")
172+ (qConstraint "Lazy" (l [QApp (qVar "f")
172− (QApp (QConst "List") (QVar "a"))])
173+ (QApp (qConst "List") (qVar "a"))])
173− (QFun (QApp (QVar "f") (QVar "a"))
174+ (QFun (QApp (qVar "f") (qVar "a"))
174− (QApp (QVar "f")
175+ (QApp (qVar "f")
175− (QApp (QConst "List") (QVar "a")))))))
176+ (QApp (qConst "List") (qVar "a")))))))
177 test "test #29" do
178 test "test #29" do
178 let input = "{a::Int,b::Int}"
179 let input = "{a::Int,b::Int}"
179 assertRight (parseTypeQuery input)
180 assertRight (parseTypeQuery input)
180− (QApp (QConst "Record") (QRow (List.fromFoldable [ Tuple "a" (QConst "Int"), Tuple "b" (QConst "Int")])))
181+ (QApp (qConst "Record") (QRow (List.fromFoldable
182+ [ Tuple (Identifier "a") (qConst "Int")
183+ , Tuple (Identifier "b") (qConst "Int")])))
182 test "test #30" do
185 test "test #30" do
183 let input = "{record''' :: Int}"
186 let input = "{record''' :: Int}"
184 assertRight (parseTypeQuery input)
187 assertRight (parseTypeQuery input)
185− (QApp (QConst "Record") (QRow (List.fromFoldable [ Tuple "record'''" (QConst "Int")])))
188+ (QApp (qConst "Record") (QRow (List.fromFoldable [ Tuple (Identifier "record'''") (qConst "Int")])))
187 test "test #31" do
190 test "test #31" do
188 let input = "(row''' :: Int)"
191 let input = "(row''' :: Int)"
189 assertRight (parseTypeQuery input)
192 assertRight (parseTypeQuery input)
190− (QRow (List.fromFoldable [ Tuple "row'''" (QConst "Int")]))
193+ (QRow (List.fromFoldable [ Tuple (Identifier "row'''") (qConst "Int")]))
192 test "test #32" do
195 test "test #32" do
193 let input = "(row1 :: Int, row2 :: (),row3::(row4::{}))"
196 let input = "(row1 :: Int, row2 :: (),row3::(row4::{}))"
194 assertRight (parseTypeQuery input)
197 assertRight (parseTypeQuery input)
195− (QRow (l [ Tuple "row1" (QConst "Int")
198+ (QRow (l [ Tuple (Identifier "row1") (qConst "Int")
196− , Tuple "row2" (QRow Nil)
199+ , Tuple (Identifier "row2") (QRow Nil)
197− , Tuple "row3" (QRow (l [ Tuple "row4" (QApp (QConst "Record") (QRow Nil)) ])) ]))
200+ , Tuple (Identifier "row3") (QRow (l [ Tuple (Identifier "row4") (QApp (qConst "Record") (QRow Nil)) ])) ]))
199 test "test #33" do
202 test "test #33" do
200 let input = "Foldable1 t => Apply f => t (f a) -> f Unit"
203 let input = "Foldable1 t => Apply f => t (f a) -> f Unit"
201 assertRight (parseTypeQuery input)
204 assertRight (parseTypeQuery input)
202− (QConstraint "Foldable1" ((QVar "t") : Nil) (QConstraint "Apply" ((QVar "f") : Nil) (QFun (QApp (QVar "t") (QApp (QVar "f") (QVar "a"))) (QApp (QVar "f") (QConst "Unit")))))
205+ (qConstraint "Foldable1" ((qVar "t") : Nil) (qConstraint "Apply" ((qVar "f") : Nil) (QFun (QApp (qVar "t") (QApp (qVar "f") (qVar "a"))) (QApp (qVar "f") (qConst "Unit")))))
204 test "test #34" do
207 test "test #34" do
205 let input = "Foldable1 t => Apply f => t (f a) -> f a"
208 let input = "Foldable1 t => Apply f => t (f a) -> f a"
206 assertRight (parseTypeQuery input)
209 assertRight (parseTypeQuery input)
207− (QConstraint "Foldable1" ((QVar "t") : Nil) (QConstraint "Apply" ((QVar "f") : Nil) (QFun (QApp (QVar "t") (QApp (QVar "f") (QVar "a"))) (QApp (QVar "f") (QVar "a")))))
210+ (qConstraint "Foldable1" ((qVar "t") : Nil) (qConstraint "Apply" ((qVar "f") : Nil) (QFun (QApp (qVar "t") (QApp (qVar "f") (qVar "a"))) (QApp (qVar "f") (qVar "a")))))
209 test "test #35" do
212 test "test #35" do
210 let input = "Generic a rep => GenericEq rep => a -> a -> Boolean"
213 let input = "Generic a rep => GenericEq rep => a -> a -> Boolean"
211 assertRight (parseTypeQuery input)
214 assertRight (parseTypeQuery input)
212− (QConstraint "Generic" ((QVar "a") : (QVar "rep") : Nil)
215+ (qConstraint "Generic" ((qVar "a") : (qVar "rep") : Nil)
213− (QConstraint "GenericEq" ((QVar "rep") : Nil)
216+ (qConstraint "GenericEq" ((qVar "rep") : Nil)
214− (QFun (QVar "a") (QFun (QVar "a") (QConst "Boolean")))))
217+ (QFun (qVar "a") (QFun (qVar "a") (qConst "Boolean")))))
216 suite "polish notation" do
219 suite "polish notation" do
@@ -246,7 +249,7 @@ tests = do
247 fun t1 t2 =
250 fun t1 t2 =
248 TypeApp (TypeApp (TypeConstructor (QualifiedName { moduleNameParts: ["Prim"]
251 TypeApp (TypeApp (TypeConstructor (QualifiedName { moduleNameParts: ["Prim"]
249− , name: "Function" })) t1) t2
252+ , name: Identifier "Function" })) t1) t2
251 ForAll "a" Nothing $
254 ForAll "a" Nothing $
252 ForAll "rep" Nothing $
255 ForAll "rep" Nothing $
@@ -314,70 +317,70 @@ tests = do
314 Assert.equal 0 (typeVarPenalty mempty)
317 Assert.equal 0 (typeVarPenalty mempty)
316 test "#1" do
319 test "#1" do
317− Assert.equal 0 (typeVarPenalty $ l [ Substitute "a" "b"
320+ Assert.equal 0 (typeVarPenalty $ l [ substitute "a" "b"
318− , Substitute "b" "a"
321+ , substitute "b" "a"
321 test "#2" do
324 test "#2" do
322− Assert.equal 0 (typeVarPenalty $ l [ Substitute "a" "b"
325+ Assert.equal 0 (typeVarPenalty $ l [ substitute "a" "b"
323− , Substitute "a" "b"
326+ , substitute "a" "b"
324− , Substitute "a" "b"
327+ , substitute "a" "b"
327 test "#3" do
330 test "#3" do
328− Assert.equal 1 (typeVarPenalty $ l [ Substitute "a" "b"
331+ Assert.equal 1 (typeVarPenalty $ l [ substitute "a" "b"
329− , Substitute "a" "c"
332+ , substitute "a" "c"
332 test "#4" do
335 test "#4" do
333− Assert.equal 1 (typeVarPenalty $ l [ Substitute "a" "b"
336+ Assert.equal 1 (typeVarPenalty $ l [ substitute "a" "b"
334− , Substitute "b" "a"
337+ , substitute "b" "a"
335− , Substitute "b" "c"
338+ , substitute "b" "c"
338 test "#5" do
341 test "#5" do
339− Assert.equal 0 (typeVarPenalty $ l [ Substitute "a" "b"
342+ Assert.equal 0 (typeVarPenalty $ l [ substitute "a" "b"
340− , Substitute "b" "c"
343+ , substitute "b" "c"
341− , Substitute "c" "a"
344+ , substitute "c" "a"
344 test "#6" do
347 test "#6" do
345− Assert.equal 2 (typeVarPenalty $ l [ Substitute "a" "b"
348+ Assert.equal 2 (typeVarPenalty $ l [ substitute "a" "b"
346− , Substitute "a" "c"
349+ , substitute "a" "c"
347− , Substitute "a" "a"
350+ , substitute "a" "a"
350 test "#7" do
353 test "#7" do
351− Assert.equal 2 (typeVarPenalty $ l [ Substitute "a" "a"
354+ Assert.equal 2 (typeVarPenalty $ l [ substitute "a" "a"
352− , Substitute "b" "a"
355+ , substitute "b" "a"
353− , Substitute "c" "a"
356+ , substitute "c" "a"
356 test "#8" do
359 test "#8" do
357− Assert.equal 4 (typeVarPenalty $ l [ Substitute "a" "a"
360+ Assert.equal 4 (typeVarPenalty $ l [ substitute "a" "a"
358− , Substitute "b" "a"
361+ , substitute "b" "a"
359− , Substitute "c" "a"
362+ , substitute "c" "a"
360− , Substitute "a" "b"
363+ , substitute "a" "b"
361− , Substitute "a" "c"
364+ , substitute "a" "c"
362− , Substitute "a" "a"
365+ , substitute "a" "a"
365 test "#9" do
368 test "#9" do
366− Assert.equal 0 (typeVarPenalty $ l [ Substitute "a" "e"
369+ Assert.equal 0 (typeVarPenalty $ l [ substitute "a" "e"
367− , Substitute "b" "d"
370+ , substitute "b" "d"
368− , Substitute "c" "f"
371+ , substitute "c" "f"
371 suite "unification" do
374 suite "unification" do
372 test "instantiation #0" do
375 test "instantiation #0" do
373− let mVarQuery = QVar "m"
376+ let mVarQuery = qVar "m"
374− unitConstQuery = QConst "Unit"
377+ unitConstQuery = qConst "Unit"
376 Assert.assert "instantiation #0" $
379 Assert.assert "instantiation #0" $
377 (penalty unitConstQuery unitType < penalty mVarQuery unitType)
380 (penalty unitConstQuery unitType < penalty mVarQuery unitType)
379 test "generalization #0" do
382 test "generalization #0" do
380− let query = QVar "m"
383+ let query = qVar "m"
381 t1 = TypeVar "m"
384 t1 = TypeVar "m"
383 Assert.assert "qeneralization #0" $
386 Assert.assert "qeneralization #0" $
@@ -387,19 +390,37 @@ tests = do
387l :: forall f. Foldable f => (forall a. f a -> List a)
390l :: forall f. Foldable f => (forall a. f a -> List a)
388l = List.fromFoldable
391l = List.fromFoldable
390−nl :: forall t5 t6. Foldable t6 => t5 -> t6 t5 -> NonEmptyList t5
393+nl
399+ -> NonEmptyList Identifier
391−nl x rst = NonEmptyList.cons' x $ List.fromFoldable rst
400+nl x rst = NonEmptyList.cons' (Identifier x) $ List.fromFoldable (rst <#> Identifier)
393unitType :: Type
402unitType :: Type
394unitType = TypeConstructor (QualifiedName { moduleNameParts: []
403unitType = TypeConstructor (QualifiedName { moduleNameParts: []
395− , name: "Unit"
404+ , name: Identifier "Unit"
398countFreeVars :: TypeQuery -> Int
407countFreeVars :: TypeQuery -> Int
399countFreeVars = getFreeVariables >>> Set.size
408countFreeVars = getFreeVariables >>> Set.size
401qname :: Array String -> String -> QualifiedName
410qname :: Array String -> String -> QualifiedName
402−qname m n = QualifiedName { moduleNameParts: m, name: n }
411+qname m n = QualifiedName { moduleNameParts: m, name: Identifier n }
404constr :: QualifiedName -> Array Type -> Constraint
413constr :: QualifiedName -> Array Type -> Constraint
405constr c a = Constraint { constraintClass: c, constraintArgs: a }
414constr c a = Constraint { constraintClass: c, constraintArgs: a }
416+qVar :: String -> TypeQuery
417+qVar = QVar <<< Identifier
419+qConst :: String -> TypeQuery
420+qConst = QConst <<< Identifier
422+qConstraint :: String -> List TypeQuery -> TypeQuery -> TypeQuery
423+qConstraint = QConstraint <<< Identifier
425+substitute :: String -> String -> Substitution
426+substitute a b = Substitute (Identifier a) (Identifier b)