Open andrejbauer opened 4 years ago
As it turns out, there are more problems than just printing:
We need to think about the top-level monad and the interaction between various effects.
Following OCaml, if a module raises an exception, it should be undefined.
The following top-level interaction is a bit worrisome:
# let secret = ref ML.None ;;
val secret :> ref (ML.option _α) = ref ML.None
# exception Die ;;
Exception Die is declared.
# module M = struct rule A type ;; secret := ML.Some A ;; raise Die ;; end ;;
Processing module M
Rule M.A is postulated.
- :> mlunit = ()
File "?", line 2, characters 57-65:
Runtime error: uncaught exception Die
# M.A ;;
File "?", line 2, characters 1-3:
Type error: unknown name M.A
# let (ML.Some ?illegal) = !secret ;;
val illegal :> _α = ⊢ M.A type
# illegal ;;
- :> _α = ⊢ M.A type
An
open
statement works forever for printing. It should only have an effect until the end of the module in which it appears.