Skip to content

Commit 22b4332

Browse files
committed
Hide implementation details of type contexts
1 parent 37f6245 commit 22b4332

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

hackett-lib/hackett/private/base.rkt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,7 @@
241241
#:literal-sets [type-literals]
242242
[(#%type:wobbly-var x^)
243243
#:with [x1^ x2^] (generate-temporaries #'[x^ x^])
244-
(modify-type-context
245-
#{snoc % (ctx:solution #'x^ (template
246-
(?->* (#%type:wobbly-var x1^) (#%type:wobbly-var x2^))))})
244+
(type-inst-l! #'x^ (template (?->* (#%type:wobbly-var x1^) (#%type:wobbly-var x2^))))
247245
(values (quasisyntax/loc src
248246
(lazy- (#%app- (force- #,e_fn) #,(τ⇐! e_arg #'(#%type:wobbly-var x1^)))))
249247
#'(#%type:wobbly-var x2^))]

hackett-lib/hackett/private/typecheck.rkt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,9 @@
3131
hackett/private/util/list
3232
hackett/private/util/stx)
3333

34-
(provide (contract-out [struct ctx:solution ([x^ identifier?] [t type?])])
35-
type? type=? constr? type-mono? type-vars^ type->string
34+
(provide type? type=? constr? type-mono? type-vars^ type->string
3635
generalize inst insts type<:/full! type<:/elaborate! type<:! type-inst-l! type-inst-r!
37-
ctx-elem? ctx? ctx-elem=? ctx-member? ctx-remove
38-
ctx-find-solution current-ctx-solution apply-subst apply-current-subst
36+
apply-subst apply-current-subst
3937
current-type-context modify-type-context
4038
attach-type attach-expected get-type get-expected apply-current-subst-in-tooltips
4139
make-typed-var-transformer
@@ -155,11 +153,9 @@
155153

156154
(define/contract (ctx-find-solution ctx x^)
157155
(-> ctx? identifier? (or/c type? #f))
158-
(and~> (findf #{and (ctx:solution? %) (free-identifier=? x^ (ctx:solution-x^ %))} ctx)
156+
(and~> (findf #{and (ctx:solution? %)
157+
(free-identifier=? x^ (ctx:solution-x^ %))} ctx)
159158
ctx:solution-t))
160-
(define/contract (current-ctx-solution x^)
161-
(-> identifier? (or/c type? #f))
162-
(ctx-find-solution (current-type-context) x^))
163159

164160
(define/contract (apply-subst ctx t)
165161
(-> ctx? type? type?)

hackett-lib/hackett/private/typeclass.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@
273273
#t]
274274
[[(#%type:wobbly-var x^) t]
275275
#:when (type-mono? #'t)
276-
(modify-type-context #{snoc % (ctx:solution #'x^ #'t)})
276+
(type-inst-l! #'x^ #'t)
277277
#t]
278278
[[(#%type:con a) (#%type:con b)]
279279
#:when (free-identifier=? #'a #'b)

0 commit comments

Comments
 (0)