module CriterionPlus.Prelude.Basic
( 
  module Exports,

  traceM,
  bug,
  bottom,

  (?:),
  (|>),
  (<|),
  (|$>),
)
where

-- base
-------------------------
import Prelude as Exports hiding (concat, foldr, mapM_, sequence_, foldl1, maximum, minimum, product, sum, all, and, any, concatMap, elem, foldl, foldr1, notElem, or, mapM, sequence, FilePath, id, (.))
import Control.Monad as Exports hiding (mapM_, sequence_, forM_, msum, mapM, sequence, forM)
import Control.Applicative as Exports
import Control.Arrow as Exports hiding (left, right)
import Control.Category as Exports
import Data.Monoid as Exports
import Data.Foldable as Exports
import Data.Traversable as Exports hiding (for)
import Data.Maybe as Exports
import Data.Either as Exports
import Data.List as Exports hiding (concat, foldr, foldl1, maximum, minimum, product, sum, all, and, any, concatMap, elem, foldl, foldr1, notElem, or, find, maximumBy, minimumBy, mapAccumL, mapAccumR, foldl')
import Data.Tuple as Exports
import Data.Function as Exports hiding ((.), id)
import Data.Ord as Exports (Down(..))
import Data.String as Exports
import Data.Int as Exports
import Data.Word as Exports
import Data.Ratio as Exports
import Data.Fixed as Exports
import Data.Ix as Exports
import Data.Data as Exports
import Text.Read as Exports (readMaybe, readEither)
import Control.Exception as Exports hiding (tryJust, try, assert)
import Control.Concurrent as Exports hiding (yield)
import System.Mem as Exports
import System.Mem.StableName as Exports
import System.Timeout as Exports
import System.Exit as Exports
import System.IO.Unsafe as Exports
import System.IO as Exports (Handle, hClose)
import System.IO.Error as Exports
import Unsafe.Coerce as Exports
import GHC.Generics as Exports (Generic)
import GHC.IO.Exception as Exports
import Data.IORef as Exports
import Data.STRef as Exports
import Control.Monad.ST as Exports
import Debug.Trace as Exports hiding (traceM)

-- placeholders
-------------------------
import Development.Placeholders as Exports

-- deepseq
-------------------------
import Control.DeepSeq as Exports

-- custom
-------------------------
import qualified Debug.Trace.LocationTH

traceM :: (Monad m) => String -> m ()
traceM s = trace s $ return ()

bug = [e| $(Debug.Trace.LocationTH.failure) . (msg <>) |]
  where
    msg = "A \"criterion-plus\" package bug: " :: String

bottom = [e| $bug "Bottom evaluated" |]

(?:) :: Maybe a -> a -> a
maybeA ?: b = fromMaybe b maybeA
{-# INLINE (?:) #-}

(|>) :: a -> (a -> b) -> b
a |> aToB = aToB a
{-# INLINE (|>) #-}

(<|) :: (a -> b) -> a -> b
aToB <| a = aToB a
{-# INLINE (<|) #-}

-- | 
-- The following are all the same:
-- fmap f a == f <$> a == a |> fmap f == a |$> f
-- 
-- This operator accomodates the left-to-right operators: >>=, >>>, |>.
(|$>) = flip fmap
{-# INLINE (|$>) #-}
