{-# 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 = IO Formatter -> IO Formatter
forall a. a -> a
id

instance IsFormatter Formatter where
  toFormatter :: Formatter -> IO Formatter
toFormatter = Formatter -> IO Formatter
forall a. a -> IO a
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 <- a -> IO Formatter
forall a. IsFormatter a => a -> IO Formatter
toFormatter a
formatter
  Config -> Spec -> IO ()
hspecWith Config
defaultConfig {configFormatter = Just f} Spec
spec

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