Version française
Home     About     Download     Resources     Contact us    
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 =
    try
      f2 x
    with
      err -> exit 1
  in 
    ..

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? 

Cheers,
Julian.