blob: b35ada48344a862c17e0abbd7186bee77cd61db9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
{-# LANGUAGE BangPatterns #-}
module Main where
--import qualified Data.Vector.Storable as V
import Foreign
import Data.Ratio
import Data.Complex
complexZI :: Complex Int
complexZI = 1 :+ 1
ratio23 :: Ratio Int
ratio23 = 1 % 1
putter :: Storable a => a -> Ptr a -> IO a
putter v !ptr = do poke ptr v ; peek ptr
main =
do
!vComplex <- alloca (putter complexZI)
!vRatio <- alloca (putter ratio23)
if vComplex == complexZI && vRatio == ratio23
then putStrLn "success"
else putStrLn "uh oh, something is wrong with storable"
|