Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
types returned from exceptions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Julian Assange <proff@i...>
Subject: types returned from exceptions

I am trying to do the following:

let f x =
  let foo =
      f2 x
      err -> exit 1

However, there is a type conflict between (f2 x) and (exit 1). exit is defined as

        int -> 'a

and seems intended to be used polymorphically for situations like this. Is there
a way of forcing the return type of exit to match that of (f2 x)? Is there a better
way of coding this type of construct?