DeepSpec / InteractionTrees

A Library for Representing Recursive and Impure Programs in Coq
MIT License
204 stars 51 forks source link

Notation "~>" for natural transformations and simplified Fix #51

Closed Lysxia closed 5 years ago

Lysxia commented 5 years ago
Zdancewic commented 5 years ago

This cleanup looks great! We should merge to master as soon as we can.

gmalecha commented 5 years ago

I actually had some thoughts about this. I can try to propose them in another pull request. In particular, I don't really understand the benefit of the handleF abstractions. Pattern matches seem easy to understand and the different variants of handleF seem strange.

Lysxia commented 5 years ago

The point is to make the common structure between the various interpreters more explicit. And, while pattern-matches are easy to understand, their syntax is quite heavyweight, especially in proofs where we have little control over formatting. The pattern of handleF is common enough to be worthwhile to abstract, and it's not really much of an abstraction, rather it is a thin layer of sugar.

match t.(observe) with
| RetF r => Ret r
| TauF t => Tau (interp f _ t)
| Vis e k => vis e (fun x => interp f _ k)
end

=

handleF (interp f _)
  (fun _ e k => vis e (fun x => interp f _ k))
  t.(observe)