/usr/share/doc/libghc-base-prelude-doc/html/base-prelude.txt is in libghc-base-prelude-doc 1.2.0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | -- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | The most complete prelude formed solely from the "base" package
--
-- A library which aims to reexport all the non-conflicting and most
-- general definitions from the "base" package. This includes APIs for
-- applicatives, arrows, monoids, foldables, traversables, exceptions,
-- generics, ST, MVars and STM.
--
-- This package will never have any dependencies other than "base".
--
-- <i>Versioning policy</i>
--
-- The versioning policy of this package deviates from PVP in the sense
-- that its exports in part are transitively determined by the version of
-- "base". Therefore it's recommended for the users of "base-prelude" to
-- specify the bounds of "base" as well.
@package base-prelude
@version 1.2.0.1
-- | This module reexports most of the definitions from the "base" package,
-- which are meant to be imported unqualified.
--
-- For details check out the source.
module BasePrelude
-- | Case analysis for the <a>Bool</a> type. <tt><a>bool</a> x y p</tt>
-- evaluates to <tt>x</tt> when <tt>p</tt> is <a>False</a>, and evaluates
-- to <tt>y</tt> when <tt>p</tt> is <a>True</a>.
--
-- This is equivalent to <tt>if p then y else x</tt>; that is, one can
-- think of it as an if-then-else construct with its arguments reordered.
--
-- <h4><b>Examples</b></h4>
--
-- Basic usage:
--
-- <pre>
-- >>> bool "foo" "bar" True
-- "bar"
--
-- >>> bool "foo" "bar" False
-- "foo"
-- </pre>
--
-- Confirm that <tt><a>bool</a> x y p</tt> and <tt>if p then y else
-- x</tt> are equivalent:
--
-- <pre>
-- >>> let p = True; x = "bar"; y = "foo"
--
-- >>> bool x y p == if p then y else x
-- True
--
-- >>> let p = False
--
-- >>> bool x y p == if p then y else x
-- True
-- </pre>
bool :: a -> a -> Bool -> a
-- | <a>&</a> is a reverse application operator. This provides
-- notational convenience. Its precedence is one higher than that of the
-- forward application operator <a>$</a>, which allows <a>&</a> to be
-- nested in <a>$</a>.
(&) :: a -> (a -> b) -> b
infixl 1 &
-- | Flipped version of <a><$</a>.
--
-- <h4><b>Examples</b></h4>
--
-- Replace the contents of a <tt><tt>Maybe</tt> <tt>Int</tt></tt> with a
-- constant <tt>String</tt>:
--
-- <pre>
-- >>> Nothing $> "foo"
-- Nothing
--
-- >>> Just 90210 $> "foo"
-- Just "foo"
-- </pre>
--
-- Replace the contents of an <tt><tt>Either</tt> <tt>Int</tt>
-- <tt>Int</tt></tt> with a constant <tt>String</tt>, resulting in an
-- <tt><tt>Either</tt> <tt>Int</tt> <tt>String</tt></tt>:
--
-- <pre>
-- >>> Left 8675309 $> "foo"
-- Left 8675309
--
-- >>> Right 8675309 $> "foo"
-- Right "foo"
-- </pre>
--
-- Replace each element of a list with a constant <tt>String</tt>:
--
-- <pre>
-- >>> [1,2,3] $> "foo"
-- ["foo","foo","foo"]
-- </pre>
--
-- Replace the second element of a pair with a constant <tt>String</tt>:
--
-- <pre>
-- >>> (1,2) $> "foo"
-- (1,"foo")
-- </pre>
($>) :: Functor f => f a -> b -> f b
infixl 4 $>
-- | The <a>isSubsequenceOf</a> function takes two lists and returns
-- <a>True</a> if all the elements of the first list occur, in order, in
-- the second. The elements do not have to occur consecutively.
--
-- <tt><a>isSubsequenceOf</a> x y</tt> is equivalent to <tt><a>elem</a> x
-- (<a>subsequences</a> y)</tt>.
--
-- <h4><b>Examples</b></h4>
--
-- <pre>
-- >>> isSubsequenceOf "GHC" "The Glorious Haskell Compiler"
-- True
--
-- >>> isSubsequenceOf ['a','d'..'z'] ['a'..'z']
-- True
--
-- >>> isSubsequenceOf [1..10] [10,9..0]
-- False
-- </pre>
isSubsequenceOf :: Eq a => [a] -> [a] -> Bool
-- | Sort a list by comparing the results of a key function applied to each
-- element. <tt>sortOn f</tt> is equivalent to <tt>sortBy (comparing
-- f)</tt>, but has the performance advantage of only evaluating
-- <tt>f</tt> once for each element in the input list. This is called the
-- decorate-sort-undecorate paradigm, or Schwartzian transform.
sortOn :: Ord b => (a -> b) -> [a] -> [a]
-- | Decompose a list into its head and tail. If the list is empty, returns
-- <a>Nothing</a>. If the list is non-empty, returns <tt><a>Just</a> (x,
-- xs)</tt>, where <tt>x</tt> is the head of the list and <tt>xs</tt> its
-- tail.
uncons :: [a] -> Maybe (a, [a])
-- | Like <a>traceShow</a> but returns the shown value instead of a third
-- value.
traceShowId :: Show a => a -> a
-- | Like <a>trace</a> but returning unit in an arbitrary
-- <a>Applicative</a> context. Allows for convenient use in do-notation.
--
-- Note that the application of <a>traceM</a> is not an action in the
-- <a>Applicative</a> context, as <a>traceIO</a> is in the <a>IO</a>
-- type. While the fresh bindings in the following example will force the
-- <a>traceM</a> expressions to be reduced every time the
-- <tt>do</tt>-block is executed, <tt>traceM "not crashed"</tt> would
-- only be reduced once, and the message would only be printed once. If
-- your monad is in <tt>MonadIO</tt>, <tt>liftIO . traceIO</tt> may be a
-- better option.
--
-- <pre>
-- ... = do
-- x <- ...
-- traceM $ "x: " ++ show x
-- y <- ...
-- traceM $ "y: " ++ show y
-- </pre>
traceM :: Applicative f => String -> f ()
-- | Like <a>traceM</a>, but uses <a>show</a> on the argument to convert it
-- to a <a>String</a>.
--
-- <pre>
-- ... = do
-- x <- ...
-- traceShowM $ x
-- y <- ...
-- traceShowM $ x + y
-- </pre>
traceShowM :: (Show a, Applicative f) => a -> f ()
|