Safe Haskell | None |
---|---|
Language | Haskell2010 |
Turtle
Contents
Description
See Turtle.Tutorial to learn how to use this library or Turtle.Prelude for a quick-start guide.
Here is the recommended way to import this library:
{-# LANGUAGE OverloadedStrings #-} import Turtle import Prelude hiding (FilePath)
This module re-exports the rest of the library and also re-exports useful
modules from base
:
Turtle.Format provides type-safe string formatting
Turtle.Pattern provides Pattern
s, which are like more powerful regular
expressions
Turtle.Shell provides a Shell
abstraction for building streaming,
exception-safe pipelines
Turtle.Prelude provides a library of Unix-like utilities to get you started with basic shell-like programming within Haskell
Control.Applicative provides two classes:
Applicative
, which works withFold
,Pattern
,Managed
, andShell
Alternative
, which works withPattern
andShell
Control.Monad provides two classes:
Control.Monad.IO.Class provides one class:
Data.Monoid provides one class:
Control.Monad.Managed.Safe provides Managed
resources
Filesystem.Path.CurrentOS provides FilePath
-manipulation utilities
Additionally, you might also want to import the following modules qualified:
- Options.Applicative from
optparse-applicative
for command-line option parsing - Control.Foldl (for predefined folds)
- Control.Foldl.Text (for
Text
-specific folds) - Data.Text (for
Text
-manipulation utilities) - Data.Text.IO (for reading and writing
Text
) - Filesystem.Path.CurrentOS (for the remaining
FilePath
utilities)
- module Turtle.Format
- module Turtle.Pattern
- module Turtle.Shell
- module Turtle.Prelude
- module Control.Applicative
- module Control.Monad
- module Control.Monad.IO.Class
- module Data.Monoid
- module Control.Monad.Managed.Safe
- module Filesystem.Path.CurrentOS
- data Fold a b :: * -> * -> * where
- data FoldM m a b :: (* -> *) -> * -> * -> * where
- data Text :: *
- data UTCTime :: *
- data NominalDiffTime :: *
- data Handle :: *
- data ExitCode :: *
- class IsString a where
- fromString :: String -> a
Modules
module Turtle.Format
module Turtle.Pattern
module Turtle.Shell
module Turtle.Prelude
module Control.Applicative
module Control.Monad
module Control.Monad.IO.Class
module Data.Monoid
module Control.Monad.Managed.Safe
module Filesystem.Path.CurrentOS
data Fold a b :: * -> * -> * where
Efficient representation of a left fold that preserves the fold's step function, initial accumulator, and extraction function
This allows the Applicative
instance to assemble derived folds that
traverse the container only once
data Text :: *
A space efficient, packed, unboxed Unicode text type.
Instances
IsList Text | |
Eq Text | |
Data Text | This instance preserves data abstraction at the cost of inefficiency. We omit reflection services for the sake of data abstraction. This instance was created by copying the updated behavior of
The original discussion is archived here: could we get a Data instance for Data.Text.Text? The followup discussion that changed the behavior of |
Ord Text | |
Read Text | |
Show Text | |
IsString Text | |
Monoid Text | |
NFData Text | |
Typeable * Text | |
type Item Text = Char |
data UTCTime :: *
This is the simplest representation of UTC. It consists of the day number, and a time offset from midnight. Note that if a day has a leap second added to it, it will have 86401 seconds.
data NominalDiffTime :: *
This is a length of time, as measured by UTC. Conversion functions will treat it as seconds. It has a precision of 10^-12 s. It ignores leap-seconds, so it's not necessarily a fixed amount of clock time. For instance, 23:00 UTC + 2 hours of NominalDiffTime = 01:00 UTC (+ 1 day), regardless of whether a leap-second intervened.
data Handle :: *
Haskell defines operations to read and write characters from and to files,
represented by values of type Handle
. Each value of this type is a
handle: a record used by the Haskell run-time system to manage I/O
with file system objects. A handle has at least the following properties:
- whether it manages input or output or both;
- whether it is open, closed or semi-closed;
- whether the object is seekable;
- whether buffering is disabled, or enabled on a line or block basis;
- a buffer (whose length may be zero).
Most handles will also have a current I/O position indicating where the next
input or output operation will occur. A handle is readable if it
manages only input or both input and output; likewise, it is writable if
it manages only output or both input and output. A handle is open when
first allocated.
Once it is closed it can no longer be used for either input or output,
though an implementation cannot re-use its storage while references
remain to it. Handles are in the Show
and Eq
classes. The string
produced by showing a handle is system dependent; it should include
enough information to identify the handle for debugging. A handle is
equal according to ==
only to itself; no attempt
is made to compare the internal state of different handles for equality.
data ExitCode :: *
Defines the exit codes that a program can return.
Constructors
ExitSuccess | indicates successful termination; |
ExitFailure Int | indicates program failure with an exit code. The exact interpretation of the code is operating-system dependent. In particular, some values may be prohibited (e.g. 0 on a POSIX-compliant system). |
class IsString a where
Class for string-like datastructures; used by the overloaded string extension (-XOverloadedStrings in GHC).
Methods
fromString :: String -> a