|
| 1 | +# Module Documentation |
| 2 | + |
| 3 | +## Module Control.Monad.List.Trans |
| 4 | + |
| 5 | + |
| 6 | +This module defines the list monad transformer, `ListT`. |
| 7 | + |
| 8 | +#### `ListT` |
| 9 | + |
| 10 | +``` purescript |
| 11 | +data ListT f a |
| 12 | +``` |
| 13 | + |
| 14 | +The list monad transformer. |
| 15 | + |
| 16 | +This monad transformer extends the base monad with _non-determinism_. |
| 17 | +That is, the transformed monad supports the same effects as the base monad |
| 18 | +but with multiple return values. |
| 19 | + |
| 20 | +#### `nil` |
| 21 | + |
| 22 | +``` purescript |
| 23 | +nil :: forall f a. (Applicative f) => ListT f a |
| 24 | +``` |
| 25 | + |
| 26 | +The empty list. |
| 27 | + |
| 28 | +#### `cons` |
| 29 | + |
| 30 | +``` purescript |
| 31 | +cons :: forall f a. (Applicative f) => Lazy a -> Lazy (ListT f a) -> ListT f a |
| 32 | +``` |
| 33 | + |
| 34 | +Attach an element to the front of a list. |
| 35 | + |
| 36 | +#### `prepend'` |
| 37 | + |
| 38 | +``` purescript |
| 39 | +prepend' :: forall f a. (Applicative f) => a -> Lazy (ListT f a) -> ListT f a |
| 40 | +``` |
| 41 | + |
| 42 | +Prepend an element to a lazily-evaluated list. |
| 43 | + |
| 44 | +#### `prepend` |
| 45 | + |
| 46 | +``` purescript |
| 47 | +prepend :: forall f a. (Applicative f) => a -> ListT f a -> ListT f a |
| 48 | +``` |
| 49 | + |
| 50 | +Prepend an element to a list. |
| 51 | + |
| 52 | +#### `singleton` |
| 53 | + |
| 54 | +``` purescript |
| 55 | +singleton :: forall f a. (Applicative f) => a -> ListT f a |
| 56 | +``` |
| 57 | + |
| 58 | +Create a list with one element. |
| 59 | + |
| 60 | +#### `fromEffect` |
| 61 | + |
| 62 | +``` purescript |
| 63 | +fromEffect :: forall f a. (Applicative f) => f a -> ListT f a |
| 64 | +``` |
| 65 | + |
| 66 | +Lift a computation from the base functor. |
| 67 | + |
| 68 | +#### `wrapEffect` |
| 69 | + |
| 70 | +``` purescript |
| 71 | +wrapEffect :: forall f a. (Functor f) => f (ListT f a) -> ListT f a |
| 72 | +``` |
| 73 | + |
| 74 | +Lift a computation from the base monad. |
| 75 | + |
| 76 | +#### `wrapLazy` |
| 77 | + |
| 78 | +``` purescript |
| 79 | +wrapLazy :: forall f a. (Applicative f) => Lazy (ListT f a) -> ListT f a |
| 80 | +``` |
| 81 | + |
| 82 | +Defer evaluation of a list. |
| 83 | + |
| 84 | +#### `unfold` |
| 85 | + |
| 86 | +``` purescript |
| 87 | +unfold :: forall f a z. (Monad f) => (z -> f (Maybe (Tuple z a))) -> z -> ListT f a |
| 88 | +``` |
| 89 | + |
| 90 | +Unfold a list using an effectful generator function. |
| 91 | + |
| 92 | +#### `iterate` |
| 93 | + |
| 94 | +``` purescript |
| 95 | +iterate :: forall f a. (Monad f) => (a -> a) -> a -> ListT f a |
| 96 | +``` |
| 97 | + |
| 98 | +Generate an infinite list by iterating a function. |
| 99 | + |
| 100 | +#### `repeat` |
| 101 | + |
| 102 | +``` purescript |
| 103 | +repeat :: forall f a. (Monad f) => a -> ListT f a |
| 104 | +``` |
| 105 | + |
| 106 | +Generate an infinite list by repeating a value. |
| 107 | + |
| 108 | +#### `take` |
| 109 | + |
| 110 | +``` purescript |
| 111 | +take :: forall f a. (Applicative f) => Number -> ListT f a -> ListT f a |
| 112 | +``` |
| 113 | + |
| 114 | +Take a number of elements from the front of a list. |
| 115 | + |
| 116 | +#### `takeWhile` |
| 117 | + |
| 118 | +``` purescript |
| 119 | +takeWhile :: forall f a. (Applicative f) => (a -> Boolean) -> ListT f a -> ListT f a |
| 120 | +``` |
| 121 | + |
| 122 | +Take elements from the front of a list while a predicate holds. |
| 123 | + |
| 124 | +#### `drop` |
| 125 | + |
| 126 | +``` purescript |
| 127 | +drop :: forall f a. (Applicative f) => Number -> ListT f a -> ListT f a |
| 128 | +``` |
| 129 | + |
| 130 | +Drop a number of elements from the front of a list. |
| 131 | + |
| 132 | +#### `dropWhile` |
| 133 | + |
| 134 | +``` purescript |
| 135 | +dropWhile :: forall f a. (Applicative f) => (a -> Boolean) -> ListT f a -> ListT f a |
| 136 | +``` |
| 137 | + |
| 138 | +Drop elements from the front of a list while a predicate holds. |
| 139 | + |
| 140 | +#### `filter` |
| 141 | + |
| 142 | +``` purescript |
| 143 | +filter :: forall f a. (Functor f) => (a -> Boolean) -> ListT f a -> ListT f a |
| 144 | +``` |
| 145 | + |
| 146 | +Remove elements from a list for which a predicate fails to hold. |
| 147 | + |
| 148 | +#### `mapMaybe` |
| 149 | + |
| 150 | +``` purescript |
| 151 | +mapMaybe :: forall f a b. (Functor f) => (a -> Maybe b) -> ListT f a -> ListT f b |
| 152 | +``` |
| 153 | + |
| 154 | +Apply a function to the elements of a list, keeping only those return values which contain a result. |
| 155 | + |
| 156 | +#### `catMaybes` |
| 157 | + |
| 158 | +``` purescript |
| 159 | +catMaybes :: forall f a. (Functor f) => ListT f (Maybe a) -> ListT f a |
| 160 | +``` |
| 161 | + |
| 162 | +Remove elements from a list which do not contain a value. |
| 163 | + |
| 164 | +#### `uncons` |
| 165 | + |
| 166 | +``` purescript |
| 167 | +uncons :: forall f a. (Monad f) => ListT f a -> f (Maybe (Tuple a (ListT f a))) |
| 168 | +``` |
| 169 | + |
| 170 | +Perform the first step of a computation in the `ListT` monad. |
| 171 | + |
| 172 | +#### `head` |
| 173 | + |
| 174 | +``` purescript |
| 175 | +head :: forall f a. (Monad f) => ListT f a -> f (Maybe a) |
| 176 | +``` |
| 177 | + |
| 178 | +Extract the first element of a list. |
| 179 | + |
| 180 | +#### `tail` |
| 181 | + |
| 182 | +``` purescript |
| 183 | +tail :: forall f a. (Monad f) => ListT f a -> f (Maybe (ListT f a)) |
| 184 | +``` |
| 185 | + |
| 186 | +Extract all but the first element of a list. |
| 187 | + |
| 188 | +#### `foldl'` |
| 189 | + |
| 190 | +``` purescript |
| 191 | +foldl' :: forall f a b. (Monad f) => (b -> a -> f b) -> b -> ListT f a -> f b |
| 192 | +``` |
| 193 | + |
| 194 | +Fold a list from the left, accumulating the result (effectfully) using the specified function. |
| 195 | + |
| 196 | +#### `foldl` |
| 197 | + |
| 198 | +``` purescript |
| 199 | +foldl :: forall f a b. (Monad f) => (b -> a -> b) -> b -> ListT f a -> f b |
| 200 | +``` |
| 201 | + |
| 202 | +Fold a list from the left, accumulating the result using the specified function. |
| 203 | + |
| 204 | +#### `scanl` |
| 205 | + |
| 206 | +``` purescript |
| 207 | +scanl :: forall f a b. (Monad f) => (b -> a -> b) -> b -> ListT f a -> ListT f b |
| 208 | +``` |
| 209 | + |
| 210 | +Fold a list from the left, accumulating the list of results using the specified function. |
| 211 | + |
| 212 | +#### `zipWith'` |
| 213 | + |
| 214 | +``` purescript |
| 215 | +zipWith' :: forall f a b c. (Monad f) => (a -> b -> f c) -> ListT f a -> ListT f b -> ListT f c |
| 216 | +``` |
| 217 | + |
| 218 | +Zip the elements of two lists, combining elements at the same position from each list. |
| 219 | + |
| 220 | +#### `zipWith` |
| 221 | + |
| 222 | +``` purescript |
| 223 | +zipWith :: forall f a b c. (Monad f) => (a -> b -> c) -> ListT f a -> ListT f b -> ListT f c |
| 224 | +``` |
| 225 | + |
| 226 | +Zip the elements of two lists, combining elements at the same position from each list. |
| 227 | + |
| 228 | +#### `semigroupListT` |
| 229 | + |
| 230 | +``` purescript |
| 231 | +instance semigroupListT :: (Applicative f) => Semigroup (ListT f a) |
| 232 | +``` |
| 233 | + |
| 234 | + |
| 235 | +#### `monoidListT` |
| 236 | + |
| 237 | +``` purescript |
| 238 | +instance monoidListT :: (Applicative f) => Monoid (ListT f a) |
| 239 | +``` |
| 240 | + |
| 241 | + |
| 242 | +#### `functorListT` |
| 243 | + |
| 244 | +``` purescript |
| 245 | +instance functorListT :: (Functor f) => Functor (ListT f) |
| 246 | +``` |
| 247 | + |
| 248 | + |
| 249 | +#### `unfoldableListT` |
| 250 | + |
| 251 | +``` purescript |
| 252 | +instance unfoldableListT :: (Monad f) => Unfoldable (ListT f) |
| 253 | +``` |
| 254 | + |
| 255 | + |
| 256 | +#### `applyListT` |
| 257 | + |
| 258 | +``` purescript |
| 259 | +instance applyListT :: (Monad f) => Apply (ListT f) |
| 260 | +``` |
| 261 | + |
| 262 | + |
| 263 | +#### `applicativeListT` |
| 264 | + |
| 265 | +``` purescript |
| 266 | +instance applicativeListT :: (Monad f) => Applicative (ListT f) |
| 267 | +``` |
| 268 | + |
| 269 | + |
| 270 | +#### `bindListT` |
| 271 | + |
| 272 | +``` purescript |
| 273 | +instance bindListT :: (Monad f) => Bind (ListT f) |
| 274 | +``` |
| 275 | + |
| 276 | + |
| 277 | +#### `monadListT` |
| 278 | + |
| 279 | +``` purescript |
| 280 | +instance monadListT :: (Monad f) => Monad (ListT f) |
| 281 | +``` |
| 282 | + |
| 283 | + |
| 284 | +#### `monadTransListT` |
| 285 | + |
| 286 | +``` purescript |
| 287 | +instance monadTransListT :: MonadTrans ListT |
| 288 | +``` |
| 289 | + |
| 290 | + |
| 291 | +#### `altListT` |
| 292 | + |
| 293 | +``` purescript |
| 294 | +instance altListT :: (Applicative f) => Alt (ListT f) |
| 295 | +``` |
| 296 | + |
| 297 | + |
| 298 | +#### `plusListT` |
| 299 | + |
| 300 | +``` purescript |
| 301 | +instance plusListT :: (Monad f) => Plus (ListT f) |
| 302 | +``` |
| 303 | + |
| 304 | + |
| 305 | +#### `alternativeListT` |
| 306 | + |
| 307 | +``` purescript |
| 308 | +instance alternativeListT :: (Monad f) => Alternative (ListT f) |
| 309 | +``` |
| 310 | + |
| 311 | + |
| 312 | +#### `monadPlusListT` |
| 313 | + |
| 314 | +``` purescript |
| 315 | +instance monadPlusListT :: (Monad f) => MonadPlus (ListT f) |
| 316 | +``` |
| 317 | + |
| 318 | + |
| 319 | + |
| 320 | + |
0 commit comments