@@ -72,15 +72,7 @@ mkTypedTerm sc trm = do
72
72
-- This operation fails if the type of the argument does
73
73
-- not match the function.
74
74
applyTypedTerm :: SharedContext -> TypedTerm -> TypedTerm -> IO TypedTerm
75
- applyTypedTerm sc (TypedTerm _tp t1) (TypedTerm _ t2) =
76
- do trm <- scApply sc t1 t2
77
- ty <- scTypeCheckError sc trm
78
- ct <- scCryptolType sc ty
79
- let ttt = case ct of
80
- Nothing -> TypedTermOther ty
81
- Just (Left k) -> TypedTermKind k
82
- Just (Right t) -> TypedTermSchema (C. tMono t)
83
- return (TypedTerm ttt trm)
75
+ applyTypedTerm sc x y = applyTypedTerms sc x [y]
84
76
85
77
-- | Apply a 'TypedTerm' to a list of arguments. This operation fails
86
78
-- if the first 'TypedTerm' does not have a function type of
@@ -90,6 +82,10 @@ applyTypedTerms :: SharedContext -> TypedTerm -> [TypedTerm] -> IO TypedTerm
90
82
applyTypedTerms sc (TypedTerm _ fn) args =
91
83
do trm <- foldM (scApply sc) fn (map ttTerm args)
92
84
ty <- scTypeCheckError sc trm
85
+ -- NB, scCryptolType can behave in strange ways due to the non-injectivity
86
+ -- of the mapping from Cryptol to SAWCore types. Perhaps we would be better
87
+ -- to combine the incoming type information instead of applying and then
88
+ -- reconstructing here.
93
89
ct <- scCryptolType sc ty
94
90
let ttt = case ct of
95
91
Nothing -> TypedTermOther ty
0 commit comments