This file is indexed.

/usr/share/doc/libghc-utility-ht-doc/html/utility-ht.txt is in libghc-utility-ht-doc 0.0.11-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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Various small helper functions for Lists, Maybes, Tuples, Functions
--   
--   Various small helper functions for Lists, Maybes, Tuples, Functions.
--   Some of these functions are improved implementations of standard
--   functions. They have the same name as their standard counterparts.
--   Others are equivalent to functions from the <tt>base</tt> package, but
--   if you import them from this utility package then you can write code
--   that runs on older GHC versions or other compilers like Hugs and JHC.
--   
--   All modules are plain Haskell 98. The package depends exclusively on
--   the <tt>base</tt> package and only that portions of <tt>base</tt> that
--   are simple to port. Thus you do not risk a dependency avalanche by
--   importing it. However, further splitting the base package might
--   invalidate this statement.
--   
--   Alternative packages: <tt>Useful</tt>, <tt>MissingH</tt>
@package utility-ht
@version 0.0.11

module Text.Show.HT

-- | Show a value using an infix operator.
showsInfixPrec :: (Show a, Show b) => String -> Int -> Int -> a -> b -> ShowS
concatS :: [ShowS] -> ShowS

module Text.Read.HT

-- | Parse a string containing an infix operator.
readsInfixPrec :: (Read a, Read b) => String -> Int -> Int -> (a -> b -> c) -> ReadS c

-- | Compose two parsers sequentially.
(.>) :: ReadS (b -> c) -> ReadS b -> ReadS c
readMany :: (Read a) => String -> [a]
maybeRead :: Read a => String -> Maybe a

module Data.Strictness.HT
arguments1 :: (a -> x) -> a -> x
arguments2 :: (a -> b -> x) -> a -> b -> x
arguments3 :: (a -> b -> c -> x) -> a -> b -> c -> x
arguments4 :: (a -> b -> c -> d -> x) -> a -> b -> c -> d -> x
arguments5 :: (a -> b -> c -> d -> e -> x) -> a -> b -> c -> d -> e -> x

module Control.Monad.HT

-- | Also present in newer versions of the <tt>base</tt> package.
(<=<) :: Monad m => (b -> m c) -> (a -> m b) -> (a -> m c)

-- | Monadic <a>repeat</a>.
repeat :: (Monad m) => m a -> m [a]

-- | repeat action until result fulfills condition
until :: (Monad m) => (a -> Bool) -> m a -> m a

-- | repeat action until result fulfills condition

-- | <i>Deprecated: use M.until</i>
untilM :: (Monad m) => (a -> Bool) -> m a -> m a

-- | parameter order equal to that of <tt>nest</tt>
iterateLimit :: Monad m => Int -> (a -> m a) -> a -> m [a]

-- | parameter order equal to that of <tt>nest</tt>

-- | <i>Deprecated: use M.iterateLimit</i>
iterateLimitM :: Monad m => Int -> (a -> m a) -> a -> m [a]

-- | Lazy monadic conjunction. That is, when the first action returns
--   <tt>False</tt>, then <tt>False</tt> is immediately returned, without
--   running the second action.
andLazy :: (Monad m) => m Bool -> m Bool -> m Bool

-- | Lazy monadic disjunction. That is, when the first action returns
--   <tt>True</tt>, then <tt>True</tt> is immediately returned, without
--   running the second action.
orLazy :: (Monad m) => m Bool -> m Bool -> m Bool
void :: (Monad m) => m a -> m ()
for :: Monad m => [a] -> (a -> m b) -> m [b]
map :: Monad m => (a -> m b) -> [a] -> m [b]
zipWith :: Monad m => (a -> b -> m c) -> [a] -> [b] -> m [c]
chain :: (Monad m) => [a -> m a] -> (a -> m a)
filter :: Monad m => (a -> m Bool) -> [a] -> m [a]
replicate :: Monad m => Int -> m a -> m [a]
lift :: Monad m => (a -> r) -> m a -> m r
lift2 :: Monad m => (a -> b -> r) -> m a -> m b -> m r
lift3 :: Monad m => (a -> b -> c -> r) -> m a -> m b -> m c -> m r
lift4 :: Monad m => (a -> b -> c -> d -> r) -> m a -> m b -> m c -> m d -> m r
lift5 :: Monad m => (a -> b -> c -> d -> e -> r) -> m a -> m b -> m c -> m d -> m e -> m r
liftJoin2 :: (Monad m) => (a -> b -> m c) -> m a -> m b -> m c
liftJoin3 :: (Monad m) => (a -> b -> c -> m d) -> m a -> m b -> m c -> m d
liftJoin4 :: (Monad m) => (a -> b -> c -> d -> m e) -> m a -> m b -> m c -> m d -> m e
liftJoin5 :: (Monad m) => (a -> b -> c -> d -> e -> m f) -> m a -> m b -> m c -> m d -> m e -> m f

module Data.Tuple.Strict
mapPair :: (a -> c, b -> d) -> (a, b) -> (c, d)
mapFst :: (a -> c) -> (a, b) -> (c, b)
mapSnd :: (b -> c) -> (a, b) -> (a, c)
swap :: (a, b) -> (b, a)
mapTriple :: (a -> d, b -> e, c -> f) -> (a, b, c) -> (d, e, f)
mapFst3 :: (a -> d) -> (a, b, c) -> (d, b, c)
mapSnd3 :: (b -> d) -> (a, b, c) -> (a, d, c)
mapThd3 :: (c -> d) -> (a, b, c) -> (a, b, d)
uncurry3 :: (a -> b -> c -> d) -> ((a, b, c) -> d)

module Data.Tuple.Lazy

-- | Cf. '(Control.Arrow.***)'.
--   
--   Apply two functions on corresponding values in a pair, where the
--   pattern match on the pair constructor is lazy. This is crucial in
--   recursions such as the one of <tt>partition</tt>. One the other hand
--   there are applications where strict application is crucial, e.g.
--   <tt>mapSnd f ab</tt> where the left pair member is a large lazy list.
--   With the lazy <tt>mapSnd</tt> we make the application of <tt>f</tt>
--   depend on the whole pair <tt>ab</tt>. See <a>Data.Tuple.Example</a>
--   for two examples where one variant is definitely better than the other
--   one.
mapPair :: (a -> c, b -> d) -> (a, b) -> (c, d)

-- | <a>first</a>
mapFst :: (a -> c) -> (a, b) -> (c, b)

-- | <a>second</a>
mapSnd :: (b -> c) -> (a, b) -> (a, c)
swap :: (a, b) -> (b, a)
forcePair :: (a, b) -> (a, b)
mapTriple :: (a -> d, b -> e, c -> f) -> (a, b, c) -> (d, e, f)
mapFst3 :: (a -> d) -> (a, b, c) -> (d, b, c)
mapSnd3 :: (b -> d) -> (a, b, c) -> (a, d, c)
mapThd3 :: (c -> d) -> (a, b, c) -> (a, b, d)
uncurry3 :: (a -> b -> c -> d) -> ((a, b, c) -> d)

module Data.Tuple.HT

-- | Cf. '(Control.Arrow.***)'.
--   
--   Apply two functions on corresponding values in a pair, where the
--   pattern match on the pair constructor is lazy. This is crucial in
--   recursions such as the one of <tt>partition</tt>. One the other hand
--   there are applications where strict application is crucial, e.g.
--   <tt>mapSnd f ab</tt> where the left pair member is a large lazy list.
--   With the lazy <tt>mapSnd</tt> we make the application of <tt>f</tt>
--   depend on the whole pair <tt>ab</tt>. See <a>Data.Tuple.Example</a>
--   for two examples where one variant is definitely better than the other
--   one.
mapPair :: (a -> c, b -> d) -> (a, b) -> (c, d)

-- | <a>first</a>
mapFst :: (a -> c) -> (a, b) -> (c, b)

-- | <a>second</a>
mapSnd :: (b -> c) -> (a, b) -> (a, c)
swap :: (a, b) -> (b, a)
forcePair :: (a, b) -> (a, b)
fst3 :: (a, b, c) -> a
snd3 :: (a, b, c) -> b
thd3 :: (a, b, c) -> c
mapTriple :: (a -> d, b -> e, c -> f) -> (a, b, c) -> (d, e, f)
mapFst3 :: (a -> d) -> (a, b, c) -> (d, b, c)
mapSnd3 :: (b -> d) -> (a, b, c) -> (a, d, c)
mapThd3 :: (c -> d) -> (a, b, c) -> (a, b, d)
curry3 :: ((a, b, c) -> d) -> a -> b -> c -> d
uncurry3 :: (a -> b -> c -> d) -> ((a, b, c) -> d)

module Control.Functor.HT
void :: Functor f => f a -> f ()
map :: Functor f => (a -> b) -> f a -> f b
for :: Functor f => f a -> (a -> b) -> f b

-- | Caution: Every pair member has a reference to the argument of
--   <a>unzip</a>. Depending on the consumption pattern this may cause a
--   memory leak. For lists, I think, you should generally prefer
--   <a>unzip</a>.
unzip :: Functor f => f (a, b) -> (f a, f b)

-- | Caution: See <a>unzip</a>.
unzip3 :: Functor f => f (a, b, c) -> (f a, f b, f c)

-- | Generalization of <a>outerProduct</a>.
outerProduct :: (Functor f, Functor g) => (a -> b -> c) -> f a -> g b -> f (g c)

module Data.Monoid.HT

-- | Generalization of <a>cycle</a> to any monoid.
cycle :: Monoid m => m -> m

-- | Infix synonym for <a>mappend</a>.
(<>) :: Monoid m => m -> m -> m
when :: Monoid m => Bool -> m -> m

module Data.Maybe.HT

-- | Returns <a>Just</a> if the precondition is fulfilled.
toMaybe :: Bool -> a -> Maybe a

-- | This is an infix version of <a>fmap</a> for writing <a>select</a>
--   style expressions using test functions, that produce <a>Maybe</a>s.
--   
--   The precedence is chosen to be higher than '(:)', in order to allow:
--   
--   <pre>
--   alternatives default $
--      checkForA ?-&gt; (\a -&gt; f a) :
--      checkForB ?-&gt; (\b -&gt; g b) :
--      []
--   </pre>
--   
--   The operation is left associative in order to allow to write
--   
--   <pre>
--   checkForA ?-&gt; f ?-&gt; g
--   </pre>
--   
--   which is equivalent to
--   
--   <pre>
--   checkForA ?-&gt; g . f
--   </pre>
--   
--   due to the functor law.
(?->) :: Maybe a -> (a -> b) -> Maybe b
alternatives :: a -> [Maybe a] -> a


-- | Implementations of <tt>Ix</tt> methods in terms of <a>Enum</a>
--   methods.
--   
--   For a type <tt>T</tt> of class <a>Enum</a> you can easily define an
--   <tt>Ix</tt> instance by copying the following code into your module:
--   
--   <pre>
--   import qualified Data.Ix.Enum as IxEnum
--   
--   instance Ix T where
--      range           = IxEnum.range
--      index           = IxEnum.index
--      inRange         = IxEnum.inRange
--      rangeSize       = IxEnum.rangeSize
--      unsafeIndex     = IxEnum.unsafeIndex
--      unsafeRangeSize = IxEnum.unsafeRangeSize
--   </pre>
module Data.Ix.Enum
range :: Enum a => (a, a) -> [a]
index :: Enum a => (a, a) -> a -> Int
unsafeIndex :: Enum a => (a, a) -> a -> Int
inRange :: Enum a => (a, a) -> a -> Bool
rangeSize :: Enum a => (a, a) -> Int
unsafeRangeSize :: Enum a => (a, a) -> Int

module Data.Function.HT

-- | Compositional power of a function, i.e. apply the function <tt>n</tt>
--   times to a value. It is rather the same as <tt>iter</tt> in Simon
--   Thompson: "The Craft of Functional Programming", page 172
nest :: Int -> (a -> a) -> a -> a

-- | <tt>powerAssociative</tt> is an auxiliary function that, for an
--   associative operation <tt>op</tt>, computes the same value as
--   
--   <pre>
--   powerAssociative op a0 a n = foldr op a0 (genericReplicate n a)
--   </pre>
--   
--   but applies "op" O(log n) times and works for large n.
powerAssociative :: (a -> a -> a) -> a -> a -> Integer -> a

-- | Known as <tt>on</tt> in newer versions of the <tt>base</tt> package.
compose2 :: (b -> b -> c) -> (a -> b) -> (a -> a -> c)


-- | Variant of <a>Data.List</a> functions like <a>group</a>, <a>sort</a>
--   where the comparison is performed on a key computed from the list
--   elements. In principle these functions could be replaced by e.g.
--   <tt>sortBy (compare <tt>on</tt> f)</tt>, but <tt>f</tt> will be
--   re-computed for every comparison. If the evaluation of <tt>f</tt> is
--   expensive, our functions are better, since they buffer the results of
--   <tt>f</tt>.
module Data.List.Key
nub :: Eq b => (a -> b) -> [a] -> [a]
sort :: Ord b => (a -> b) -> [a] -> [a]

-- | argmin
minimum :: Ord b => (a -> b) -> [a] -> a

-- | argmax
maximum :: Ord b => (a -> b) -> [a] -> a

-- | Divides a list into sublists such that the members in a sublist share
--   the same key. It uses semantics of <a>groupBy</a>, not that of
--   <a>groupBy</a>.
group :: Eq b => (a -> b) -> [a] -> [[a]]
merge :: Ord b => (a -> b) -> [a] -> [a] -> [a]

module Data.Ord.HT
comparing :: Ord b => (a -> b) -> a -> a -> Ordering

-- | <tt>limit (lower,upper) x</tt> restricts <tt>x</tt> to the range from
--   <tt>lower</tt> to <tt>upper</tt>. Don't expect a sensible result for
--   <tt>lower&gt;upper</tt>.
limit :: (Ord a) => (a, a) -> a -> a

-- | <tt>limit (lower,upper) x</tt> checks whether <tt>x</tt> is in the
--   range from <tt>lower</tt> to <tt>upper</tt>. Don't expect a sensible
--   result for <tt>lower&gt;upper</tt>.
inRange :: (Ord a) => (a, a) -> a -> Bool

module Data.Eq.HT
equating :: Eq b => (a -> b) -> a -> a -> Bool

module Data.Bool.HT

-- | <tt>if-then-else</tt> as function.
--   
--   Example:
--   
--   <pre>
--   if' (even n) "even" $
--   if' (isPrime n) "prime" $
--   "boring"
--   </pre>
if' :: Bool -> a -> a -> a

-- | The same as <a>if'</a>, but the name is chosen such that it can be
--   used for GHC-7.0's rebindable if-then-else syntax.
ifThenElse :: Bool -> a -> a -> a

-- | From a list of expressions choose the one, whose condition is true.
--   
--   Example:
--   
--   <pre>
--   select "boring" $
--     (even n, "even") :
--     (isPrime n, "prime") :
--     []
--   </pre>
select :: a -> [(Bool, a)] -> a

-- | Like the <tt>?</tt> operator of the C progamming language. Example:
--   <tt>bool ?: ("yes", "no")</tt>.
(?:) :: Bool -> (a, a) -> a

-- | Logical operator for implication.
--   
--   Funnily because of the ordering of <a>Bool</a> it holds <tt>implies ==
--   (&lt;=)</tt>.
implies :: Bool -> Bool -> Bool

module Data.List.HT

-- | This function is lazier than the one suggested in the Haskell 98
--   report. It is <tt>inits undefined = [] : undefined</tt>, in contrast
--   to <tt>Data.List.inits undefined = undefined</tt>.
inits :: [a] -> [[a]]

-- | This function is lazier than the one suggested in the Haskell 98
--   report. It is <tt>tails undefined = ([] : undefined) : undefined</tt>,
--   in contrast to <tt>Data.List.tails undefined = undefined</tt>.
tails :: [a] -> [[a]]

-- | This function compares adjacent elements of a list. If two adjacent
--   elements satisfy a relation then they are put into the same sublist.
--   Example:
--   
--   <pre>
--   groupBy (&lt;) "abcdebcdef"  ==  ["abcde","bcdef"]
--   </pre>
--   
--   In contrast to that <a>groupBy</a> compares the head of each sublist
--   with each candidate for this sublist. This yields
--   
--   <pre>
--   List.groupBy (&lt;) "abcdebcdef"  ==  ["abcdebcdef"]
--   </pre>
--   
--   The second <tt><tt>b</tt></tt> is compared with the leading
--   <tt><tt>a</tt></tt>. Thus it is put into the same sublist as
--   <tt><tt>a</tt></tt>.
--   
--   The sublists are never empty. Thus the more precise result type would
--   be <tt>[(a,[a])]</tt>.
groupBy :: (a -> a -> Bool) -> [a] -> [[a]]
group :: (Eq a) => [a] -> [[a]]

-- | Like standard <a>unzip</a> but more lazy. It is <tt>Data.List.unzip
--   undefined == undefined</tt>, but <tt>unzip undefined == (undefined,
--   undefined)</tt>.
unzip :: [(a, b)] -> ([a], [b])

-- | <a>partition</a> of GHC 6.2.1 fails on infinite lists. But this one
--   does not.
partition :: (a -> Bool) -> [a] -> ([a], [a])

-- | It is <tt>Data.List.span f undefined = undefined</tt>, whereas
--   <tt>span f undefined = (undefined, undefined)</tt>.
span :: (a -> Bool) -> [a] -> ([a], [a])

-- | It is <tt>Data.List.span f undefined = undefined</tt>, whereas
--   <tt>span f undefined = (undefined, undefined)</tt>.
break :: (a -> Bool) -> [a] -> ([a], [a])

-- | Split the list at the occurrences of a separator into sub-lists.
--   Remove the separators. This is somehow a generalization of
--   <a>lines</a> and <a>words</a>. But note the differences:
--   
--   <pre>
--   Prelude Data.List.HT&gt; words "a  a"
--   ["a","a"]
--   Prelude Data.List.HT&gt; chop (' '==) "a  a"
--   ["a","","a"]
--   </pre>
--   
--   <pre>
--   Prelude Data.List.HT&gt; lines "a\n\na"
--   ["a","","a"]
--   Prelude Data.List.HT&gt; chop ('\n'==) "a\n\na"
--   ["a","","a"]
--   </pre>
--   
--   <pre>
--   Prelude Data.List.HT&gt; lines "a\n"
--   ["a"]
--   Prelude Data.List.HT&gt; chop ('\n'==) "a\n"
--   ["a",""]
--   </pre>
chop :: (a -> Bool) -> [a] -> [[a]]

-- | Like <a>break</a>, but splits after the matching element.
breakAfter :: (a -> Bool) -> [a] -> ([a], [a])

-- | Split the list after each occurence of a terminator. Keep the
--   terminator. There is always a list for the part after the last
--   terminator. It may be empty. See package <tt>non-empty</tt> for more
--   precise result type.
segmentAfter :: (a -> Bool) -> [a] -> [[a]]

-- | Split the list before each occurence of a leading character. Keep
--   these characters. There is always a list for the part before the first
--   leading character. It may be empty. See package <tt>non-empty</tt> for
--   more precise result type.
segmentBefore :: (a -> Bool) -> [a] -> [[a]]

-- | <pre>
--   Data.List.HT Data.Char&gt; segmentAfterMaybe (\c -&gt; toMaybe (isLetter c) (toUpper c)) "123a5345b---"
--   ([("123",'A'),("5345",'B')],"---")
--   </pre>
segmentAfterMaybe :: (a -> Maybe b) -> [a] -> ([([a], b)], [a])

-- | <pre>
--   Data.List.HT Data.Char&gt; segmentBeforeMaybe (\c -&gt; toMaybe (isLetter c) (toUpper c)) "123a5345b---"
--   ("123",[('A',"5345"),('B',"---")])
--   </pre>
segmentBeforeMaybe :: (a -> Maybe b) -> [a] -> ([a], [(b, [a])])

-- | <tt>removeEach xs</tt> represents a list of sublists of <tt>xs</tt>,
--   where each element of <tt>xs</tt> is removed and the removed element
--   is separated. It seems to be much simpler to achieve with <tt>zip xs
--   (map (flip List.delete xs) xs)</tt>, but the implementation of
--   <a>removeEach</a> does not need the <a>Eq</a> instance and thus can
--   also be used for lists of functions.
--   
--   See also the proposal
--   <a>http://www.haskell.org/pipermail/libraries/2008-February/009270.html</a>
removeEach :: [a] -> [(a, [a])]
splitEverywhere :: [a] -> [([a], a, [a])]

-- | It holds <tt>splitLast xs == (init xs, last xs)</tt>, but
--   <a>splitLast</a> is more efficient if the last element is accessed
--   after the initial ones, because it avoids memoizing list.

-- | <i>Deprecated: use viewR instead</i>
splitLast :: [a] -> ([a], a)

-- | Should be prefered to <a>head</a> and <a>tail</a>.
viewL :: [a] -> Maybe (a, [a])

-- | Should be prefered to <a>init</a> and <a>last</a>.
viewR :: [a] -> Maybe ([a], a)

-- | Should be prefered to <a>head</a> and <a>tail</a>.
switchL :: b -> (a -> [a] -> b) -> [a] -> b

-- | Should be prefered to <a>init</a> and <a>last</a>.
switchR :: b -> ([a] -> a -> b) -> [a] -> b

-- | <tt>dropRev n</tt> is like <tt>reverse . drop n . reverse</tt> but it
--   is lazy enough to work for infinite lists, too.
dropRev :: Int -> [a] -> [a]

-- | <tt>takeRev n</tt> is like <tt>reverse . take n . reverse</tt> but it
--   is lazy enough to work for infinite lists, too.
takeRev :: Int -> [a] -> [a]

-- | Remove the longest suffix of elements satisfying p. In contrast to
--   <tt>reverse . dropWhile p . reverse</tt> this works for infinite
--   lists, too.
dropWhileRev :: (a -> Bool) -> [a] -> [a]

-- | Alternative version of <tt>reverse . takeWhile p . reverse</tt>.
takeWhileRev :: (a -> Bool) -> [a] -> [a]

-- | <tt>maybePrefixOf xs ys</tt> is <tt>Just zs</tt> if <tt>xs</tt> is a
--   prefix of <tt>ys</tt>, where <tt>zs</tt> is <tt>ys</tt> without the
--   prefix <tt>xs</tt>. Otherwise it is <tt>Nothing</tt>.
maybePrefixOf :: Eq a => [a] -> [a] -> Maybe [a]

-- | Partition a list into elements which evaluate to <tt>Just</tt> or
--   <tt>Nothing</tt> by <tt>f</tt>.
--   
--   It holds <tt>mapMaybe f == fst . partitionMaybe f</tt> and
--   <tt>partition p == partitionMaybe ( x -&gt; toMaybe (p x) x)</tt>.
partitionMaybe :: (a -> Maybe b) -> [a] -> ([b], [a])

-- | This is the cousin of <a>takeWhile</a> analogously to <a>catMaybes</a>
--   being the cousin of <a>filter</a>.
--   
--   Example: Keep the heads of sublists until an empty list occurs.
--   
--   <pre>
--   takeWhileJust $ map (fmap fst . viewL) xs
--   </pre>
takeWhileJust :: [Maybe a] -> [a]
unzipEithers :: [Either a b] -> ([a], [b])

-- | keep every k-th value from the list
sieve :: Int -> [a] -> [a]
sliceHorizontal :: Int -> [a] -> [[a]]
sliceVertical :: Int -> [a] -> [[a]]
search :: (Eq a) => [a] -> [a] -> [Int]
replace :: Eq a => [a] -> [a] -> [a] -> [a]
multiReplace :: Eq a => [([a], [a])] -> [a] -> [a]

-- | Transform
--   
--   <pre>
--   [[00,01,02,...],          [[00],
--    [10,11,12,...],   --&gt;     [10,01],
--    [20,21,22,...],           [20,11,02],
--    ...]                      ...]
--   </pre>
--   
--   With <tt>concat . shear</tt> you can perform a Cantor diagonalization,
--   that is an enumeration of all elements of the sub-lists where each
--   element is reachable within a finite number of steps. It is also
--   useful for polynomial multiplication (convolution).
shear :: [[a]] -> [[a]]

-- | Transform
--   
--   <pre>
--   [[00,01,02,...],          [[00],
--    [10,11,12,...],   --&gt;     [01,10],
--    [20,21,22,...],           [02,11,20],
--    ...]                      ...]
--   </pre>
--   
--   It's like <a>shear</a> but the order of elements in the sub list is
--   reversed. Its implementation seems to be more efficient than that of
--   <a>shear</a>. If the order does not matter, better choose
--   <a>shearTranspose</a>.
shearTranspose :: [[a]] -> [[a]]

-- | Operate on each combination of elements of the first and the second
--   list. In contrast to the list instance of <a>liftM2</a> in holds the
--   results in a list of lists. It holds <tt>concat (outerProduct f xs ys)
--   == liftM2 f xs ys</tt>
outerProduct :: (a -> b -> c) -> [a] -> [b] -> [[c]]

-- | Take while first predicate holds, then continue taking while second
--   predicate holds, and so on.
takeWhileMulti :: [a -> Bool] -> [a] -> [a]

-- | rotate left
rotate :: Int -> [a] -> [a]

-- | Given two lists that are ordered (i.e. <tt>p x y</tt> holds for
--   subsequent <tt>x</tt> and <tt>y</tt>) <a>mergeBy</a> them into a list
--   that is ordered, again.
mergeBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]
allEqual :: Eq a => [a] -> Bool
isAscending :: (Ord a) => [a] -> Bool
isAscendingLazy :: (Ord a) => [a] -> [Bool]

-- | This function combines every pair of neighbour elements in a list with
--   a certain function.
mapAdjacent :: (a -> a -> b) -> [a] -> [b]

-- | <pre>
--   mapAdjacent f a0 [(a1,b1), (a2,b2), (a3,b3)]
--   ==
--   [f a0 a1 b1, f a1 a2 b2, f a2 a3 b3]
--   </pre>
mapAdjacent1 :: (a -> a -> b -> c) -> a -> [(a, b)] -> [c]

-- | Enumerate without Enum context. For Enum equivalent to enumFrom.
range :: Num a => Int -> [a]
padLeft :: a -> Int -> [a] -> [a]
padRight :: a -> Int -> [a] -> [a]

-- | For an associative operation <tt>op</tt> this computes
--   <tt>iterateAssociative op a = iterate (op a) a</tt> but it is even
--   faster than <tt>map (powerAssociative op a a) [0..]</tt> since it
--   shares temporary results.
--   
--   The idea is: From the list <tt>map (powerAssociative op a a)
--   [0,(2*n)..]</tt> we compute the list <tt>map (powerAssociative op a a)
--   [0,n..]</tt>, and iterate that until <tt>n==1</tt>.
iterateAssociative :: (a -> a -> a) -> a -> [a]

-- | This is equal to <a>iterateAssociative</a>. The idea is the following:
--   The list we search is the fixpoint of the function: "Square all
--   elements of the list, then spread it and fill the holes with
--   successive numbers of their left neighbour." This also preserves log n
--   applications per value. However it has a space leak, because for the
--   value with index <tt>n</tt> all elements starting at <tt>div n 2</tt>
--   must be kept.
iterateLeaky :: (a -> a -> a) -> a -> [a]
lengthAtLeast :: Int -> [a] -> Bool

module Data.Record.HT

-- | Lexicographically compare a list of attributes of two records.
--   
--   Example:
--   
--   <pre>
--   compare [comparing fst, comparing snd]
--   </pre>
compare :: [a -> a -> Ordering] -> a -> a -> Ordering

-- | Check whether a selected set of fields of two records is equal.
--   
--   Example:
--   
--   <pre>
--   equal [equating fst, equating snd]
--   </pre>
equal :: [a -> a -> Bool] -> a -> a -> Bool

module Data.String.HT

-- | remove leading and trailing spaces
trim :: String -> String

module Data.List.Match

-- | Make a list as long as another one
take :: [b] -> [a] -> [a]

-- | Drop as many elements as the first list is long
drop :: [b] -> [a] -> [a]
splitAt :: [b] -> [a] -> ([a], [a])
takeRev :: [b] -> [a] -> [a]
dropRev :: [b] -> [a] -> [a]

-- | Specialisation of <a>$&gt;</a>.
replicate :: [a] -> b -> [b]

-- | Check whether two lists with different element types have equal
--   length. It is equivalent to <tt>length xs == length ys</tt> but more
--   efficient.
equalLength :: [a] -> [b] -> Bool

-- | Compare the length of two lists over different types. It is equivalent
--   to <tt>(compare (length xs) (length ys))</tt> but more efficient.
compareLength :: [a] -> [b] -> Ordering

-- | <tt>lessOrEqualLength x y</tt> is almost the same as <tt>compareLength
--   x y &lt;= EQ</tt>, but <tt>lessOrEqualLength [] undefined = True</tt>,
--   whereas <tt>compareLength [] undefined &lt;= EQ = undefined</tt>.
lessOrEqualLength :: [a] -> [b] -> Bool

-- | Returns the shorter one of two lists. It works also for infinite lists
--   as much as possible. E.g. <tt>shorterList (shorterList (repeat 1)
--   (repeat 2)) [1,2,3]</tt> can be computed. The trick is, that the
--   skeleton of the resulting list is constructed using <a>zipWith</a>
--   without touching the elements. The contents is then computed (only) if
--   requested.
shorterList :: [a] -> [a] -> [a]