@@ -58,14 +58,6 @@ rule Type Type = return Type
58
58
rule Kind Kind = return Kind
59
59
rule Kind Type = return Type
60
60
61
- judgmentallyEqual :: Eq a => Expr s a -> Expr t a -> Bool
62
- judgmentallyEqual eL0 eR0 = alphaBetaNormalize eL0 == alphaBetaNormalize eR0
63
- where
64
- alphaBetaNormalize :: Expr s a -> Expr X a
65
- alphaBetaNormalize =
66
- Dhall.Core. alphaNormalize
67
- . Dhall.Core. normalize
68
-
69
61
{-| Type-check an expression and return the expression's type if type-checking
70
62
succeeds or an error if type-checking fails
71
63
@@ -131,7 +123,7 @@ typeWithA tpa = loop
131
123
Pi x _A _B -> return (x, _A, _B)
132
124
_ -> Left (TypeError ctx e (NotAFunction f tf))
133
125
_A' <- loop ctx a
134
- if judgmentallyEqual _A _A'
126
+ if Dhall.Core. judgmentallyEqual _A _A'
135
127
then do
136
128
let a' = Dhall.Core. shift 1 (V x 0 ) a
137
129
let _B' = Dhall.Core. subst (V x 0 ) a' _B
@@ -148,7 +140,7 @@ typeWithA tpa = loop
148
140
_ <- loop ctx _A0
149
141
let nf_A0 = Dhall.Core. normalize _A0
150
142
let nf_A1 = Dhall.Core. normalize _A1
151
- if judgmentallyEqual _A0 _A1
143
+ if Dhall.Core. judgmentallyEqual _A0 _A1
152
144
then return ()
153
145
else Left (TypeError ctx e (AnnotMismatch a0 nf_A0 nf_A1))
154
146
Nothing -> return ()
@@ -161,7 +153,7 @@ typeWithA tpa = loop
161
153
_ <- loop ctx t
162
154
163
155
t' <- loop ctx x
164
- if judgmentallyEqual t t'
156
+ if Dhall.Core. judgmentallyEqual t t'
165
157
then do
166
158
return t
167
159
else do
@@ -237,7 +229,7 @@ typeWithA tpa = loop
237
229
Const Type -> return ()
238
230
_ -> Left (TypeError ctx e (IfBranchMustBeTerm False z tz ttz))
239
231
240
- if judgmentallyEqual ty tz
232
+ if Dhall.Core. judgmentallyEqual ty tz
241
233
then return ()
242
234
else Left (TypeError ctx e (IfBranchMismatch y z ty tz))
243
235
return ty
@@ -335,7 +327,7 @@ typeWithA tpa = loop
335
327
_ -> Left (TypeError ctx e (InvalidListType t))
336
328
flip traverseWithIndex_ xs (\ i x -> do
337
329
t' <- loop ctx x
338
- if judgmentallyEqual t t'
330
+ if Dhall.Core. judgmentallyEqual t t'
339
331
then return ()
340
332
else do
341
333
let nf_t = Dhall.Core. normalize t
@@ -351,7 +343,7 @@ typeWithA tpa = loop
351
343
_ -> Left (TypeError ctx e (InvalidListType t))
352
344
flip traverseWithIndex_ xs (\ i x -> do
353
345
t' <- loop ctx x
354
- if judgmentallyEqual t t'
346
+ if Dhall.Core. judgmentallyEqual t t'
355
347
then return ()
356
348
else do
357
349
let nf_t = Dhall.Core. normalize t
@@ -369,7 +361,7 @@ typeWithA tpa = loop
369
361
App List er -> return er
370
362
_ -> Left (TypeError ctx e (CantListAppend r tr))
371
363
372
- if judgmentallyEqual el er
364
+ if Dhall.Core. judgmentallyEqual el er
373
365
then return (App List el)
374
366
else Left (TypeError ctx e (ListAppendMismatch el er))
375
367
loop _ ListBuild = do
@@ -410,7 +402,7 @@ typeWithA tpa = loop
410
402
_ -> Left (TypeError ctx e (InvalidOptionalType t))
411
403
forM_ xs (\ x -> do
412
404
t' <- loop ctx x
413
- if judgmentallyEqual t t'
405
+ if Dhall.Core. judgmentallyEqual t t'
414
406
then return ()
415
407
else do
416
408
let nf_t = Dhall.Core. normalize t
@@ -538,10 +530,10 @@ typeWithA tpa = loop
538
530
Just tX ->
539
531
case tX of
540
532
Pi _ tY' t' -> do
541
- if judgmentallyEqual tY tY'
533
+ if Dhall.Core. judgmentallyEqual tY tY'
542
534
then return ()
543
535
else Left (TypeError ctx e (HandlerInputTypeMismatch kY tY tY'))
544
- if judgmentallyEqual t t'
536
+ if Dhall.Core. judgmentallyEqual t t'
545
537
then return ()
546
538
else Left (TypeError ctx e (InvalidHandlerOutputType kY t t'))
547
539
_ -> Left (TypeError ctx e (HandlerNotAFunction kY tX))
@@ -577,10 +569,10 @@ typeWithA tpa = loop
577
569
Just tX ->
578
570
case tX of
579
571
Pi _ tY' t' -> do
580
- if judgmentallyEqual tY tY'
572
+ if Dhall.Core. judgmentallyEqual tY tY'
581
573
then return ()
582
574
else Left (TypeError ctx e (HandlerInputTypeMismatch kY tY tY'))
583
- if judgmentallyEqual t t'
575
+ if Dhall.Core. judgmentallyEqual t t'
584
576
then return ()
585
577
else Left (TypeError ctx e (HandlerOutputTypeMismatch kX t kY t'))
586
578
_ -> Left (TypeError ctx e (HandlerNotAFunction kY tX))
0 commit comments