Hello, I'm trying to implement a scala concept "partial application" in which one can chains pattern matching function. If the first failed, the second is tried.
It seems it is impossible to give an exception as argument to a function.



exception Nothing;;

let (<|||>) a b = try a with                                                                                                                                                                                                        
  | Nothing ->  (try b with                                                                                                                                                                                                           
                   | Nothing -> raise Nothing);;                                                                                                                                                                                      
val ( <|||> ) : 'a -> 'a -> 'a = <fun> 


(raise Nothing) <|||> "jj";;                                                                                                                                                                                                        
Exception: Nothing. 


But if I try :
try (raise Nothing)  with                                                                                                                                                                                                           
  | Nothing ->  (try "jj"with                                                                                                                                                                                                         
                   | Nothing -> raise Nothing);;                                                                                                                                                                                      
- : string = "jj" 

Is there a workaround ?


Regards,
P-A
--
---------------------
https://twitter.com/#!/ontologiae/
http://linuxfr.org/users/montaigne