Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 667 Bytes

destruct_exn.md

File metadata and controls

39 lines (27 loc) · 667 Bytes

Its essential is

external destruct : 'b -> (exn -> 'a) 

However it does not prevent things like

destruct v begin fun exn -> 
   Js.log exn ; 
   match exn with 
   | .. 
   | .. 

Here it forces us to answer whether v is exception or not,

while such syntax below does not need us answer v is exception or not, it just asks us to answer it matches a branch of exception or not which can be done in a sound way.

match%exn v with 
| .. 
| .. 

However, we need make sure such cases not happen

match%exn v with 
| e -> ...

Or any vagous pattern which needs us to answer if it is an exception or not