module Hedgehog.Classes.Common.IO
  ( genIO
  , showIO
  ) where

import Hedgehog
import System.IO.Unsafe (unsafePerformIO)

genIO :: Gen a -> Gen (IO a)
genIO :: forall a. Gen a -> Gen (IO a)
genIO Gen a
gen = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall (f :: * -> *) a. Applicative f => a -> f a
pure Gen a
gen

showIO :: Show a => IO a -> String
showIO :: forall a. Show a => IO a -> String
showIO IO a
io = forall a. IO a -> a
unsafePerformIO forall a b. (a -> b) -> a -> b
$ do
  String
x <- forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Show a => a -> String
show IO a
io
  let y :: String
y = String
"IO " forall a. [a] -> [a] -> [a]
++ String
x
  forall (f :: * -> *) a. Applicative f => a -> f a
pure String
y