fix the computation of abstract expressions in the presence of implicit arguments

This commit is contained in:
krasimir
2011-01-08 20:55:58 +00:00
parent d9d00e172a
commit adbe9cd94d
3 changed files with 9 additions and 2 deletions

View File

@@ -354,7 +354,9 @@ apply sig env (EFun f) vs = case Map.lookup f (fst sig) of
Nothing -> VApp f vs
Nothing -> error ("unknown function "++showCId f)
apply sig env (EApp e1 e2) vs = apply sig env e1 (eval sig env e2 : vs)
apply sig env (EAbs _ x e) (v:vs) = apply sig (v:env) e vs
apply sig env (EAbs b x e) (v:vs) = case (b,v) of
(Implicit,VImplArg v) -> apply sig (v:env) e vs
(Explicit, v) -> apply sig (v:env) e vs
apply sig env (EMeta i) vs = case snd sig i of
Just e -> apply sig env e vs
Nothing -> VMeta i env vs
@@ -369,7 +371,9 @@ applyValue sig (VMeta i env vs0) vs = VMeta i env (vs0++vs)
applyValue sig (VGen i vs0) vs = VGen i (vs0++vs)
applyValue sig (VSusp i env vs0 k) vs = VSusp i env vs0 (\v -> applyValue sig (k v) vs)
applyValue sig (VConst f vs0) vs = VConst f (vs0++vs)
applyValue sig (VClosure env (EAbs b x e)) (v:vs) = apply sig (v:env) e vs
applyValue sig (VClosure env (EAbs b x e)) (v:vs) = case (b,v) of
(Implicit,VImplArg v) -> apply sig (v:env) e vs
(Explicit, v) -> apply sig (v:env) e vs
applyValue sig (VImplArg _) vs = error "implicit argument in function position"
-----------------------------------------------------

View File

@@ -8,3 +8,4 @@ ai <\x -> x : ({m},n : Node) -> Node>
ai <n1 : ({m} : Node) -> Node>
ai <? : ({m} : Node) -> Node>
ai <link id : Path n1 n1>
pt -compute <\{n} -> n : ({n} : Node) -> Node> {n1}

View File

@@ -31,3 +31,5 @@ Expression: <link {n1} {n1} (id {n1}) : Path n1 n1>
Type: Path n1 n1
Probability: 1.0
n1