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

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to