module T where
class DeepSeq a where
deepSeq :: a -> b -> b
instance DeepSeq Double where
deepSeq = seq
instance DeepSeq a => DeepSeq [a] where
{-# INLINE deepSeq #-}
deepSeq xs b = foldr deepSeq b xs
class DeepSeq a => C a where
gen :: Int -> a
instance C Double where
gen = fromIntegral
instance C a => C [a] where
gen n = replicate n (gen n)
data B a b = B (a -> b) a
apply :: (C a, DeepSeq b) => Int -> (a -> b) -> ()
{-# INLINE apply #-}
apply n f = f (gen n) `deepSeq` ()