{-# LANGUAGE CPP, NoImplicitPrelude #-}
module Data.List.NonEmpty.Compat (
#if MIN_VERSION_base(4,9,0)
NonEmpty(..)
, map
, intersperse
, scanl
, scanr
, scanl1
, scanr1
, transpose
, sortBy
, sortWith
, length
, head
, tail
, last
, init
, singleton
, (<|), cons
, uncons
, unfoldr
, sort
, reverse
, inits
, inits1
, tails
, tails1
, iterate
, repeat
, cycle
, unfold
, insert
, some1
, take
, drop
, splitAt
, takeWhile
, dropWhile
, span
, break
, filter
, partition
, group
, groupBy
, groupWith
, groupAllWith
, group1
, groupBy1
, groupWith1
, groupAllWith1
, isPrefixOf
, nub
, nubBy
, (!!)
, zip
, zipWith
, unzip
, fromList
, toList
, nonEmpty
, xor
#endif
) where
#if MIN_VERSION_base(4,9,0)
import Data.List.NonEmpty
# if !(MIN_VERSION_base(4,18,0))
import qualified Prelude.Compat as Prelude
import Prelude.Compat ((.))
import qualified Data.Foldable.Compat as Foldable
import qualified Data.List.Compat as List
# endif
#endif
#if MIN_VERSION_base(4,9,0)
# if !(MIN_VERSION_base(4,15,0))
singleton :: a -> NonEmpty a
singleton a = a :| []
# endif
# if !(MIN_VERSION_base(4,18,0))
inits1 :: NonEmpty a -> NonEmpty (NonEmpty a)
inits1 :: forall a. NonEmpty a -> NonEmpty (NonEmpty a)
inits1 =
forall a. [a] -> NonEmpty a
fromList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
Prelude.map forall a. [a] -> NonEmpty a
fromList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [a] -> [a]
List.tail forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [a] -> [[a]]
List.inits forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. Foldable t => t a -> [a]
Foldable.toList
tails1 :: NonEmpty a -> NonEmpty (NonEmpty a)
tails1 :: forall a. NonEmpty a -> NonEmpty (NonEmpty a)
tails1 =
forall a. [a] -> NonEmpty a
fromList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
Prelude.map forall a. [a] -> NonEmpty a
fromList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [a] -> [a]
List.init forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [a] -> [[a]]
List.tails forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. Foldable t => t a -> [a]
Foldable.toList
# endif
#endif