{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE IncoherentInstances #-}
import Foreign.C.Types
import Foreign.Ptr
import Foreign.Storable.ATS
import GHC.Generics
import Test.Hspec
data BoringType = BoringType CInt CInt
deriving (Show, Eq, Generic, ATSStorable)
foreign import ccall unsafe pass_boring_type :: Ptr BoringType
-- are pointers functorial?? a monad??
passBoringType :: IO BoringType
passBoringType = peek pass_boring_type
main :: IO ()
main = hspec $
parallel $ describe "passBoringType" $
it "should so the right thing" $
passBoringType >>= (`shouldBe` (BoringType 12 13))