f package:turtle

Format a Double using decimal notation with 6 digits of precision
>>> format f 25.1
"25.100000"
Retrieves the FilePath's filename component
Repeat an action indefinitely.

Examples

A common use of forever is to process input from network sockets, Handles, 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 socket
forkFinally (echo client) (\_ -> hClose client)
where
echo :: Handle -> IO ()
echo client = forever $
hGetLine client >>= hPutStrLn client
Note that "forever" isn't necessarily non-terminating. If the action is in a MonadPlus and short-circuits after some number of iterations. then forever actually returns mzero, effectively short-circuiting its caller.
Deprecated: Use Data.Text.unpack instead
Encode a stream of bytes as UTF8 Text
Convert a Format string to a print function that takes zero or more typed arguments and returns a Text string
Require the pattern to consume exactly the given number of characters
>>> match (fixed 2 decimal) "12"
[12]

>>> match (fixed 2 decimal) "1"
[]
Size of the file in bytes. Does not follow symlinks
Search a directory recursively for all files matching the given Pattern
Filter a shell of FilePaths according to a given pattern
Fork a thread, acquiring an Async value
Use a Fold to reduce the stream of a's produced by a Shell
Use a FoldM IO to reduce the stream of a's produced by a Shell
Use a FoldShell to reduce the stream of a's produced by a Shell
Convert an IO action that returns a Maybe into a Shell
File and directory names are values of type String, whose precise meaning is operating system dependent. Files can be opened, yielding a handle which can then be used to operate on the contents of that file.
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.
Fold step initial extract
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 step initial extract
Minimalist implementation of type-safe formatted strings, borrowing heavily from the implementation of the formatting package. Example use of this module:
>>> :set -XOverloadedStrings

>>> import Turtle.Format

>>> format ("This is a "%s%" string that takes "%d%" arguments") "format" 2
"This is a format string that takes 2 arguments"
A Format string that takes no arguments has this type:
"I take 0 arguments" :: Format r r

format "I take 0 arguments" :: Text
>>> format "I take 0 arguments"
"I take 0 arguments"
A Format string that takes one argument has this type:
"I take "%d%" arguments" :: Format r (Int -> r)

format ("I take "%d%" argument") :: Int -> Text
>>> format ("I take "%d%" argument") 1
"I take 1 argument"
A Format string that takes two arguments has this type:
"I "%s%" "%d%" arguments" :: Format r (Text -> Int -> r)

format ("I "%s%" "%d%" arguments") :: Text -> Int -> Text
>>> format ("I "%s%" "%d%" arguments") "take" 2
"I take 2 arguments"
A Format string