This : Prelude> let f = (\x -> return "something went wrong") :: IOError -> IO String Prelude> let t = return $ show $ "too short list" !! 100 :: IO String Prelude> catch t f "*** Exception: Prelude.(!!): index too large
doesn't work. kind regards, Pieter On Tue, Sep 9, 2008 at 10:35 PM, Pieter Laeremans <[EMAIL PROTECTED]>wrote: > Woops , I hit the "send" button to early. > The java approach to locate the error would be > > try { ... }catch(Exception e ){ > // log error > throw new RuntimeException(e); > } > > ... > > What 's the best equivalent haskell approach ? > > thanks in advance, > > Pieter > > > On Tue, Sep 9, 2008 at 10:30 PM, Pieter Laeremans <[EMAIL PROTECTED]>wrote: > >> Hello, >> I've written a cgi script in haskell, it crashes sometimes with the error >> message Prelude . tail : empty list >> >> In Java we would use this approach to log the erro >> >> try { >> >> } catch (Exception e) { >> >> >> } >> >> >> -- >> Pieter Laeremans <[EMAIL PROTECTED]> >> >> "The future is here. It's just not evenly distributed yet." W. Gibson >> > > > > -- > Pieter Laeremans <[EMAIL PROTECTED]> > > "The future is here. It's just not evenly distributed yet." W. Gibson > -- Pieter Laeremans <[EMAIL PROTECTED]> "The future is here. It's just not evenly distributed yet." W. Gibson
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe