blob: 98f1d328367f44906b06669ea1765e7403fea575 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
module T19790 where
newtype Stream = MkStream { unStream :: Int -> Int }
fromStream :: Stream -> [Int]
{-# NOINLINE fromStream #-}
fromStream (MkStream f) = map f [1,2]
toStream :: [Int] -> Stream
{-# NOINLINE toStream #-}
toStream xs = MkStream (\x -> x + length xs)
foo :: [Int] -> [Int]
foo xs = fromStream (MkStream (\p -> unStream (toStream xs) p))
-- The question is: does this rule fire? It should!
{-# RULES "This rule should fire!" forall xs. fromStream (toStream xs) = xs #-}
|