{-# OPTIONS_GHC -fno-warn-deprecations #-}
{-# LANGUAGE FlexibleInstances #-}
module Test.Hspec.Discover {-# WARNING
  "This module is used by @hspec-discover@.  It is not part of the public API and may change at any time."
  #-} (
  Spec
, hspec
, IsFormatter (..)
, hspecWithFormatter
, postProcessSpec
, describe
, module Prelude
) where

import           Test.Hspec.Core.Spec
import           Test.Hspec.Core.Runner
import           Test.Hspec.Core.Formatters.V1

class IsFormatter a where
  toFormatter :: a -> IO Formatter

instance IsFormatter (IO Formatter) where
  toFormatter :: IO Formatter -> IO Formatter
toFormatter = forall a. a -> a
id

instance IsFormatter Formatter where
  toFormatter :: Formatter -> IO Formatter
toFormatter = forall (m :: * -> *) a. Monad m => a -> m a
return

hspecWithFormatter :: IsFormatter a => a -> Spec -> IO ()
hspecWithFormatter :: forall a. IsFormatter a => a -> Spec -> IO ()
hspecWithFormatter a
formatter Spec
spec = do
  Formatter
f <- forall a. IsFormatter a => a -> IO Formatter
toFormatter a
formatter
  Config -> Spec -> IO ()
hspecWith Config
defaultConfig {configFormatter :: Maybe Formatter
configFormatter = forall a. a -> Maybe a
Just Formatter
f} Spec
spec

postProcessSpec :: FilePath -> Spec -> Spec
postProcessSpec :: FilePath -> Spec -> Spec
postProcessSpec FilePath
_ = forall a. a -> a
id