packages feed

hspec-1.7.2.1: hspec-discover/integration-test/with-io-formatter/Formatter.hs

module Formatter (count) where

import           Data.IORef
import           Control.Monad.IO.Class
import           Test.Hspec.Formatters

count :: IO Formatter
count = do
  ref <- newIORef (0 :: Int)
  return silent {
      exampleSucceeded = \_ -> liftIO (modifyIORef ref succ)
    , footerFormatter = liftIO (readIORef ref) >>= writeLine . show
    }