# Rust has no Exceptions?

**URL:** <https://discourse.haskell.org/t/rust-has-no-exceptions/10729>\
**Category:** Learn\
**Created:** [November 13, 2024, 1:10pm UTC](https://discourse.haskell.org/t/rust-has-no-exceptions/10729 "2024-11-13T13:10:14Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

**Author:** ![atravers](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@atravers](https://discourse.haskell.org/u/atravers)\
**Post date:** [November 14, 2024, 5:54am UTC](https://discourse.haskell.org/t/rust-has-no-exceptions/10729/22 "2024-11-14T05:54:22Z")

</div>

> [@mmport80](#):
>
> But apparently idiomatic [Rust] code more or less assumes reliable type definitions… I have to say this is very nice, and something I wish Haskell put (even) more attention on.

As it so happened, someone recently expressed a similar interest for I/O:

> [@IO without exceptions?](http://discourse.haskell.org/t/io-without-exceptions/9922):
>
> About a year ago, I wrote a proposal for IOE, enabling checked exceptions in IO. It got fairly negative reactions, which is fine. This is a smaller change that I think might be less controversial than that. Currently, we have IO that represents both impurity and the ability to throw exceptions. Here, I’m only talking about exceptions in the Haskell runtime; OOM and other catastrophic errors can also happen in pure code, so I’m not worried about those. What if we had some new type e.g. UIO that …

But in the context of Haskell, what exactly is _“idiomatic code”_ ?

- effect-free expressions? Haskell is nonstrict, which is why **it’s** so nice to program in. Hence the lack of those effects `(`unless something `unsafe...` is being used`)-;`

- the absence of effect-centric actions (functorial, applicative, monadic, arrow, comonadic _et al_ )? Alright, just provide some other way to manage exceptions or other effects in Haskell (and remember: even _effect systems_ rely on one or more of those interfaces - usually the monadic one).

Otherwise, perhaps this could be of interest:

> **[dialogue](https://hackage.haskell.org/package/dialogue)**
>
> I/O in Haskell Report 1.2

(with abstract monadic I/O first appearing officially in [Haskell 1.3](https://www.haskell.org/definition/haskell-report-1.3.ps.gz)).

Instead of `IO a`, a program would have the type:

```haskell
type Dialogue = [Response] -> [Request]

```

…it would be one big effect-free expression, with all that imperative ugliness confined to the interpreter (which does use abstract monadic I/O). But since Haskell 2010 also provides an FFI:

```haskell
foreign import ccall runDialogue :: Dialogue -> IO ()

```

`(`if the in-Haskell interpeter is too slow `;-)`

---

_[View the full topic](https://discourse.haskell.org/t/rust-has-no-exceptions/10729)._
