{-# LANGUAGE CPP #-}
{-# LANGUAGE Trustworthy #-}
#include "lens-common.h"
module Control.Lens.Internal.Prelude
( module Prelude
, Semigroup (..)
, Monoid (..)
, Foldable, foldMap, foldr, foldl, foldl', elem, null, length, traverse_
, Traversable (..)
, Applicative (..)
, (&), (<&>), (<$>), (<$)
, ZipList (..)
, NonEmpty (..)
, Identity (..)
, Compose (..)
, Const (..)
, Alternative (..), WrappedMonad (..)
#if !MIN_VERSION_base(4,10,0)
, liftA2
#endif
, Contravariant (..), phantom
, Endo (..), Dual (..)
, Profunctor (..)
, Choice (..), Cochoice (..)
, Strong (..), Costrong (..)
, Corepresentable (..)
, Sieve (..), Cosieve (..)
, Proxy (..)
, Tagged (..)
, Void, absurd
, Word
) where
import Prelude hiding
( userError
#if MIN_VERSION_base(4,8,0)
, Applicative (..)
, Foldable (..)
, Traversable (..)
, Monoid (..)
, (<$>), (<$)
#else
, foldr, foldl, length, elem, null
, mapM, sequence
#endif
#if MIN_VERSION_base(4,13,0)
, Semigroup (..)
#endif
#if MIN_VERSION_base(4,8,0)
, Word
#endif
)
import Control.Applicative (Applicative (..), (<$>), (<$))
import Data.Foldable (Foldable, foldMap, elem, foldr, foldl, foldl', traverse_)
import Data.Monoid (Monoid (..))
import Data.Semigroup (Semigroup (..))
import Data.Traversable (Traversable (..))
import Data.Word (Word)
#if MIN_VERSION_base(4,8,0)
import Data.Function ((&))
import Data.Foldable (length, null)
#endif
#if !MIN_VERSION_base(4,10,0)
import Control.Applicative (liftA2)
#endif
#if MIN_VERSION_base(4,11,0)
import Data.Functor ((<&>))
#endif
import Control.Applicative (Alternative (..), Const (..), WrappedMonad (..), ZipList (..))
import Data.Functor.Compose (Compose (..))
import Data.Functor.Contravariant (Contravariant (..), phantom)
import Data.Functor.Identity (Identity (..))
import Data.List.NonEmpty (NonEmpty (..))
import Data.Monoid (Endo (..), Dual (..))
import Data.Profunctor (Strong (..), Choice (..), Cochoice (..), Costrong (..))
import Data.Profunctor.Rep (Corepresentable (..))
import Data.Profunctor.Sieve (Sieve (..), Cosieve (..))
import Data.Profunctor.Unsafe (Profunctor (..))
import Data.Proxy (Proxy (..))
import Data.Tagged (Tagged (..))
import Data.Void (Void, absurd)
#if !(MIN_VERSION_base(4,8,0))
(&) :: a -> (a -> b) -> b
a & f = f a
{-# INLINE (&) #-}
infixl 1 &
null :: Foldable t => t a -> Bool
null = foldr (\_ _ -> False) True
length :: Foldable t => t a -> Int
length = foldl' (\c _ -> c+1) 0
#endif
#if !(MIN_VERSION_base(4,11,0))
(<&>) :: Functor f => f a -> (a -> b) -> f b
as <&> f = f <$> as
{-# INLINE (<&>) #-}
infixl 1 <&>
#endif