1{-# LANGUAGE CPP, NoImplicitPrelude #-}
2-- | This backports the modern "Data.Semigroup" interface back to
3-- @base-4.9@/GHC 8.0.
4module Data.List.NonEmpty.Compat (
5#if MIN_VERSION_base(4,9,0)
6  -- * The type of non-empty streams
7    NonEmpty(..)
8
9  -- * Non-empty stream transformations
10  , map
11  , intersperse
12  , scanl
13  , scanr
14  , scanl1
15  , scanr1
16  , transpose
17  , sortBy
18  , sortWith
19  -- * Basic functions
20  , length
21  , head
22  , tail
23  , last
24  , init
25  , singleton
26  , (<|), cons
27  , uncons
28  , unfoldr
29  , sort
30  , reverse
31  , inits
32  , tails
33  -- * Building streams
34  , iterate
35  , repeat
36  , cycle
37  , unfold
38  , insert
39  , some1
40  -- * Extracting sublists
41  , take
42  , drop
43  , splitAt
44  , takeWhile
45  , dropWhile
46  , span
47  , break
48  , filter
49  , partition
50  , group
51  , groupBy
52  , groupWith
53  , groupAllWith
54  , group1
55  , groupBy1
56  , groupWith1
57  , groupAllWith1
58  -- * Sublist predicates
59  , isPrefixOf
60  -- * \"Set\" operations
61  , nub
62  , nubBy
63  -- * Indexing streams
64  , (!!)
65  -- * Zipping and unzipping streams
66  , zip
67  , zipWith
68  , unzip
69  -- * Converting to and from a list
70  , fromList
71  , toList
72  , nonEmpty
73  , xor
74#endif
75) where
76
77#if MIN_VERSION_base(4,9,0)
78import Data.List.NonEmpty
79#endif
80
81#if MIN_VERSION_base(4,9,0) && !(MIN_VERSION_base(4,15,0))
82-- | Construct a 'NonEmpty' list from a single element.
83--
84-- /Since: 4.15/
85singleton :: a -> NonEmpty a
86singleton a = a :| []
87#endif
88