Ticket #2422: Main.hs

File Main.hs, 421 bytes (added by sedillard, 6 years ago)
Line 
1module Main where
2
3import Lib
4import Foreign
5
6-- This loop makes no reference to Vec4D. However if the Storable Vec4D
7-- instance in Lib.hs is uncommented, the Storable dictionary will linger in
8-- this loop.
9--
10-- Without that instance, the loop optimizes neatly.
11
12loop :: Int -> Ptr (Vec4 Double) -> Ptr (Vec4 Double) -> IO ()
13loop n a b =
14  mapM_ (\i -> peekElemOff a i >>= pokeElemOff b i) [0..n-1]
15
16main = return ()