Closed polybeandip closed 3 months ago
I guess I'm not too too worried, because if a user does create a divergence, they will quickly be forced to bring the types back into tandem. This is because we have a method that converts from Ast.policy to Policy.t, and OCaml will yell at them if that method is no longer kosher.
Agreed, I had this exact thought and came to the same conclusion!
Shall we just flag this fact with comments in both the type declarations (something like, Changes to this type must also be reflected in
in )?
Done in a6de267.
In the spirit of #47, here's more cleanup! Previously, we had two "policy functions" living in different modules:
eval : Ast.program -> Ast.policy
in moduleEval
string_of_policy : Ast.policy -> string
in moduleUtil
This PR moves these two functions into a single new module
Policy
. There's two nice upshots to this:Eval
andUtil
.Policy.t
, which isAst.policy
without theVar
constructor. This way, we don't need to raise exceptions to handle theVar
case when pattern matching: for instance, notice exceptionNonTerminal
doesn't exist anymore andPolicy.to_string
never raises an exception.