# libtmux for Haskell

Source: https://libtmux.org/en/haskell/latest/

> libtmux for Haskell, version latest.

![](https://libtmux.org/en/brand/haskell/library/logo.svg)

Haskell-based tmux client

Typed tmux values for Haskell. Parse tmux entity IDs, validate dimensions and indices, and check stable tmux releases with pure Haskell functions

```haskell
{-# LANGUAGE OverloadedStrings #-}


-- | Construct tmux domain values without starting a process
-- or contacting a server.
module Main (main) where


import LibTmux.Id (parseWindowId, renderWindowId)
import LibTmux.Value (dimensionValue, mkDimension)
import LibTmux.Version (parseVersion, renderVersion, requireSupported)


main :: IO ()
main = do
  version <- either (fail . show) pure $
    parseVersion "tmux 3.3a\n" >>= requireSupported
  window <- either (fail . show) pure (parseWindowId "@17")
  width <- either (fail . show) pure (mkDimension 120)
  print (renderVersion version, renderWindowId window, dimensionValue width)
```

Run this example

Linux x86_64, GHC 9.14.1, Cabal 3.18.2.0, Git, a C11 compiler, and network access to GitHub and Hackage for source dependencies. No running tmux server is required.

Save the program above as `Main.hs` in a new directory, along with the files below.

This program validates supplied values and prints the result. It does not start tmux or create resources requiring cleanup.

libtmux-typed-values.cabal

```text
cabal-version: 3.18
name: libtmux-typed-values
version: 0.0.0
build-type: Simple
license: MIT


executable typed-values
  main-is: Main.hs
  default-language: GHC2024
  ghc-options: -Wall -Werror
  build-depends:
    base >=4.22 && <4.23,
    libtmux-haskell ^>=0.1.0.0
```

cabal.project

```text
packages: .
index-state: 2026-11-06T00:00:00Z


source-repository-package
  type: git
  location: https://github.com/libtmux/libtmux-haskell
  tag: 581f0ee45016ffb2283366bb1edc1658df26c5ed
```

### Setup and run

```bash
cabal update
```

```bash
cabal run --verbose=0 typed-values
```

### Expected output

```text
("3.3a","@17",120)
```

[Core Library documentation →](https://libtmux.org/en/haskell/latest/core/)[Haskell guides →](https://libtmux.org/en/haskell/latest/guides/)

### Install `libtmux-haskell`

**cabal.project**

```text
packages: .

source-repository-package
  type: git
  location: https://github.com/libtmux/libtmux-haskell
  tag: "581f0ee45016ffb2283366bb1edc1658df26c5ed"
```

Save as cabal.project and add libtmux-haskell ^>=0.1.0.0 to your component's build-depends. Requires Linux x86_64, GHC 9.14.1 and Cabal 3.18.2.0. The core package is available from source; it is not published on Hackage.

### [Guides](https://libtmux.org/en/haskell/latest/guides/)

[Task guides for Haskell.](https://libtmux.org/en/haskell/latest/guides/)

## API references

### [Official reference](https://libtmux.org/en/haskell/latest/reference/)

[Haskell API signatures and documentation, with links to related guides and APIs in other languages.](https://libtmux.org/en/haskell/latest/reference/)

[All Haskell versions and install instructions](https://libtmux.org/en/haskell/)
