Exeption handling in GHC
Hal Daume III
hdaume@ISI.EDU
Fri, 24 Jan 2003 13:59:55 -0800 (PST)
You're probably using IO (or System.IO) try. If you want imprecise
exceptions (I think that's the right name), you want to use
Control.Exception versions of try/catch/bracket/etc.
Prelude> :m IO
Prelude IO> :t try
forall a. IO a -> IO (Either GHC.IOBase.Exception a)
Prelude IO> try (error "a")
*** Exception: a
Prelude IO> :m Control.Exception
Prelude Control.Exception> try (error "a")
Prelude Control.Exception> it
Left a
HTH
- Hal
--
Hal Daume III
"Computer science is no more about computers | hdaume@isi.edu
than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume
On Fri, 24 Jan 2003, Sarah Thompson wrote:
> Hi all,
>
> I'm trying to get exception handling working in GHC, but don't seem to be
> able to make it work. Am I likely to be missing a compiler switch, or
> something?
>
> Cutting things down to basics, I'd have thought that the following
> expression (typed at the ghci command prompt) should work:
>
> try (error "x")
>
> but the result is
>
> *** Exception: x
>
> I seem to get the same problem with compiled code. Any ideas anyone?
>
> TIA,
> Sarah
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>