Shell programming, Haskell-style

Version on this page:1.3.6
LTS Haskell 22.29:1.6.2@rev:3
Stackage Nightly 2024-07-19:1.6.2@rev:3
Latest on Hackage:1.6.2@rev:3

See all snapshots turtle appears in

BSD-3-Clause licensed by Gabriel Gonzalez
Maintained by [email protected]
This version can be pinned in stack with:turtle-1.3.6@sha256:64cd5a86f6affdd9f648d570e6a2159f0d5823a59fbee2a3d39a4e5ad15c25b1,4669

turtle is a reimplementation of the Unix command line environment in Haskell so that you can use Haskell as both a shell and a scripting language.

Features include:

  • Batteries included: Command an extended suite of predefined utilities

  • Interoperability: You can still run external shell commands

  • Portability: Works on Windows, OS X, and Linux

  • Exception safety: Safely acquire and release resources

  • Streaming: Transform or fold command output in constant space

  • Patterns: Use typed regular expressions that can parse structured values

  • Formatting: Type-safe printf-style text formatting

  • Modern: Supports text and system-filepath

Read Turtle.Tutorial for a detailed tutorial or Turtle.Prelude for a quick-start guide

turtle is designed to be beginner-friendly, but as a result lacks certain features, like tracing commands. If you feel comfortable using turtle then you should also check out the Shelly library which provides similar functionality.



  • Increase upper bound on foldl


  • Bug fix: cptree now correctly copies files instead of creating directories of the same name
  • Increase upper bound on criterion


  • Bug fix: Change textToLines to behave like Data.Text.splitOn "\n" instead of Data.Text.unlines
    • This fixes weird behavior around handling empty strings. splitOn does the right thing, but unlines does not. For example, this indirectly fixes a regression in sed, which would discard empty lines
  • Bug fix: which/whichAll now behave correctly on Windows
  • Add new cptree/single utilities
  • Documentation fixes


  • Fix bugs in subprocess management
  • Generalize type of repr to return any type that implements IsString
  • Add optLine, argLine, and l utilities to simplify working with Lines


  • find no longer follows symlinks
  • Increase upper bound on directory


  • BREAKING CHANGE: Several utilities now produce and consume Lines instead of Text
    • The purpose of this change is to fix a very common source of confusion for new users about which utilities are line-aware
    • Most of the impact on existing code is just changing the types by replacing Text with Line in the right places. The change at the term level should be small (based on the changes to the tutorial examples)
  • BREAKING CHANGE: Description now wraps a Doc instead of Text
    • In the most common case where users use string literals this has no effect
  • New Turtle.Bytes module that provides ByteString variations on subprocess runners
  • Fix du reporting incorrect sizes for directories
  • Add pushd, stat, lstat, which, procStrictWithErr, shellStrictWithErr, onFiles, header, subcommandGroup, and parallel
  • Backport need to GHC 7.6.3
  • Fix missing help text for option parsers
  • Fix bugs in subprocess management


  • Increase upper bound on time and transformers
  • Fix incorrect lower bound for base


  • Increase upper bound on clock dependency


  • Generalize several types to use MonadManaged
  • Generalize type of printf to use MonadIO
  • Add system, and copymod
  • Fix rmtree to more accurately match behavior of rm -r


  • Add printf, utc, procs, and shells


  • Generalize type of d format specifier to format any Integral type
  • Add inprocWithErr, inShellWithErr, inplace, and sz


  • Add subcommand and testpath
  • Use line buffering for Text-based subprocesses


  • Re-export with
  • Add begins, ends, contains, lowerBounded, mktempfile, nl, paste endless, lsif, and cut
  • Fix subprocess management bugs


  • Fix subprocess management bugs


  • BREAKING CHANGE: du now returns a Size instead of an Integer
  • New Turtle.Options module that provides convenient utilities for options parsing
  • Add hostname, outhandle, stderr, cache, countChars, countWords, and countLines
  • Fix subprocess management bugs


  • Add bounded, upperBounded, procStrict, shellStrict, arguments
  • Add several Permissions-related commands
  • Generalize several types to MonadIO


  • BREAKING CHANGE: Remove Floating/Fractional instances for Pattern and Shell
  • BREAKING CHANGE: Change behavior of Num instance for Pattern and Shell
  • Re-export (&)
  • Add asciiCI, (.||.), (.&&.), strict


  • Add fp format specifier
  • Add chars/chars high-efficiency parsing primitives
  • Fix bugs in path handling


  • Generalize type of die
  • Fix doctest


  • Initial release