# LibTmux.Server.tryTmux

- **Package:** libtmux-haskell
- **Language:** Haskell
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-haskell/blob/663e212622a02aa74a9bdc8ff71e2b45fcb1d4d5/src/LibTmux/Server.hs#L245
- **Page:** https://libtmux.org/en/haskell/latest/reference/libtmux-server-v-trytmux/

```haskell
tryTmux
  :: IO a
  -> IO (Either (ExceptionWithContext TmuxException) a)
```

Signature types: [`IO`](https://hackage.haskell.org/package/base-4.22.0.0/docs/Prelude.html#t:IO), [`Either`](https://hackage.haskell.org/package/base-4.22.0.0/docs/Data-Either.html#t:Either), [`ExceptionWithContext`](https://hackage.haskell.org/package/base-4.22.0.0/docs/Control-Exception.html#t:ExceptionWithContext), [`TmuxException`](/en/haskell/latest/reference/libtmux-server-t-tmuxexception/).

Catch library failures with their exception context. Retain this value
 when handling an error so cleanup and capture owners stay reachable.
 Application exceptions and asynchronous cancellation propagate.

## Referenced declarations

- [`LibTmux.Server.TmuxException`](/en/haskell/latest/reference/libtmux-server-t-tmuxexception/) (data type)

## Guides

Pages that discuss `tryTmux`.

- [Capture and navigate](/en/haskell/latest/guides/capture/)
- [Rename and set pane titles](/en/haskell/latest/guides/mutations/)
- [Typed queries](/en/haskell/latest/guides/query/)
- [Shared Runtime scopes](/en/haskell/latest/guides/shared-runtime/)
