Core LibraryunreleasedHome

Choose documentation 1

latest

Current version

latest
English

Unreleased libtmux-haskell has not been released. Its API may change during development. This site's structure and URLs may change too.

Edit this page on GitHub

Typed tmux values for Haskell

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

Install

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.

At a glance

ModuleProvides
LibTmux.Id Distinct session, physical-window and physical-pane IDs.
LibTmux.Value Positive dimensions and nonnegative contextual indices.
LibTmux.Version Parse stable tmux releases and check the supported release range.

What it does

{-# 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
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
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

cabal update
cabal run --verbose=0 typed-values

Expected output

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

Client, capture and mutation APIs are under development. The workspace library and CLI are planned as a separate package using the core. MCP is excluded from this port. Read the implementation status before choosing the package for automation.

Esc

Type to search.

Reference previewOpen reference