Safe Haskell  None 

Language  Haskell2010 
See Turtle.Tutorial to learn how to use this library or Turtle.Prelude for a quickstart guide.
Here is the recommended way to import this library:
{# LANGUAGE OverloadedStrings #} import Turtle import Prelude hiding (FilePath)
This module reexports the rest of the library and also reexports useful
modules from base
:
Turtle.Format provides typesafe string formatting
Turtle.Pattern provides Pattern
s, which are like more powerful regular
expressions
Turtle.Shell provides a Shell
abstraction for building streaming,
exceptionsafe pipelines
Turtle.Prelude provides a library of Unixlike utilities to get you started with basic shelllike 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
optparseapplicative
for commandline 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)
Synopsis
 module Turtle.Format
 module Turtle.Pattern
 module Turtle.Options
 module Turtle.Shell
 module Turtle.Line
 module Turtle.Prelude
 class Functor f => Applicative (f :: Type > Type) where
 optional :: Alternative f => f a > f (Maybe a)
 (<$>) :: Functor f => (a > b) > f a > f b
 class Applicative f => Alternative (f :: Type > Type) where
 guard :: Alternative f => Bool > f ()
 join :: Monad m => m (m a) > m a
 mfilter :: MonadPlus m => (a > Bool) > m a > m a
 unless :: Applicative f => Bool > f () > f ()
 replicateM_ :: Applicative m => Int > m a > m ()
 forever :: Applicative f => f a > f b
 (<=<) :: Monad m => (b > m c) > (a > m b) > a > m c
 (>=>) :: Monad m => (a > m b) > (b > m c) > a > m c
 msum :: (Foldable t, MonadPlus m) => t (m a) > m a
 void :: Functor f => f a > f ()
 when :: Applicative f => Bool > f () > f ()
 class (Alternative m, Monad m) => MonadPlus (m :: Type > Type) where
 class Monad m => MonadIO (m :: Type > Type) where
 (<>) :: Semigroup a => a > a > a
 class Semigroup a => Monoid a where
 runManaged :: Managed () > IO ()
 with :: Managed a > (a > IO r) > IO r
 managed :: (forall r. (a > IO r) > IO r) > Managed a
 data Managed a
 data FilePath
 decodeString :: String > FilePath
 encodeString :: FilePath > String
 fromText :: Text > FilePath
 toText :: FilePath > Either Text Text
 splitExtension :: FilePath > (FilePath, Maybe Text)
 dropExtension :: FilePath > FilePath
 (<.>) :: FilePath > Text > FilePath
 hasExtension :: FilePath > Text > Bool
 extension :: FilePath > Maybe Text
 splitDirectories :: FilePath > [FilePath]
 collapse :: FilePath > FilePath
 stripPrefix :: FilePath > FilePath > Maybe FilePath
 commonPrefix :: [FilePath] > FilePath
 (</>) :: FilePath > FilePath > FilePath
 relative :: FilePath > Bool
 absolute :: FilePath > Bool
 basename :: FilePath > FilePath
 dirname :: FilePath > FilePath
 filename :: FilePath > FilePath
 parent :: FilePath > FilePath
 directory :: FilePath > FilePath
 root :: FilePath > FilePath
 data Fold a b where
 data FoldM (m :: Type > Type) a b where
 data Text
 data UTCTime
 data NominalDiffTime
 data Handle
 data ExitCode
 class IsString a where
 fromString :: String > a
 (&) :: a > (a > b) > b
 (<&>) :: Functor f => f a > (a > b) > f b
Modules
module Turtle.Format
module Turtle.Pattern
module Turtle.Options
module Turtle.Shell
module Turtle.Line
module Turtle.Prelude
class Functor f => Applicative (f :: Type > Type) where #
A functor with application, providing operations to
A minimal complete definition must include implementations of pure
and of either <*>
or liftA2
. If it defines both, then they must behave
the same as their default definitions:
(<*>
) =liftA2
id
liftA2
f x y = f<$>
x<*>
y
Further, any definition must satisfy the following:
 identity
pure
id
<*>
v = v composition
pure
(.)<*>
u<*>
v<*>
w = u<*>
(v<*>
w) homomorphism
pure
f<*>
pure
x =pure
(f x) interchange
u
<*>
pure
y =pure
($
y)<*>
u
The other methods have the following default definitions, which may be overridden with equivalent specialized implementations:
As a consequence of these laws, the Functor
instance for f
will satisfy
It may be useful to note that supposing
forall x y. p (q x y) = f x . g y
it follows from the above that
liftA2
p (liftA2
q u v) =liftA2
f u .liftA2
g v
If f
is also a Monad
, it should satisfy
(which implies that pure
and <*>
satisfy the applicative functor laws).
Lift a value.
(<*>) :: f (a > b) > f a > f b infixl 4 #
Sequential application.
A few functors support an implementation of <*>
that is more
efficient than the default one.
liftA2 :: (a > b > c) > f a > f b > f c #
Lift a binary function to actions.
Some functors support an implementation of liftA2
that is more
efficient than the default one. In particular, if fmap
is an
expensive operation, it is likely better to use liftA2
than to
fmap
over the structure and then use <*>
.
(*>) :: f a > f b > f b infixl 4 #
Sequence actions, discarding the value of the first argument.
(<*) :: f a > f b > f a infixl 4 #
Sequence actions, discarding the value of the second argument.
Instances
Applicative []  Since: base2.1 
Applicative Maybe  Since: base2.1 
Applicative IO  Since: base2.1 
Applicative Par1  Since: base4.9.0.0 
Applicative Q  
Applicative Concurrently  
Defined in Control.Concurrent.Async pure :: a > Concurrently a # (<*>) :: Concurrently (a > b) > Concurrently a > Concurrently b # liftA2 :: (a > b > c) > Concurrently a > Concurrently b > Concurrently c # (*>) :: Concurrently a > Concurrently b > Concurrently b # (<*) :: Concurrently a > Concurrently b > Concurrently a #  
Applicative Complex  Since: base4.9.0.0 
Applicative Min  Since: base4.9.0.0 
Applicative Max  Since: base4.9.0.0 
Applicative First  Since: base4.9.0.0 
Applicative Last  Since: base4.9.0.0 
Applicative Option  Since: base4.9.0.0 
Applicative ZipList  f '<$>' 'ZipList' xs1 '<*>' ... '<*>' 'ZipList' xsN = 'ZipList' (zipWithN f xs1 ... xsN) where (\a b c > stimes c [a, b]) <$> ZipList "abcd" <*> ZipList "567" <*> ZipList [1..] = ZipList (zipWith3 (\a b c > stimes c [a, b]) "abcd" "567" [1..]) = ZipList {getZipList = ["a5","b6b6","c7c7c7"]} Since: base2.1 
Applicative Identity  Since: base4.8.0.0 
Applicative STM  Since: base4.8.0.0 
Applicative First  Since: base4.8.0.0 
Applicative Last  Since: base4.8.0.0 
Applicative Dual  Since: base4.8.0.0 
Applicative Sum  Since: base4.8.0.0 
Applicative Product  Since: base4.8.0.0 
Applicative Down  Since: base4.11.0.0 
Applicative ReadPrec  Since: base4.6.0.0 
Applicative ReadP  Since: base4.6.0.0 
Applicative NonEmpty  Since: base4.9.0.0 
Applicative Put  
Applicative Tree  
Applicative Seq  Since: containers0.5.4 
Applicative Managed  
Applicative Optional  
Applicative ReadM  
Applicative Parser  
Applicative ParserM  
Applicative ParserResult  
Defined in Options.Applicative.Types pure :: a > ParserResult a # (<*>) :: ParserResult (a > b) > ParserResult a > ParserResult b # liftA2 :: (a > b > c) > ParserResult a > ParserResult b > ParserResult c # (*>) :: ParserResult a > ParserResult b > ParserResult b # (<*) :: ParserResult a > ParserResult b > ParserResult a #  
Applicative SmallArray  
Defined in Data.Primitive.SmallArray pure :: a > SmallArray a # (<*>) :: SmallArray (a > b) > SmallArray a > SmallArray b # liftA2 :: (a > b > c) > SmallArray a > SmallArray b > SmallArray c # (*>) :: SmallArray a > SmallArray b > SmallArray b # (<*) :: SmallArray a > SmallArray b > SmallArray a #  
Applicative Array  
Applicative Id  
Applicative Box  
Applicative Stream  
Applicative P  Since: base4.5.0.0 
Applicative Pattern Source #  
Applicative Shell Source #  
Applicative (Either e)  Since: base3.0 
Applicative (U1 :: Type > Type)  Since: base4.9.0.0 
Monoid a => Applicative ((,) a)  For tuples, the ("hello ", (+15)) <*> ("world!", 2002) ("hello world!",2017) Since: base2.1 
Applicative (ST s)  Since: base4.4.0.0 
Monad m => Applicative (WrappedMonad m)  Since: base2.1 
Defined in Control.Applicative pure :: a > WrappedMonad m a # (<*>) :: WrappedMonad m (a > b) > WrappedMonad m a > WrappedMonad m b # liftA2 :: (a > b > c) > WrappedMonad m a > WrappedMonad m b > WrappedMonad m c # (*>) :: WrappedMonad m a > WrappedMonad m b > WrappedMonad m b # (<*) :: WrappedMonad m a > WrappedMonad m b > WrappedMonad m a #  
Arrow a => Applicative (ArrowMonad a)  Since: base4.6.0.0 
Defined in Control.Arrow pure :: a0 > ArrowMonad a a0 # (<*>) :: ArrowMonad a (a0 > b) > ArrowMonad a a0 > ArrowMonad a b # liftA2 :: (a0 > b > c) > ArrowMonad a a0 > ArrowMonad a b > ArrowMonad a c # (*>) :: ArrowMonad a a0 > ArrowMonad a b > ArrowMonad a b # (<*) :: ArrowMonad a a0 > ArrowMonad a b > ArrowMonad a a0 #  
Applicative (Proxy :: Type > Type)  Since: base4.7.0.0 
(Functor m, Monad m) => Applicative (MaybeT m)  
Applicative (Fold a)  
Applicative f => Applicative (Rec1 f)  Since: base4.9.0.0 
Arrow a => Applicative (WrappedArrow a b)  Since: base2.1 
Defined in Control.Applicative pure :: a0 > WrappedArrow a b a0 # (<*>) :: WrappedArrow a b (a0 > b0) > WrappedArrow a b a0 > WrappedArrow a b b0 # liftA2 :: (a0 > b0 > c) > WrappedArrow a b a0 > WrappedArrow a b b0 > WrappedArrow a b c # (*>) :: WrappedArrow a b a0 > WrappedArrow a b b0 > WrappedArrow a b b0 # (<*) :: WrappedArrow a b a0 > WrappedArrow a b b0 > WrappedArrow a b a0 #  
Monoid m => Applicative (Const m :: Type > Type)  Since: base2.0.1 
Applicative f => Applicative (Ap f)  Since: base4.12.0.0 
Applicative f => Applicative (Alt f)  Since: base4.8.0.0 
Biapplicative p => Applicative (Join p)  
Applicative m => Applicative (IdentityT m)  
Defined in Control.Monad.Trans.Identity  
(Applicative f, Monad f) => Applicative (WhenMissing f x)  Equivalent to Since: containers0.5.9 
Defined in Data.IntMap.Internal pure :: a > WhenMissing f x a # (<*>) :: WhenMissing f x (a > b) > WhenMissing f x a > WhenMissing f x b # liftA2 :: (a > b > c) > WhenMissing f x a > WhenMissing f x b > WhenMissing f x c # (*>) :: WhenMissing f x a > WhenMissing f x b > WhenMissing f x b # (<*) :: WhenMissing f x a > WhenMissing f x b > WhenMissing f x a #  
(Functor m, Monad m) => Applicative (ExceptT e m)  
Defined in Control.Monad.Trans.Except  
Applicative m => Applicative (FoldM m a)  
(Functor m, Monad m) => Applicative (ErrorT e m)  
Defined in Control.Monad.Trans.Error  
(Functor m, Monad m) => Applicative (StateT s m)  
Defined in Control.Monad.Trans.State.Lazy  
(Functor m, Monad m) => Applicative (StateT s m)  
Defined in Control.Monad.Trans.State.Strict  
(Monoid w, Applicative m) => Applicative (WriterT w m)  
Defined in Control.Monad.Trans.Writer.Lazy  
(Monoid w, Applicative m) => Applicative (WriterT w m)  
Defined in Control.Monad.Trans.Writer.Strict  
Applicative (Tagged s)  
Applicative (Mag a b)  
Applicative ((>) a :: Type > Type)  Since: base2.1 
Monoid c => Applicative (K1 i c :: Type > Type)  Since: base4.12.0.0 
(Applicative f, Applicative g) => Applicative (f :*: g)  Since: base4.9.0.0 
(Applicative f, Applicative g) => Applicative (Product f g)  Since: base4.9.0.0 
Defined in Data.Functor.Product  
(Monad f, Applicative f) => Applicative (WhenMatched f x y)  Equivalent to Since: containers0.5.9 
Defined in Data.IntMap.Internal pure :: a > WhenMatched f x y a # (<*>) :: WhenMatched f x y (a > b) > WhenMatched f x y a > WhenMatched f x y b # liftA2 :: (a > b > c) > WhenMatched f x y a > WhenMatched f x y b > WhenMatched f x y c # (*>) :: WhenMatched f x y a > WhenMatched f x y b > WhenMatched f x y b # (<*) :: WhenMatched f x y a > WhenMatched f x y b > WhenMatched f x y a #  
(Applicative f, Monad f) => Applicative (WhenMissing f k x)  Equivalent to Since: containers0.5.9 
Defined in Data.Map.Internal pure :: a > WhenMissing f k x a # (<*>) :: WhenMissing f k x (a > b) > WhenMissing f k x a > WhenMissing f k x b # liftA2 :: (a > b > c) > WhenMissing f k x a > WhenMissing f k x b > WhenMissing f k x c # (*>) :: WhenMissing f k x a > WhenMissing f k x b > WhenMissing f k x b # (<*) :: WhenMissing f k x a > WhenMissing f k x b > WhenMissing f k x a #  
Applicative (ContT r m)  
Applicative m => Applicative (ReaderT r m)  
Defined in Control.Monad.Trans.Reader  
Applicative f => Applicative (M1 i c f)  Since: base4.9.0.0 
(Applicative f, Applicative g) => Applicative (f :.: g)  Since: base4.9.0.0 
(Applicative f, Applicative g) => Applicative (Compose f g)  Since: base4.9.0.0 
Defined in Data.Functor.Compose  
(Monad f, Applicative f) => Applicative (WhenMatched f k x y)  Equivalent to Since: containers0.5.9 
Defined in Data.Map.Internal pure :: a > WhenMatched f k x y a # (<*>) :: WhenMatched f k x y (a > b) > WhenMatched f k x y a > WhenMatched f k x y b # liftA2 :: (a > b > c) > WhenMatched f k x y a > WhenMatched f k x y b > WhenMatched f k x y c # (*>) :: WhenMatched f k x y a > WhenMatched f k x y b > WhenMatched f k x y b # (<*) :: WhenMatched f k x y a > WhenMatched f k x y b > WhenMatched f k x y a #  
(Monoid w, Functor m, Monad m) => Applicative (RWST r w s m)  
Defined in Control.Monad.Trans.RWS.Lazy  
(Monoid w, Functor m, Monad m) => Applicative (RWST r w s m)  
Defined in Control.Monad.Trans.RWS.Strict 
optional :: Alternative f => f a > f (Maybe a) #
One or none.
(<$>) :: Functor f => (a > b) > f a > f b infixl 4 #
An infix synonym for fmap
.
The name of this operator is an allusion to $
.
Note the similarities between their types:
($) :: (a > b) > a > b (<$>) :: Functor f => (a > b) > f a > f b
Whereas $
is function application, <$>
is function
application lifted over a Functor
.
Examples
Convert from a
to a Maybe
Int
using Maybe
String
show
:
>>>
show <$> Nothing
Nothing>>>
show <$> Just 3
Just "3"
Convert from an
to an Either
Int
Int
Either
Int
String
using show
:
>>>
show <$> Left 17
Left 17>>>
show <$> Right 17
Right "17"
Double each element of a list:
>>>
(*2) <$> [1,2,3]
[2,4,6]
Apply even
to the second element of a pair:
>>>
even <$> (2,2)
(2,True)
class Applicative f => Alternative (f :: Type > Type) where #
A monoid on applicative functors.
If defined, some
and many
should be the least solutions
of the equations:
The identity of <>
(<>) :: f a > f a > f a infixl 3 #
An associative binary operation
One or more.
Zero or more.
Instances
guard :: Alternative f => Bool > f () #
Conditional failure of Alternative
computations. Defined by
guard True =pure
() guard False =empty
Examples
Common uses of guard
include conditionally signaling an error in
an error monad and conditionally rejecting the current choice in an
Alternative
based parser.
As an example of signaling an error in the error monad Maybe
,
consider a safe division function safeDiv x y
that returns
Nothing
when the denominator y
is zero and
otherwise. For example:Just
(x `div`
y)
>>> safeDiv 4 0 Nothing >>> safeDiv 4 2 Just 2
A definition of safeDiv
using guards, but not guard
:
safeDiv :: Int > Int > Maybe Int safeDiv x y  y /= 0 = Just (x `div` y)  otherwise = Nothing
A definition of safeDiv
using guard
and Monad
do
notation:
safeDiv :: Int > Int > Maybe Int safeDiv x y = do guard (y /= 0) return (x `div` y)
join :: Monad m => m (m a) > m a #
The join
function is the conventional monad join operator. It
is used to remove one level of monadic structure, projecting its
bound argument into the outer level.
Examples
A common use of join
is to run an IO
computation returned from
an STM
transaction, since STM
transactions
can't perform IO
directly. Recall that
atomically
:: STM a > IO a
is used to run STM
transactions atomically. So, by
specializing the types of atomically
and join
to
atomically
:: STM (IO b) > IO (IO b)join
:: IO (IO b) > IO b
we can compose them as
join
.atomically
:: STM (IO b) > IO b
unless :: Applicative f => Bool > f () > f () #
The reverse of when
.
replicateM_ :: Applicative m => Int > m a > m () #
Like replicateM
, but discards the result.
forever :: Applicative f => f a > f b #
Repeat an action indefinitely.
Examples
A common use of forever
is to process input from network sockets,
Handle
s, and channels
(e.g. MVar
and
Chan
).
For example, here is how we might implement an echo
server, using
forever
both to listen for client connections on a network socket
and to echo client input on client connection handles:
echoServer :: Socket > IO () echoServer socket =forever
$ do client < accept socketforkFinally
(echo client) (\_ > hClose client) where echo :: Handle > IO () echo client =forever
$ hGetLine client >>= hPutStrLn client
(>=>) :: Monad m => (a > m b) > (b > m c) > a > m c infixr 1 #
Lefttoright composition of Kleisli arrows.
void :: Functor f => f a > f () #
discards or ignores the result of evaluation, such
as the return value of an void
valueIO
action.
Examples
Replace the contents of a
with unit:Maybe
Int
>>>
void Nothing
Nothing>>>
void (Just 3)
Just ()
Replace the contents of an
with unit,
resulting in an Either
Int
Int
:Either
Int
'()'
>>>
void (Left 8675309)
Left 8675309>>>
void (Right 8675309)
Right ()
Replace every element of a list with unit:
>>>
void [1,2,3]
[(),(),()]
Replace the second element of a pair with unit:
>>>
void (1,2)
(1,())
Discard the result of an IO
action:
>>>
mapM print [1,2]
1 2 [(),()]>>>
void $ mapM print [1,2]
1 2
when :: Applicative f => Bool > f () > f () #
Conditional execution of Applicative
expressions. For example,
when debug (putStrLn "Debugging")
will output the string Debugging
if the Boolean value debug
is True
, and otherwise do nothing.
class (Alternative m, Monad m) => MonadPlus (m :: Type > Type) where #
Monads that also support choice and failure.
Nothing
The identity of mplus
. It should also satisfy the equations
mzero >>= f = mzero v >> mzero = mzero
The default definition is
mzero = empty
An associative operation. The default definition is
mplus = (<>
)
Instances
class Monad m => MonadIO (m :: Type > Type) where #
Monads in which IO
computations may be embedded.
Any monad built by applying a sequence of monad transformers to the
IO
monad will be an instance of this class.
Instances should satisfy the following laws, which state that liftIO
is a transformer of monads:
Instances
class Semigroup a => Monoid a where #
The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following laws:
x
<>
mempty
= xmempty
<>
x = xx
(<>
(y<>
z) = (x<>
y)<>
zSemigroup
law)mconcat
=foldr
'(<>)'mempty
The method names refer to the monoid of lists under concatenation, but there are many other instances.
Some types can be viewed as a monoid in more than one way,
e.g. both addition and multiplication on numbers.
In such cases we often define newtype
s and make those instances
of Monoid
, e.g. Sum
and Product
.
NOTE: Semigroup
is a superclass of Monoid
since base4.11.0.0.
Identity of mappend
An associative operation
NOTE: This method is redundant and has the default
implementation
since base4.11.0.0.mappend
= '(<>)'
Fold a list using the monoid.
For most types, the default definition for mconcat
will be
used, but the function is included in the class definition so
that an optimized version can be provided for specific types.
Instances
Monoid Ordering  Since: base2.1 
Monoid ()  Since: base2.1 
Monoid Doc  
Monoid All  Since: base2.1 
Monoid Any  Since: base2.1 
Monoid ByteString  
Defined in Data.ByteString.Internal mempty :: ByteString # mappend :: ByteString > ByteString > ByteString # mconcat :: [ByteString] > ByteString #  
Monoid Builder  
Monoid IntSet  
Monoid PrefsMod  
Monoid ParseError  
Defined in Options.Applicative.Types mempty :: ParseError # mappend :: ParseError > ParseError > ParseError # mconcat :: [ParseError] > ParseError #  
Monoid Completer  
Monoid Doc  
Monoid ByteArray  
Monoid Line Source #  
Monoid [a]  Since: base2.1 
Semigroup a => Monoid (Maybe a)  Lift a semigroup into Since 4.11.0: constraint on inner Since: base2.1 
Monoid a => Monoid (IO a)  Since: base4.9.0.0 
Monoid p => Monoid (Par1 p)  Since: base4.12.0.0 
(Semigroup a, Monoid a) => Monoid (Concurrently a)  Since: async2.1.0 
Defined in Control.Concurrent.Async mempty :: Concurrently a # mappend :: Concurrently a > Concurrently a > Concurrently a # mconcat :: [Concurrently a] > Concurrently a #  
(Ord a, Bounded a) => Monoid (Min a)  Since: base4.9.0.0 
(Ord a, Bounded a) => Monoid (Max a)  Since: base4.9.0.0 
Monoid m => Monoid (WrappedMonoid m)  Since: base4.9.0.0 
Defined in Data.Semigroup mempty :: WrappedMonoid m # mappend :: WrappedMonoid m > WrappedMonoid m > WrappedMonoid m # mconcat :: [WrappedMonoid m] > WrappedMonoid m #  
Semigroup a => Monoid (Option a)  Since: base4.9.0.0 
Monoid a => Monoid (Identity a)  Since: base4.9.0.0 
Monoid (First a)  Since: base2.1 
Monoid (Last a)  Since: base2.1 
Monoid a => Monoid (Dual a)  Since: base2.1 
Monoid (Endo a)  Since: base2.1 
Num a => Monoid (Sum a)  Since: base2.1 
Num a => Monoid (Product a)  Since: base2.1 
Monoid a => Monoid (Down a)  Since: base4.11.0.0 
Num a => Monoid (Colour a)  
Num a => Monoid (AlphaColour a)  
Defined in Data.Colour.Internal mempty :: AlphaColour a # mappend :: AlphaColour a > AlphaColour a > AlphaColour a # mconcat :: [AlphaColour a] > AlphaColour a #  
Monoid (IntMap a)  
Monoid (Seq a)  
Ord a => Monoid (Set a)  
Monoid a => Monoid (Managed a)  
Monoid a => Monoid (Optional a)  
Monoid (InfoMod a)  
Monoid (DefaultProp a)  
Defined in Options.Applicative.Builder.Internal mempty :: DefaultProp a # mappend :: DefaultProp a > DefaultProp a > DefaultProp a # mconcat :: [DefaultProp a] > DefaultProp a #  
Monoid (Doc a)  
Monoid (PrimArray a)  Since: primitive0.6.4.0 
Monoid (SmallArray a)  
Defined in Data.Primitive.SmallArray mempty :: SmallArray a # mappend :: SmallArray a > SmallArray a > SmallArray a # mconcat :: [SmallArray a] > SmallArray a #  
Monoid (Array a)  
(Hashable a, Eq a) => Monoid (HashSet a)  O(n+m) To obtain good performance, the smaller set must be presented as the first argument. Examples

Prim a => Monoid (Vector a)  
Monoid a => Monoid (Pattern a) Source #  
Monoid a => Monoid (Shell a) Source #  
Monoid (MergeSet a)  
Monoid b => Monoid (a > b)  Since: base2.1 
Monoid (U1 p)  Since: base4.12.0.0 
(Monoid a, Monoid b) => Monoid (a, b)  Since: base2.1 
Monoid a => Monoid (ST s a)  Since: base4.11.0.0 
Monoid (Proxy s)  Since: base4.7.0.0 
Ord k => Monoid (Map k v)  
(Eq k, Hashable k) => Monoid (HashMap k v)  If a key occurs in both maps, the mapping from the first will be the mapping in the result. Examples

Monoid b => Monoid (Fold a b)  
Monad m => Monoid (EndoM m a)  
Monoid (Mod f a)  
Monoid (f p) => Monoid (Rec1 f p)  Since: base4.12.0.0 
(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c)  Since: base2.1 
Monoid a => Monoid (Const a b)  Since: base4.9.0.0 
(Applicative f, Monoid a) => Monoid (Ap f a)  Since: base4.12.0.0 
Alternative f => Monoid (Alt f a)  Since: base4.8.0.0 
(Monoid b, Monad m) => Monoid (FoldM m a b)  
(Semigroup a, Monoid a) => Monoid (Tagged s a)  
Monoid c => Monoid (K1 i c p)  Since: base4.12.0.0 
(Monoid (f p), Monoid (g p)) => Monoid ((f :*: g) p)  Since: base4.12.0.0 
(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d)  Since: base2.1 
Monoid (f p) => Monoid (M1 i c f p)  Since: base4.12.0.0 
Monoid (f (g p)) => Monoid ((f :.: g) p)  Since: base4.12.0.0 
(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e)  Since: base2.1 
runManaged :: Managed () > IO () #
Run a Managed
computation, enforcing that no acquired resources leak
with :: Managed a > (a > IO r) > IO r #
Acquire a Managed
value
This is a potentially unsafe function since it allows a resource to escape
its scope. For example, you might use Managed
to safely acquire a
file handle, like this:
import qualified System.IO as IO example :: Managed Handle example = managed (IO.withFile "foo.txt" IO.ReadMode)
... and if you never used the with
function then you would never run the
risk of accessing the Handle
after the file was closed. However, if you
use with
then you can incorrectly access the handle after the handle is
closed, like this:
bad :: IO () bad = do handle < with example return IO.hPutStrLn handle "bar"  This will fail because the handle is closed
... so only use with
if you know what you are doing and you're returning
a value that is not a resource being managed.
A managed resource that you acquire using with
Instances
Instances
Eq FilePath  
Data FilePath  
Defined in Filesystem.Path.Internal gfoldl :: (forall d b. Data d => c (d > b) > d > c b) > (forall g. g > c g) > FilePath > c FilePath # gunfold :: (forall b r. Data b => c (b > r) > c r) > (forall r. r > c r) > Constr > c FilePath # toConstr :: FilePath > Constr # dataTypeOf :: FilePath > DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) > Maybe (c FilePath) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) > Maybe (c FilePath) # gmapT :: (forall b. Data b => b > b) > FilePath > FilePath # gmapQl :: (r > r' > r) > r > (forall d. Data d => d > r') > FilePath > r # gmapQr :: (r' > r > r) > r > (forall d. Data d => d > r') > FilePath > r # gmapQ :: (forall d. Data d => d > u) > FilePath > [u] # gmapQi :: Int > (forall d. Data d => d > u) > FilePath > u # gmapM :: Monad m => (forall d. Data d => d > m d) > FilePath > m FilePath # gmapMp :: MonadPlus m => (forall d. Data d => d > m d) > FilePath > m FilePath # gmapMo :: MonadPlus m => (forall d. Data d => d > m d) > FilePath > m FilePath #  
Ord FilePath  
Defined in Filesystem.Path.Internal  
NFData FilePath  
Defined in Filesystem.Path.Internal 
decodeString :: String > FilePath #
encodeString :: FilePath > String #
toText :: FilePath > Either Text Text #
Attempt to convert a FilePath
to human‐readable text.
If the path is decoded successfully, the result is a Right
containing
the decoded text. Successfully decoded text can be converted back to the
original path using fromText
.
If the path cannot be decoded, the result is a Left
containing an
approximation of the original path. If displayed to the user, this value
should be accompanied by some warning that the path has an invalid
encoding. Approximated text cannot be converted back to the original path.
This function ignores the user’s locale, and assumes all file paths
are encoded in UTF8. If you need to display file paths with an unusual or
obscure encoding, use encode
and then decode them manually.
Since: 0.2
splitExtension :: FilePath > (FilePath, Maybe Text) #
splitExtension p = (dropExtension
p,extension
p)
dropExtension :: FilePath > FilePath #
Remove a FilePath
’s last extension.
splitDirectories :: FilePath > [FilePath] #
expand a FilePath into a list of the root name, directories, and file name
Since: 0.4.7
collapse :: FilePath > FilePath #
Remove intermediate "."
and ".."
directories from a path.
collapse
"/foo/./bar" == "/foo/bar"collapse
"/foo/bar/../baz" == "/foo/baz"collapse
"/foo/../../bar" == "/bar"collapse
"./foo/bar" == "./foo/baz"
Note that if any of the elements are symbolic links, collapse
may change
which file the path resolves to.
Since: 0.2
stripPrefix :: FilePath > FilePath > Maybe FilePath #
Remove a prefix from a path.
stripPrefix
"/foo/" "/foo/bar/baz.txt" == Just "bar/baz.txt"stripPrefix
"/foo/" "/bar/baz.txt" == Nothing
This function operates on logical prefixes, rather than by counting
characters. The prefix "/foo/bar/baz"
is interpreted the path
("/foo/bar/", "baz")
, and will be stripped accordingly:
stripPrefix
"/foo/bar/baz" "/foo/bar/baz/qux" == NothingstripPrefix
"/foo/bar/baz" "/foo/bar/baz.txt" == Just ".txt"
Since: 0.4.1
commonPrefix :: [FilePath] > FilePath #
Find the greatest common prefix between a list of FilePath
s.
basename :: FilePath > FilePath #
Retrieve a FilePath
’s basename component.
basename "foo/bar.txt" == "bar"
dirname :: FilePath > FilePath #
Retrieve a FilePath
’s directory name. This is only the
file name of the directory, not its full path.
dirname "foo/bar/baz.txt" == "bar" dirname "/" == ""
Since: 0.4.1
filename :: FilePath > FilePath #
Retrieve a FilePath
’s filename component.
filename "foo/bar.txt" == "bar.txt"
directory :: FilePath > FilePath #
Retrieves the FilePath
’s directory. If the path is already a
directory, it is returned unchanged.
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
A 'Fold
a b' processes elements of type a and results in a
value of type b.
Instances
Choice Fold  
Profunctor Fold  
Functor (Fold a)  
Applicative (Fold a)  
Comonad (Fold a)  
Semigroupoid Fold  
Floating b => Floating (Fold a b)  
Defined in Control.Foldl sqrt :: Fold a b > Fold a b # (**) :: Fold a b > Fold a b > Fold a b # logBase :: Fold a b > Fold a b > Fold a b # asin :: Fold a b > Fold a b # acos :: Fold a b > Fold a b # atan :: Fold a b > Fold a b # sinh :: Fold a b > Fold a b # cosh :: Fold a b > Fold a b # tanh :: Fold a b > Fold a b # asinh :: Fold a b > Fold a b # acosh :: Fold a b > Fold a b # atanh :: Fold a b > Fold a b # log1p :: Fold a b > Fold a b # expm1 :: Fold a b > Fold a b #  
Fractional b => Fractional (Fold a b)  
Num b => Num (Fold a b)  
Semigroup b => Semigroup (Fold a b)  
Monoid b => Monoid (Fold a b)  
data FoldM (m :: Type > Type) a b where #
Like Fold
, but monadic.
A 'FoldM
m a b' processes elements of type a and
results in a monadic value of type m b.
FoldM :: forall (m :: Type > Type) a b x. (x > a > m x) > m x > (x > m b) > FoldM m a b 

Instances
Functor m => Profunctor (FoldM m)  
Defined in Control.Foldl  
Functor m => Functor (FoldM m a)  
Applicative m => Applicative (FoldM m a)  
(Monad m, Floating b) => Floating (FoldM m a b)  
Defined in Control.Foldl exp :: FoldM m a b > FoldM m a b # log :: FoldM m a b > FoldM m a b # sqrt :: FoldM m a b > FoldM m a b # (**) :: FoldM m a b > FoldM m a b > FoldM m a b # logBase :: FoldM m a b > FoldM m a b > FoldM m a b # sin :: FoldM m a b > FoldM m a b # cos :: FoldM m a b > FoldM m a b # tan :: FoldM m a b > FoldM m a b # asin :: FoldM m a b > FoldM m a b # acos :: FoldM m a b > FoldM m a b # atan :: FoldM m a b > FoldM m a b # sinh :: FoldM m a b > FoldM m a b # cosh :: FoldM m a b > FoldM m a b # tanh :: FoldM m a b > FoldM m a b # asinh :: FoldM m a b > FoldM m a b # acosh :: FoldM m a b > FoldM m a b # atanh :: FoldM m a b > FoldM m a b # log1p :: FoldM m a b > FoldM m a b # expm1 :: FoldM m a b > FoldM m a b #  
(Monad m, Fractional b) => Fractional (FoldM m a b)  
(Monad m, Num b) => Num (FoldM m a b)  
Defined in Control.Foldl (+) :: FoldM m a b > FoldM m a b > FoldM m a b # () :: FoldM m a b > FoldM m a b > FoldM m a b # (*) :: FoldM m a b > FoldM m a b > FoldM m a b # negate :: FoldM m a b > FoldM m a b # abs :: FoldM m a b > FoldM m a b # signum :: FoldM m a b > FoldM m a b # fromInteger :: Integer > FoldM m a b #  
(Semigroup b, Monad m) => Semigroup (FoldM m a b)  
(Monoid b, Monad m) => Monoid (FoldM m a b)  
A space efficient, packed, unboxed Unicode text type.
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.
Instances
Eq UTCTime  
Data UTCTime  
Defined in Data.Time.Clock.Internal.UTCTime gfoldl :: (forall d b. Data d => c (d > b) > d > c b) > (forall g. g > c g) > UTCTime > c UTCTime # gunfold :: (forall b r. Data b => c (b > r) > c r) > (forall r. r > c r) > Constr > c UTCTime # toConstr :: UTCTime > Constr # dataTypeOf :: UTCTime > DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) > Maybe (c UTCTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) > Maybe (c UTCTime) # gmapT :: (forall b. Data b => b > b) > UTCTime > UTCTime # gmapQl :: (r > r' > r) > r > (forall d. Data d => d > r') > UTCTime > r # gmapQr :: (r' > r > r) > r > (forall d. Data d => d > r') > UTCTime > r # gmapQ :: (forall d. Data d => d > u) > UTCTime > [u] # gmapQi :: Int > (forall d. Data d => d > u) > UTCTime > u # gmapM :: Monad m => (forall d. Data d => d > m d) > UTCTime > m UTCTime # gmapMp :: MonadPlus m => (forall d. Data d => d > m d) > UTCTime > m UTCTime # gmapMo :: MonadPlus m => (forall d. Data d => d > m d) > UTCTime > m UTCTime #  
Ord UTCTime  
Defined in Data.Time.Clock.Internal.UTCTime  
NFData UTCTime  
Defined in Data.Time.Clock.Internal.UTCTime  
ParseTime UTCTime  
Defined in Data.Time.Format.Parse 
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 leapseconds, 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 leapsecond intervened.
Instances
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 runtime 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 semiclosed;
 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 reuse 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.
Defines the exit codes that a program can return.
ExitSuccess  indicates successful termination; 
ExitFailure Int  indicates program failure with an exit code. The exact interpretation of the code is operatingsystem dependent. In particular, some values may be prohibited (e.g. 0 on a POSIXcompliant system). 
Instances
Eq ExitCode  
Ord ExitCode  
Defined in GHC.IO.Exception  
Read ExitCode  
Show ExitCode  
Generic ExitCode  
Exception ExitCode  Since: base4.1.0.0 
Defined in GHC.IO.Exception toException :: ExitCode > SomeException # fromException :: SomeException > Maybe ExitCode # displayException :: ExitCode > String #  
type Rep ExitCode  
Defined in GHC.IO.Exception 
Class for stringlike datastructures; used by the overloaded string extension (XOverloadedStrings in GHC).
fromString :: String > a #