diff options
Diffstat (limited to 'testsuite/tests/simplCore/should_compile/T3772_A.hs')
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T3772_A.hs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T3772_A.hs b/testsuite/tests/simplCore/should_compile/T3772_A.hs new file mode 100644 index 0000000000..e6b57c98b3 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T3772_A.hs @@ -0,0 +1,48 @@ + + +module T3772_A where + +class DeepSeq a => C a where +-- class C a where + gen :: Int -> a + +instance C Double where + gen = fromIntegral + +instance C a => C [a] where + {-# INLINE gen #-} + gen n = replicate n (gen n) + +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 + +apply :: (C a, DeepSeq b) => Int -> (a -> b) -> () +{-# INLINE apply #-} +apply n f = f (gen n) `deepSeq` () + + +{- +$cdeepSeq :: DeepSeq a -> [a] -> b -> b +-- User INLINE( 3 args )! +$cdeepSeq a (d:DS a) b (x:[a]) (y:b) = ... + +$fDeepSeq[] :: DeepSeq a -> DeepSeq [a] +-- DFun (with auto INLINE pragma) +$fDeepSeq[] a d = $cdeepSeq a d |> blah + +$cp1 a d :: C a => DeepSep [a] +-- We don't want to eta-expand this, lest +-- $cdeepSeq gets inlined in it! +$cp1 a d = $fDeepSep[] a (scsel a d) + +$fC[] :: C a => C [a] +-- DFun +$fC[] a d = MkC ($cp1 a d) ($cgen a d) +-}
\ No newline at end of file |