cabal-fmt-0.1.12: Format .cabal files

Copyright | Oleg Grenrus
License | GPL-3.0-or-later
Safe Haskell | None
Language | Haskell2010

CabalFmt.Prelude

Contents

- Control.Arrow
- Control.Monad
- Data.Bifunctor
- Data.Char
- Data.Either
- Data.Foldable
- Data.Function
- Data.List
- Data.Maybe
- Packages
  - bytestring
  - Cabal
  - containers
  - directory
  - exceptions
- Extras
  - Lens
  - Tuples

Description

Fat-prelude.

Synopsis

- (&&&) :: Arrow a => a b c -> a b c' -> a b (c, c')
- when :: Applicative f => Bool -> f () -> f ()
- unless :: Applicative f => Bool -> f () -> f ()
- void :: Functor f => f a -> f ()
- bimap :: Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d
- toLower :: Char -> Char
- partitionEithers :: [Either a b] -> ([a], [b])
- toList :: Foldable t => t a -> [a]
- traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
- asum :: (Foldable t, Alternative f) => t (f a) -> f a
- for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()
- on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
- (&) :: a -> (a -> b) -> b
- intercalate :: [a] -> [[a]] -> [a]
- sortOn :: Ord b => (a -> b) -> [a] -> [a]
- sortBy :: (a -> a -> Ordering) -> [a] -> [a]
- nub :: Eq a => [a] -> [a]
- catMaybes :: [Maybe a] -> [a]
- fromMaybe :: a -> Maybe a -> a
- isJust :: Maybe a -> Bool
- isNothing :: Maybe a -> Bool
- data ByteString
- fromUTF8BS :: ByteString -> String
- toUTF8BS :: String -> ByteString
- pack' :: Newtype o n => (o -> n) -> o -> n
- unpack' :: Newtype o n => (o -> n) -> n -> o
- data Set a
- dropExtension :: FilePath -> FilePath
- splitDirectories :: FilePath -> [FilePath]
- catchError :: MonadError e m => m a -> (e -> m a) -> m a
- throwError :: MonadError e m => e -> m a
- traverseOf :: Applicative f => ((a -> f b) -> s -> f t) -> (a -> f b) -> s -> f t
- over :: ASetter s t a b -> (a -> b) -> s -> t
- view :: Getting a s a -> s -> a
- _1 :: Functor f => (a -> f b) -> (a, c) -> f (b, c)
- fstOf3 :: (a, b, c) -> a
- sndOf3 :: (a, b, c) -> b
- trdOf3 :: (a, b, c) -> c

# Control.Arrow

(&&&) :: Arrow a => a b c -> a b c' -> a b (c, c') infixr 3 #

Fanout: send the input to both argument arrows and combine their output.

The default definition may be overridden with a more efficient version if desired.

# Control.Monad

when :: Applicative f => Bool -> f () -> f () #

Conditional execution of `Applicative` expressions. For example,

#### Examples

Expand

    when debug (putStrLn "Debugging")

will output the string `Debugging` if the Boolean value `debug` is `True`, and otherwise do nothing.

    >>> putStr "pi:" >> when False (print 3.14159)
    pi:

unless :: Applicative f => Bool -> f () -> f () #

The reverse of `when`.

#### Examples

Expand

    >>> do x <- getLine
           unless (x == "hi") (putStrLn "hi!")
    comingupwithexamplesisdifficult
    hi!

    >>> unless (pi > exp 1) Nothing
    Just ()

void :: Functor f => f a -> f () #

``void` value` discards or ignores the result of evaluation, such as the return value of an `IO` action.

#### Examples

Expand

Replace the contents of a ``Maybe` `Int`` with unit:

    >>> void Nothing
    Nothing

    >>> void (Just 3)
    Just ()

Replace the contents of an ``Either` `Int` `Int`` with unit, resulting in an ``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

# Data.Bifunctor

bimap :: Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d #

Map over both arguments at the same time.

    bimap f g ≡ first f . second g

#### Examples

Expand

    >>> bimap toUpper (+1) ('j', 3)
    ('J',4)

    >>> bimap toUpper (+1) (Left 'j')
    Left 'J'

    >>> bimap toUpper (+1) (Right 3)
    Right 4

# Data.Char

toLower :: Char -> Char #

Convert a letter to the corresponding lower-case letter, if any. Any other character is returned unchanged.

# Data.Either

partitionEithers :: [Either a b] -> ([a], [b]) #

Partitions a list of `Either` into two lists. All the `Left` elements are extracted, in order, to the first component of the output. Similarly the `Right` elements are extracted to the second component of the output.

#### Examples

Expand

Basic usage:

    >>> let list = [ Left "foo", Right 3, Left "bar", Right 7, Left "baz" ]
    >>> partitionEithers list
    (["foo","bar","baz"],[3,7])

The pair returned by ``partitionEithers` x` should be the same pair as `(`lefts` x, `rights` x)`:

    >>> let list = [ Left "foo", Right 3, Left "bar", Right 7, Left "baz" ]
    >>> partitionEithers list == (lefts list, rights list)
    True

# Data.Foldable

toList :: Foldable t => t a -> [a] #

List of elements of a structure, from left to right. If the entire list is intended to be reduced via a fold, just fold the structure directly bypassing the list.

#### Examples

Expand

Basic usage:

    >>> toList Nothing
    []

    >>> toList (Just 42)
    [42]

    >>> toList (Left "foo")
    []

    >>> toList (Node (Leaf 5) 17 (Node Empty 12 (Leaf 8)))
    [5,17,12,8]

For lists, `toList` is the identity:

    >>> toList [1, 2, 3]
    [1,2,3]

@since base-4.8.0.0

traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f () #

Map each element of a structure to an `Applicative` action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see `traverse`.

`traverse_` is just like `mapM_`, but generalised to `Applicative` actions.

#### Examples

Expand

Basic usage:

    >>> traverse_ print ["Hello", "world", "!"]
    "Hello"
    "world"
    "!"

asum :: (Foldable t, Alternative f) => t (f a) -> f a #

The sum of a collection of actions using `(<|>)`, generalizing `concat`.

`asum` is just like `msum`, but generalised to `Alternative`.

#### Examples

Expand

Basic usage:

    >>> asum [Just "Hello", Nothing, Just "World"]
    Just "Hello"

for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f () #

`for_` is `traverse_` with its arguments flipped. For a version that doesn't ignore the results see `for`. This is `forM_` generalised to `Applicative` actions.

`for_` is just like `forM_`, but generalised to `Applicative` actions.

#### Examples

Expand

Basic usage:

    >>> for_ [1..4] print
    1
    2
    3
    4

# Data.Function

on :: (b -> b -> c) -> (a -> b) -> a -> a -> c infixl 0 #

``on` b u x y` runs the binary function `b` on the results of applying unary function `u` to two arguments `x` and `y`. From the opposite perspective, it transforms two inputs and combines the outputs.

    (op `on` f) x y = f x `op` f y

#### Examples

Expand

    >>> sortBy (compare `on` length) [[0, 1, 2], [0, 1], [], [0]]
    [[],[0],[0,1],[0,1,2]]

    >>> ((+) `on` length) [1, 2, 3] [-1]
    4

    >>> ((,) `on` (*2)) 2 3
    (4,6)

#### Algebraic properties

Expand

-     (*) `on` id = (*) -- (if (*) ∉ {⊥, const ⊥})

-     ((*) `on` f) `on` g = (*) `on` (f . g)

-     flip on f . flip on g = flip on (g . f)

(&) :: a -> (a -> b) -> b infixl 1 #

`&` is a reverse application operator. This provides notational convenience. Its precedence is one higher than that of the forward application operator `$`, which allows `&` to be nested in `$`.

This is a version of ``flip` `id``, where `id` is specialized from `a -> a` to `(a -> b) -> (a -> b)` which by the associativity of `(->)` is `(a -> b) -> a -> b`. flipping this yields `a -> (a -> b) -> b` which is the type signature of `&`

#### Examples

Expand

    >>> 5 & (+1) & show
    "6"

    >>> sqrt $ [1 / n^2 | n <- [1..1000]] & sum & (*6)
    3.1406380562059946

@since base-4.8.0.0

# Data.List

intercalate :: [a] -> [[a]] -> [a] #

`intercalate` `xs xss` is equivalent to `(`concat` (`intersperse` xs xss))`. It inserts the list `xs` in between the lists in `xss` and concatenates the result.

#### Laziness

Expand

`intercalate` has the following properties:

    >>> take 5 (intercalate undefined ("Lorem" : undefined))
    "Lorem"

    >>> take 6 (intercalate ", " ("Lorem" : undefined))
    "Lorem*** Exception: Prelude.undefined

#### Examples

Expand

    >>> intercalate ", " ["Lorem", "ipsum", "dolor"]
    "Lorem, ipsum, dolor"

    >>> intercalate [0, 1] [[2, 3], [4, 5, 6], []]
    [2,3,0,1,4,5,6,0,1]

    >>> intercalate [1, 2, 3] [[], []]
    [1,2,3]

sortOn :: Ord b => (a -> b) -> [a] -> [a] #

Sort a list by comparing the results of a key function applied to each element. ``sortOn` f` is equivalent to ``sortBy` (`comparing` f)`, but has the performance advantage of only evaluating `f` once for each element in the input list. This is called the decorate-sort-undecorate paradigm, or Schwartzian transform.

Elements are arranged from lowest to highest, keeping duplicates in the order they appeared in the input.

The argument must be finite.

#### Examples

Expand

    >>> sortOn fst [(2, "world"), (4, "!"), (1, "Hello")]
    [(1,"Hello"),(2,"world"),(4,"!")]

    >>> sortOn length ["jim", "creed", "pam", "michael", "dwight", "kevin"]
    ["jim","pam","creed","kevin","dwight","michael"]

#### Performance notes

Expand

This function minimises the projections performed, by materialising the projections in an intermediate list.

For trivial projections, you should prefer using `sortBy` with `comparing`, for example:

    >>> sortBy (comparing fst) [(3, 1), (2, 2), (1, 3)]
    [(1,3),(2,2),(3,1)]

Or, for the exact same API as `sortOn`, you can use `sortBy . comparing`:

    >>> (sortBy . comparing) fst [(3, 1), (2, 2), (1, 3)]
    [(1,3),(2,2),(3,1)]

@since base-4.8.0.0

sortBy :: (a -> a -> Ordering) -> [a] -> [a] #

The `sortBy` function is the non-overloaded version of `sort`. The argument must be finite.

The supplied comparison relation is supposed to be reflexive and antisymmetric, otherwise, e. g., for `_ _ -> GT`, the ordered list simply does not exist. The relation is also expected to be transitive: if it is not then `sortBy` might fail to find an ordered permutation, even if it exists.

#### Examples

Expand

    >>> sortBy (\(a,_) (b,_) -> compare a b) [(2, "world"), (4, "!"), (1, "Hello")]
    [(1,"Hello"),(2,"world"),(4,"!")]

nub :: Eq a => [a] -> [a] #

\(\mathcal{O}(n^2)\). The `nub` function removes duplicate elements from a list. In particular, it keeps only the first occurrence of each element. (The name `nub` means `essence'.) It is a special case of `nubBy`, which allows the programmer to supply their own equality test.

If there exists `instance Ord a`, it's faster to use `nubOrd` from the `containers` package (link to the latest online documentation), which takes only \(\mathcal{O}(n \log d)\) time where `d` is the number of distinct elements in the list.

Another approach to speed up `nub` is to use `map` `Data.List.NonEmpty.``head` . `Data.List.NonEmpty.``group` . `sort`, which takes \(\mathcal{O}(n \log n)\) time, requires `instance Ord a` and doesn't preserve the order.

#### Examples

Expand

    >>> nub [1,2,3,4,3,2,1,2,4,3,5]
    [1,2,3,4,5]

    >>> nub "hello, world!"
    "helo, wrd!"

# Data.Maybe

catMaybes :: [Maybe a] -> [a] #

The `catMaybes` function takes a list of `Maybe`s and returns a list of all the `Just` values.

#### Examples

Expand

Basic usage:

    >>> catMaybes [Just 1, Nothing, Just 3]
    [1,3]

When constructing a list of `Maybe` values, `catMaybes` can be used to return all of the "success" results (if the list is the result of a `map`, then `mapMaybe` would be more appropriate):

    >>> import GHC.Internal.Text.Read ( readMaybe )
    >>> [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ]
    [Just 1,Nothing,Just 3]
    >>> catMaybes $ [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ]
    [1,3]

fromMaybe :: a -> Maybe a -> a #

The `fromMaybe` function takes a default value and a `Maybe` value. If the `Maybe` is `Nothing`, it returns the default value; otherwise, it returns the value contained in the `Maybe`.

#### Examples

Expand

Basic usage:

    >>> fromMaybe "" (Just "Hello, World!")
    "Hello, World!"

    >>> fromMaybe "" Nothing
    ""

Read an integer from a string using `readMaybe`. If we fail to parse an integer, we want to return `0` by default:

    >>> import GHC.Internal.Text.Read ( readMaybe )
    >>> fromMaybe 0 (readMaybe "5")
    5
    >>> fromMaybe 0 (readMaybe "")
    0

isJust :: Maybe a -> Bool #

The `isJust` function returns `True` iff its argument is of the form `Just _`.

#### Examples

Expand

Basic usage:

    >>> isJust (Just 3)
    True

    >>> isJust (Just ())
    True

    >>> isJust Nothing
    False

Only the outer constructor is taken into consideration:

    >>> isJust (Just Nothing)
    True

isNothing :: Maybe a -> Bool #

The `isNothing` function returns `True` iff its argument is `Nothing`.

#### Examples

Expand

Basic usage:

    >>> isNothing (Just 3)
    False

    >>> isNothing (Just ())
    False

    >>> isNothing Nothing
    True

Only the outer constructor is taken into consideration:

    >>> isNothing (Just Nothing)
    False

# Packages

## bytestring

data ByteString #

A space-efficient representation of a `Word8` vector, supporting many efficient operations.

A `ByteString` contains 8-bit bytes, or by using the operations from Data.ByteString.Char8 it can be interpreted as containing 8-bit characters.

#### Instances

Instances details

Structured ByteString |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy ByteString -> Structure # structureHash' :: Tagged ByteString MD5
NFData ByteString |
Instance details Defined in Data.ByteString.Internal.Type Methods rnf :: ByteString -> () #
Monoid ByteString |
Instance details Defined in Data.ByteString.Internal.Type Methods mempty :: ByteString # mappend :: ByteString -> ByteString -> ByteString # mconcat :: [ByteString] -> ByteString #
Semigroup ByteString |
Instance details Defined in Data.ByteString.Internal.Type Methods (<>) :: ByteString -> ByteString -> ByteString # sconcat :: NonEmpty ByteString -> ByteString # stimes :: Integral b => b -> ByteString -> ByteString #
Data ByteString |
Instance details Defined in Data.ByteString.Internal.Type Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ByteString -> c ByteString # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ByteString # toConstr :: ByteString -> Constr # dataTypeOf :: ByteString -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ByteString) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ByteString) # gmapT :: (forall b. Data b => b -> b) -> ByteString -> ByteString # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ByteString -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ByteString -> r # gmapQ :: (forall d. Data d => d -> u) -> ByteString -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ByteString -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString #
IsString ByteString | Beware: `fromString` truncates multi-byte characters to octets. e.g. "枯朶に烏のとまりけり秋の暮" becomes �6k�nh~�Q��n�
Instance details Defined in Data.ByteString.Internal.Type Methods fromString :: String -> ByteString #
IsList ByteString | Since: bytestring-0.10.12.0
Instance details Defined in Data.ByteString.Internal.Type Associated Types
type Item ByteString |
Instance details Defined in Data.ByteString.Internal.Type type Item ByteString = Word8
Methods fromList :: [Item ByteString] -> ByteString # fromListN :: Int -> [Item ByteString] -> ByteString # toList :: ByteString -> [Item ByteString] #
Read ByteString |
Instance details Defined in Data.ByteString.Internal.Type Methods readsPrec :: Int -> ReadS ByteString # readList :: ReadS [ByteString] # readPrec :: ReadPrec ByteString # readListPrec :: ReadPrec [ByteString] #
Show ByteString |
Instance details Defined in Data.ByteString.Internal.Type Methods showsPrec :: Int -> ByteString -> ShowS # show :: ByteString -> String # showList :: [ByteString] -> ShowS #
Eq ByteString |
Instance details Defined in Data.ByteString.Internal.Type Methods (==) :: ByteString -> ByteString -> Bool # (/=) :: ByteString -> ByteString -> Bool #
Ord ByteString |
Instance details Defined in Data.ByteString.Internal.Type Methods compare :: ByteString -> ByteString -> Ordering # (<) :: ByteString -> ByteString -> Bool # (<=) :: ByteString -> ByteString -> Bool # (>) :: ByteString -> ByteString -> Bool # (>=) :: ByteString -> ByteString -> Bool # max :: ByteString -> ByteString -> ByteString # min :: ByteString -> ByteString -> ByteString #
Lift ByteString | Since: bytestring-0.11.2.0
Instance details Defined in Data.ByteString.Internal.Type Methods lift :: Quote m => ByteString -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => ByteString -> Code m ByteString #
Monad m => Stream ByteString m Char |
Instance details Defined in Text.Parsec.Prim Methods uncons :: ByteString -> m (Maybe (Char, ByteString)) #
type Item ByteString |
Instance details Defined in Data.ByteString.Internal.Type type Item ByteString = Word8

## Cabal

fromUTF8BS :: ByteString -> String #

Decode `String` from UTF8-encoded `ByteString`

Invalid data in the UTF8 stream (this includes code-points `U+D800` through `U+DFFF`) will be decoded as the replacement character (`U+FFFD`).

toUTF8BS :: String -> ByteString #

Encode `String` to UTF8-encoded `ByteString`

Code-points in the `U+D800`-`U+DFFF` range will be encoded as the replacement character (i.e. `U+FFFD`).

pack' :: Newtype o n => (o -> n) -> o -> n #

Variant of `pack`, which takes a phantom type.

unpack' :: Newtype o n => (o -> n) -> n -> o #

Variant of `unpack`, which takes a phantom type.

## containers

data Set a #

A set of values `a`.

#### Instances

Instances details

Eq1 Set | Since: containers-0.5.9
Instance details Defined in Data.Set.Internal Methods liftEq :: (a -> b -> Bool) -> Set a -> Set b -> Bool #
Ord1 Set | Since: containers-0.5.9
Instance details Defined in Data.Set.Internal Methods liftCompare :: (a -> b -> Ordering) -> Set a -> Set b -> Ordering #
Show1 Set | Since: containers-0.5.9
Instance details Defined in Data.Set.Internal Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Set a -> ShowS # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Set a] -> ShowS #
Foldable Set | Folds in order of increasing key.
Instance details Defined in Data.Set.Internal Methods fold :: Monoid m => Set m -> m # foldMap :: Monoid m => (a -> m) -> Set a -> m # foldMap' :: Monoid m => (a -> m) -> Set a -> m # foldr :: (a -> b -> b) -> b -> Set a -> b # foldr' :: (a -> b -> b) -> b -> Set a -> b # foldl :: (b -> a -> b) -> b -> Set a -> b # foldl' :: (b -> a -> b) -> b -> Set a -> b # foldr1 :: (a -> a -> a) -> Set a -> a # foldl1 :: (a -> a -> a) -> Set a -> a # toList :: Set a -> [a] # null :: Set a -> Bool # length :: Set a -> Int # elem :: Eq a => a -> Set a -> Bool # maximum :: Ord a => Set a -> a # minimum :: Ord a => Set a -> a # sum :: Num a => Set a -> a # product :: Num a => Set a -> a #
Lift a => Lift (Set a :: Type) | Since: containers-0.6.6
Instance details Defined in Data.Set.Internal Methods lift :: Quote m => Set a -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Set a -> Code m (Set a) #
Structured k => Structured (Set k) |
Instance details Defined in Distribution.Utils.Structured Methods structure :: Proxy (Set k) -> Structure # structureHash' :: Tagged (Set k) MD5
NFData a => NFData (Set a) |
Instance details Defined in Data.Set.Internal Methods rnf :: Set a -> () #
Ord a => Monoid (Set a) |
Instance details Defined in Data.Set.Internal Methods mempty :: Set a # mappend :: Set a -> Set a -> Set a # mconcat :: [Set a] -> Set a #
Ord a => Semigroup (Set a) | Since: containers-0.5.7
Instance details Defined in Data.Set.Internal Methods (<>) :: Set a -> Set a -> Set a # sconcat :: NonEmpty (Set a) -> Set a # stimes :: Integral b => b -> Set a -> Set a #
(Data a, Ord a) => Data (Set a) |
Instance details Defined in Data.Set.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Set a -> c (Set a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Set a) # toConstr :: Set a -> Constr # dataTypeOf :: Set a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Set a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Set a)) # gmapT :: (forall b. Data b => b -> b) -> Set a -> Set a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Set a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Set a -> r # gmapQ :: (forall d. Data d => d -> u) -> Set a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Set a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) #
Ord a => IsList (Set a) | Since: containers-0.5.6.2
Instance details Defined in Data.Set.Internal Associated Types
type Item (Set a) |
Instance details Defined in Data.Set.Internal type Item (Set a) = a
Methods fromList :: [Item (Set a)] -> Set a # fromListN :: Int -> [Item (Set a)] -> Set a # toList :: Set a -> [Item (Set a)] #
(Read a, Ord a) => Read (Set a) |
Instance details Defined in Data.Set.Internal Methods readsPrec :: Int -> ReadS (Set a) # readList :: ReadS [Set a] # readPrec :: ReadPrec (Set a) # readListPrec :: ReadPrec [Set a] #
Show a => Show (Set a) |
Instance details Defined in Data.Set.Internal Methods showsPrec :: Int -> Set a -> ShowS # show :: Set a -> String # showList :: [Set a] -> ShowS #
Eq a => Eq (Set a) |
Instance details Defined in Data.Set.Internal Methods (==) :: Set a -> Set a -> Bool # (/=) :: Set a -> Set a -> Bool #
Ord a => Ord (Set a) |
Instance details Defined in Data.Set.Internal Methods compare :: Set a -> Set a -> Ordering # (<) :: Set a -> Set a -> Bool # (<=) :: Set a -> Set a -> Bool # (>) :: Set a -> Set a -> Bool # (>=) :: Set a -> Set a -> Bool # max :: Set a -> Set a -> Set a # min :: Set a -> Set a -> Set a #
Newtype (Set a) (Set' sep wrapper a) |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods pack :: Set a -> Set' sep wrapper a # unpack :: Set' sep wrapper a -> Set a #
type Item (Set a) |
Instance details Defined in Data.Set.Internal type Item (Set a) = a

## directory

dropExtension :: FilePath -> FilePath #

Remove last extension, and the "." preceding it.

    dropExtension "/directory/path.ext" == "/directory/path"
    dropExtension x == fst (splitExtension x)

splitDirectories :: FilePath -> [FilePath] #

Just as `splitPath`, but don't add the trailing slashes to each element.

             splitDirectories "/directory/file.ext" == ["/","directory","file.ext"]
             splitDirectories "test/file" == ["test","file"]
             splitDirectories "/test/file" == ["/","test","file"]
    Windows: splitDirectories "C:\\test\\file" == ["C:\\", "test", "file"]
             Valid x => joinPath (splitDirectories x) `equalFilePath` x
             splitDirectories "" == []
    Windows: splitDirectories "C:\\test\\\\\\file" == ["C:\\", "test", "file"]
             splitDirectories "/test///file" == ["/","test","file"]

## exceptions

catchError :: MonadError e m => m a -> (e -> m a) -> m a #

A handler function to handle previous errors and return to normal execution. A common idiom is:

    do { action1; action2; action3 } `catchError` handler

where the `action` functions can call `throwError`. Note that `handler` and the do-block must have the same return type.

throwError :: MonadError e m => e -> m a #

Is used within a monadic computation to begin exception processing.

# Extras

## Lens

traverseOf :: Applicative f => ((a -> f b) -> s -> f t) -> (a -> f b) -> s -> f t #

over :: ASetter s t a b -> (a -> b) -> s -> t #

view :: Getting a s a -> s -> a #

_1 :: Functor f => (a -> f b) -> (a, c) -> f (b, c) #

## Tuples

fstOf3 :: (a, b, c) -> a #

sndOf3 :: (a, b, c) -> b #

trdOf3 :: (a, b, c) -> c #