Hoogle Search

Within LTS Haskell 24.41 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. module Synthesizer.Storable.Play

    No documentation available.

  2. data Properties

    tabular Text.Tabular

    No documentation available.

  3. module Data.TreeDiff.Parser

    Utilities to parse Expr. Note: we don't parse diffs.

  4. module Data.TreeDiff.Pretty

    Utilities to pretty print Expr and EditExpr

  5. data Pretty doc

    tree-diff Data.TreeDiff.Pretty

    Because we don't want to commit to single pretty printing library, we use explicit dictionary.

  6. Pretty :: (ConstructorName -> doc) -> (doc -> [doc] -> doc) -> (doc -> [(FieldName, doc)] -> doc) -> ([doc] -> doc) -> (doc -> doc) -> (doc -> doc) -> (doc -> doc) -> ([doc] -> doc) -> doc -> (doc -> doc) -> Pretty doc

    tree-diff Data.TreeDiff.Pretty

    No documentation available.

  7. data Parser a

    turtle Turtle.Options

    A Parser a is an option parser returning a value of type a.

  8. module Turtle.Pattern

    Use this module to either:

    • match Text with light-weight backtracking patterns, or:
    • parse structured values from Text.
    Example usage:
    >>> :set -XOverloadedStrings
    
    >>> match ("can" <|> "cat") "cat"
    ["cat"]
    
    >>> match ("can" <|> "cat") "dog"
    []
    
    >>> match (decimal `sepBy` ",") "1,2,3"
    [[1,2,3]]
    
    This pattern has unlimited backtracking, and will return as many solutions as possible:
    >>> match (prefix (star anyChar)) "123"
    ["123","12","1",""]
    
    Use do notation to structure more complex patterns:
    >>> :{
    let bit = ("0" *> pure False) <|> ("1" *> pure True) :: Pattern Bool;
    portableBitMap = do
    { "P1"
    ; width  <- spaces1 *> decimal
    ; height <- spaces1 *> decimal
    ; count width (count height (spaces1 *> bit))
    };
    in  match (prefix portableBitMap) "P1\n2 2\n0 0\n1 0\n"
    :}
    [[[False,False],[True,False]]]
    

  9. data Pattern a

    turtle Turtle.Pattern

    A fully backtracking pattern that parses an 'a' from some Text

  10. module Turtle.Prelude

    This module provides a large suite of utilities that resemble Unix utilities. Many of these commands are just existing Haskell commands renamed to match their Unix counterparts:

    >>> :set -XOverloadedStrings
    
    >>> cd "/tmp"
    
    >>> pwd
    FilePath "/tmp"
    
    Some commands are Shells that emit streams of values. view prints all values in a Shell stream:
    >>> view (ls "/usr")
    FilePath "/usr/lib"
    FilePath "/usr/src"
    FilePath "/usr/sbin"
    FilePath "/usr/include"
    FilePath "/usr/share"
    FilePath "/usr/games"
    FilePath "/usr/local"
    FilePath "/usr/bin"
    
    >>> view (find (suffix "Browser.py") "/usr/lib")
    FilePath "/usr/lib/python3.4/idlelib/ClassBrowser.py"
    FilePath "/usr/lib/python3.4/idlelib/RemoteObjectBrowser.py"
    FilePath "/usr/lib/python3.4/idlelib/PathBrowser.py"
    FilePath "/usr/lib/python3.4/idlelib/ObjectBrowser.py"
    
    Use fold to reduce the output of a Shell stream:
    >>> import qualified Control.Foldl as Fold
    
    >>> fold (ls "/usr") Fold.length
    8
    
    >>> fold (find (suffix "Browser.py") "/usr/lib") Fold.head
    Just (FilePath "/usr/lib/python3.4/idlelib/ClassBrowser.py")
    
    Create files using output:
    >>> output "foo.txt" ("123" <|> "456" <|> "ABC")
    
    >>> realpath "foo.txt"
    FilePath "/tmp/foo.txt"
    
    Read in files using input:
    >>> stdout (input "foo.txt")
    123
    456
    ABC
    
    Format strings in a type safe way using format:
    >>> dir <- pwd
    
    >>> format ("I am in the "%fp%" directory") dir
    "I am in the /tmp directory"
    
    Commands like grep, sed and find accept arbitrary Patterns
    >>> stdout (grep ("123" <|> "ABC") (input "foo.txt"))
    123
    ABC
    
    >>> let exclaim = fmap (<> "!") (plus digit)
    
    >>> stdout (sed exclaim (input "foo.txt"))
    123!
    456!
    ABC
    
    Note that grep and find differ from their Unix counterparts by requiring that the Pattern matches the entire line or file name by default. However, you can optionally match the prefix, suffix, or interior of a line:
    >>> stdout (grep (has    "2") (input "foo.txt"))
    123
    
    >>> stdout (grep (prefix "1") (input "foo.txt"))
    123
    
    >>> stdout (grep (suffix "3") (input "foo.txt"))
    123
    
    You can also build up more sophisticated Shell programs using sh in conjunction with do notation:
    {-# LANGUAGE OverloadedStrings #-}
    
    import Turtle
    
    main = sh example
    
    example = do
    -- Read in file names from "files1.txt" and "files2.txt"
    file <- fmap fromText (input "files1.txt" <|> input "files2.txt")
    
    -- Stream each file to standard output only if the file exists
    True <- liftIO (testfile file)
    line <- input file
    liftIO (echo line)
    
    See Turtle.Tutorial for an extended tutorial explaining how to use this library in greater detail.

Page 650 of many | Previous | Next