{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude, MagicHash, UnboxedTuples #-}
{-# OPTIONS_HADDOCK not-home #-}

-----------------------------------------------------------------------------
-- |
-- Module      :  GHC.Storable
-- Copyright   :  (c) The FFI task force, 2000-2002
-- License     :  see libraries/base/LICENSE
--
-- Maintainer  :  ffi@haskell.org
-- Stability   :  internal
-- Portability :  non-portable (GHC Extensions)
--
-- Helper functions for "Foreign.Storable"
--
-----------------------------------------------------------------------------

module GHC.Storable
        ( readWideCharOffPtr
        , readIntOffPtr
        , readWordOffPtr
        , readPtrOffPtr
        , readFunPtrOffPtr
        , readFloatOffPtr
        , readDoubleOffPtr
        , readStablePtrOffPtr
        , readInt8OffPtr
        , readInt16OffPtr
        , readInt32OffPtr
        , readInt64OffPtr
        , readWord8OffPtr
        , readWord16OffPtr
        , readWord32OffPtr
        , readWord64OffPtr
        , writeWideCharOffPtr
        , writeIntOffPtr
        , writeWordOffPtr
        , writePtrOffPtr
        , writeFunPtrOffPtr
        , writeFloatOffPtr
        , writeDoubleOffPtr
        , writeStablePtrOffPtr
        , writeInt8OffPtr
        , writeInt16OffPtr
        , writeInt32OffPtr
        , writeInt64OffPtr
        , writeWord8OffPtr
        , writeWord16OffPtr
        , writeWord32OffPtr
        , writeWord64OffPtr
        ) where

import GHC.Stable ( StablePtr(..) )
import GHC.Int
import GHC.Word
import GHC.Ptr
import GHC.Base

readWideCharOffPtr  :: Ptr Char          -> Int -> IO Char
readIntOffPtr       :: Ptr Int           -> Int -> IO Int
readWordOffPtr      :: Ptr Word          -> Int -> IO Word
readPtrOffPtr       :: Ptr (Ptr a)       -> Int -> IO (Ptr a)
readFunPtrOffPtr    :: Ptr (FunPtr a)    -> Int -> IO (FunPtr a)
readFloatOffPtr     :: Ptr Float         -> Int -> IO Float
readDoubleOffPtr    :: Ptr Double        -> Int -> IO Double
readStablePtrOffPtr :: Ptr (StablePtr a) -> Int -> IO (StablePtr a)
readInt8OffPtr      :: Ptr Int8          -> Int -> IO Int8
readInt16OffPtr     :: Ptr Int16         -> Int -> IO Int16
readInt32OffPtr     :: Ptr Int32         -> Int -> IO Int32
readInt64OffPtr     :: Ptr Int64         -> Int -> IO Int64
readWord8OffPtr     :: Ptr Word8         -> Int -> IO Word8
readWord16OffPtr    :: Ptr Word16        -> Int -> IO Word16
readWord32OffPtr    :: Ptr Word32        -> Int -> IO Word32
readWord64OffPtr    :: Ptr Word64        -> Int -> IO Word64

readWideCharOffPtr :: Ptr Char -> Int -> IO Char
readWideCharOffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Char #)) -> IO Char
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Char #)) -> IO Char)
-> (State# RealWorld -> (# State# RealWorld, Char #)) -> IO Char
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Char# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Char# #)
readWideCharOffAddr# Addr#
a Int#
i State# RealWorld
s  of (# s2 :: State# RealWorld
s2, x :: Char#
x #) -> (# State# RealWorld
s2, Char# -> Char
C# Char#
x #)
readIntOffPtr :: Ptr Int -> Int -> IO Int
readIntOffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int)
-> (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Int# #)
readIntOffAddr# Addr#
a Int#
i State# RealWorld
s       of (# s2 :: State# RealWorld
s2, x :: Int#
x #) -> (# State# RealWorld
s2, Int# -> Int
I# Int#
x #)
readWordOffPtr :: Ptr Word -> Int -> IO Word
readWordOffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Word #)) -> IO Word
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Word #)) -> IO Word)
-> (State# RealWorld -> (# State# RealWorld, Word #)) -> IO Word
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Word# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Word# #)
readWordOffAddr# Addr#
a Int#
i State# RealWorld
s      of (# s2 :: State# RealWorld
s2, x :: Word#
x #) -> (# State# RealWorld
s2, Word# -> Word
W# Word#
x #)
readPtrOffPtr :: Ptr (Ptr a) -> Int -> IO (Ptr a)
readPtrOffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Ptr a #)) -> IO (Ptr a)
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Ptr a #)) -> IO (Ptr a))
-> (State# RealWorld -> (# State# RealWorld, Ptr a #))
-> IO (Ptr a)
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Addr# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Addr# #)
readAddrOffAddr# Addr#
a Int#
i State# RealWorld
s      of (# s2 :: State# RealWorld
s2, x :: Addr#
x #) -> (# State# RealWorld
s2, Addr# -> Ptr a
forall a. Addr# -> Ptr a
Ptr Addr#
x #)
readFunPtrOffPtr :: Ptr (FunPtr a) -> Int -> IO (FunPtr a)
readFunPtrOffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i)
  = (State# RealWorld -> (# State# RealWorld, FunPtr a #))
-> IO (FunPtr a)
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, FunPtr a #))
 -> IO (FunPtr a))
-> (State# RealWorld -> (# State# RealWorld, FunPtr a #))
-> IO (FunPtr a)
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Addr# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Addr# #)
readAddrOffAddr# Addr#
a Int#
i State# RealWorld
s      of (# s2 :: State# RealWorld
s2, x :: Addr#
x #) -> (# State# RealWorld
s2, Addr# -> FunPtr a
forall a. Addr# -> FunPtr a
FunPtr Addr#
x #)
readFloatOffPtr :: Ptr Float -> Int -> IO Float
readFloatOffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Float #)) -> IO Float
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Float #)) -> IO Float)
-> (State# RealWorld -> (# State# RealWorld, Float #)) -> IO Float
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Float# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Float# #)
readFloatOffAddr# Addr#
a Int#
i State# RealWorld
s     of (# s2 :: State# RealWorld
s2, x :: Float#
x #) -> (# State# RealWorld
s2, Float# -> Float
F# Float#
x #)
readDoubleOffPtr :: Ptr Double -> Int -> IO Double
readDoubleOffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Double #)) -> IO Double
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Double #)) -> IO Double)
-> (State# RealWorld -> (# State# RealWorld, Double #))
-> IO Double
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr#
-> Int# -> State# RealWorld -> (# State# RealWorld, Double# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Double# #)
readDoubleOffAddr# Addr#
a Int#
i State# RealWorld
s    of (# s2 :: State# RealWorld
s2, x :: Double#
x #) -> (# State# RealWorld
s2, Double# -> Double
D# Double#
x #)
readStablePtrOffPtr :: Ptr (StablePtr a) -> Int -> IO (StablePtr a)
readStablePtrOffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i)
  = (State# RealWorld -> (# State# RealWorld, StablePtr a #))
-> IO (StablePtr a)
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, StablePtr a #))
 -> IO (StablePtr a))
-> (State# RealWorld -> (# State# RealWorld, StablePtr a #))
-> IO (StablePtr a)
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr#
-> Int# -> State# RealWorld -> (# State# RealWorld, StablePtr# a #)
forall d a.
Addr# -> Int# -> State# d -> (# State# d, StablePtr# a #)
readStablePtrOffAddr# Addr#
a Int#
i State# RealWorld
s of (# s2 :: State# RealWorld
s2, x :: StablePtr# a
x #) -> (# State# RealWorld
s2, StablePtr# a -> StablePtr a
forall a. StablePtr# a -> StablePtr a
StablePtr StablePtr# a
x #)
readInt8OffPtr :: Ptr Int8 -> Int -> IO Int8
readInt8OffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Int8 #)) -> IO Int8
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int8 #)) -> IO Int8)
-> (State# RealWorld -> (# State# RealWorld, Int8 #)) -> IO Int8
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Int# #)
readInt8OffAddr# Addr#
a Int#
i State# RealWorld
s      of (# s2 :: State# RealWorld
s2, x :: Int#
x #) -> (# State# RealWorld
s2, Int# -> Int8
I8# Int#
x #)
readWord8OffPtr :: Ptr Word8 -> Int -> IO Word8
readWord8OffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Word8 #)) -> IO Word8
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Word8 #)) -> IO Word8)
-> (State# RealWorld -> (# State# RealWorld, Word8 #)) -> IO Word8
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Word# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Word# #)
readWord8OffAddr# Addr#
a Int#
i State# RealWorld
s     of (# s2 :: State# RealWorld
s2, x :: Word#
x #) -> (# State# RealWorld
s2, Word# -> Word8
W8# Word#
x #)
readInt16OffPtr :: Ptr Int16 -> Int -> IO Int16
readInt16OffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Int16 #)) -> IO Int16
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int16 #)) -> IO Int16)
-> (State# RealWorld -> (# State# RealWorld, Int16 #)) -> IO Int16
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Int# #)
readInt16OffAddr# Addr#
a Int#
i State# RealWorld
s     of (# s2 :: State# RealWorld
s2, x :: Int#
x #) -> (# State# RealWorld
s2, Int# -> Int16
I16# Int#
x #)
readWord16OffPtr :: Ptr Word16 -> Int -> IO Word16
readWord16OffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Word16 #)) -> IO Word16
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Word16 #)) -> IO Word16)
-> (State# RealWorld -> (# State# RealWorld, Word16 #))
-> IO Word16
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Word# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Word# #)
readWord16OffAddr# Addr#
a Int#
i State# RealWorld
s    of (# s2 :: State# RealWorld
s2, x :: Word#
x #) -> (# State# RealWorld
s2, Word# -> Word16
W16# Word#
x #)
readInt32OffPtr :: Ptr Int32 -> Int -> IO Int32
readInt32OffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Int32 #)) -> IO Int32
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int32 #)) -> IO Int32)
-> (State# RealWorld -> (# State# RealWorld, Int32 #)) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Int# #)
readInt32OffAddr# Addr#
a Int#
i State# RealWorld
s     of (# s2 :: State# RealWorld
s2, x :: Int#
x #) -> (# State# RealWorld
s2, Int# -> Int32
I32# Int#
x #)
readWord32OffPtr :: Ptr Word32 -> Int -> IO Word32
readWord32OffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Word32 #)) -> IO Word32
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Word32 #)) -> IO Word32)
-> (State# RealWorld -> (# State# RealWorld, Word32 #))
-> IO Word32
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Word# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Word# #)
readWord32OffAddr# Addr#
a Int#
i State# RealWorld
s    of (# s2 :: State# RealWorld
s2, x :: Word#
x #) -> (# State# RealWorld
s2, Word# -> Word32
W32# Word#
x #)
readInt64OffPtr :: Ptr Int64 -> Int -> IO Int64
readInt64OffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Int64 #)) -> IO Int64
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int64 #)) -> IO Int64)
-> (State# RealWorld -> (# State# RealWorld, Int64 #)) -> IO Int64
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Int# #)
readInt64OffAddr# Addr#
a Int#
i State# RealWorld
s     of (# s2 :: State# RealWorld
s2, x :: Int#
x #) -> (# State# RealWorld
s2, Int# -> Int64
I64# Int#
x #)
readWord64OffPtr :: Ptr Word64 -> Int -> IO Word64
readWord64OffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Word64 #)) -> IO Word64
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Word64 #)) -> IO Word64)
-> (State# RealWorld -> (# State# RealWorld, Word64 #))
-> IO Word64
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Word# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Word# #)
readWord64OffAddr# Addr#
a Int#
i State# RealWorld
s    of (# s2 :: State# RealWorld
s2, x :: Word#
x #) -> (# State# RealWorld
s2, Word# -> Word64
W64# Word#
x #)

writeWideCharOffPtr  :: Ptr Char          -> Int -> Char        -> IO ()
writeIntOffPtr       :: Ptr Int           -> Int -> Int         -> IO ()
writeWordOffPtr      :: Ptr Word          -> Int -> Word        -> IO ()
writePtrOffPtr       :: Ptr (Ptr a)       -> Int -> Ptr a       -> IO ()
writeFunPtrOffPtr    :: Ptr (FunPtr a)    -> Int -> FunPtr a    -> IO ()
writeFloatOffPtr     :: Ptr Float         -> Int -> Float       -> IO ()
writeDoubleOffPtr    :: Ptr Double        -> Int -> Double      -> IO ()
writeStablePtrOffPtr :: Ptr (StablePtr a) -> Int -> StablePtr a -> IO ()
writeInt8OffPtr      :: Ptr Int8          -> Int -> Int8        -> IO ()
writeInt16OffPtr     :: Ptr Int16         -> Int -> Int16       -> IO ()
writeInt32OffPtr     :: Ptr Int32         -> Int -> Int32       -> IO ()
writeInt64OffPtr     :: Ptr Int64         -> Int -> Int64       -> IO ()
writeWord8OffPtr     :: Ptr Word8         -> Int -> Word8       -> IO ()
writeWord16OffPtr    :: Ptr Word16        -> Int -> Word16      -> IO ()
writeWord32OffPtr    :: Ptr Word32        -> Int -> Word32      -> IO ()
writeWord64OffPtr    :: Ptr Word64        -> Int -> Word64      -> IO ()

writeWideCharOffPtr :: Ptr Char -> Int -> Char -> IO ()
writeWideCharOffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i) (C# x :: Char#
x)
  = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> Char# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Char# -> State# d -> State# d
writeWideCharOffAddr# Addr#
a Int#
i Char#
x State# RealWorld
s  of s2 :: State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeIntOffPtr :: Ptr Int -> Int -> Int -> IO ()
writeIntOffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i) (I# x :: Int#
x)
  = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Int# -> State# d -> State# d
writeIntOffAddr# Addr#
a Int#
i Int#
x State# RealWorld
s       of s2 :: State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeWordOffPtr :: Ptr Word -> Int -> Word -> IO ()
writeWordOffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i) (W# x :: Word#
x)
  = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> Word# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Word# -> State# d -> State# d
writeWordOffAddr# Addr#
a Int#
i Word#
x State# RealWorld
s      of s2 :: State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writePtrOffPtr :: Ptr (Ptr a) -> Int -> Ptr a -> IO ()
writePtrOffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i) (Ptr x :: Addr#
x)
  = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> Addr# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Addr# -> State# d -> State# d
writeAddrOffAddr# Addr#
a Int#
i Addr#
x State# RealWorld
s      of s2 :: State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeFunPtrOffPtr :: Ptr (FunPtr a) -> Int -> FunPtr a -> IO ()
writeFunPtrOffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i) (FunPtr x :: Addr#
x)
  = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> Addr# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Addr# -> State# d -> State# d
writeAddrOffAddr# Addr#
a Int#
i Addr#
x State# RealWorld
s      of s2 :: State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeFloatOffPtr :: Ptr Float -> Int -> Float -> IO ()
writeFloatOffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i) (F# x :: Float#
x)
  = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> Float# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Float# -> State# d -> State# d
writeFloatOffAddr# Addr#
a Int#
i Float#
x State# RealWorld
s     of s2 :: State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeDoubleOffPtr :: Ptr Double -> Int -> Double -> IO ()
writeDoubleOffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i) (D# x :: Double#
x)
  = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> Double# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Double# -> State# d -> State# d
writeDoubleOffAddr# Addr#
a Int#
i Double#
x State# RealWorld
s    of s2 :: State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeStablePtrOffPtr :: Ptr (StablePtr a) -> Int -> StablePtr a -> IO ()
writeStablePtrOffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i) (StablePtr x :: StablePtr# a
x)
  = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr#
-> Int# -> StablePtr# a -> State# RealWorld -> State# RealWorld
forall a d. Addr# -> Int# -> StablePtr# a -> State# d -> State# d
writeStablePtrOffAddr# Addr#
a Int#
i StablePtr# a
x State# RealWorld
s of s2 :: State# RealWorld
s2 -> (# State# RealWorld
s2 , () #)
writeInt8OffPtr :: Ptr Int8 -> Int -> Int8 -> IO ()
writeInt8OffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i) (I8# x :: Int#
x)
  = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Int# -> State# d -> State# d
writeInt8OffAddr# Addr#
a Int#
i Int#
x State# RealWorld
s      of s2 :: State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeWord8OffPtr :: Ptr Word8 -> Int -> Word8 -> IO ()
writeWord8OffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i) (W8# x :: Word#
x)
  = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> Word# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Word# -> State# d -> State# d
writeWord8OffAddr# Addr#
a Int#
i Word#
x State# RealWorld
s     of s2 :: State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeInt16OffPtr :: Ptr Int16 -> Int -> Int16 -> IO ()
writeInt16OffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i) (I16# x :: Int#
x)
  = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Int# -> State# d -> State# d
writeInt16OffAddr# Addr#
a Int#
i Int#
x State# RealWorld
s     of s2 :: State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeWord16OffPtr :: Ptr Word16 -> Int -> Word16 -> IO ()
writeWord16OffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i) (W16# x :: Word#
x)
  = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> Word# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Word# -> State# d -> State# d
writeWord16OffAddr# Addr#
a Int#
i Word#
x State# RealWorld
s    of s2 :: State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeInt32OffPtr :: Ptr Int32 -> Int -> Int32 -> IO ()
writeInt32OffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i) (I32# x :: Int#
x)
  = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Int# -> State# d -> State# d
writeInt32OffAddr# Addr#
a Int#
i Int#
x State# RealWorld
s     of s2 :: State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeWord32OffPtr :: Ptr Word32 -> Int -> Word32 -> IO ()
writeWord32OffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i) (W32# x :: Word#
x)
  = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> Word# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Word# -> State# d -> State# d
writeWord32OffAddr# Addr#
a Int#
i Word#
x State# RealWorld
s    of s2 :: State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeInt64OffPtr :: Ptr Int64 -> Int -> Int64 -> IO ()
writeInt64OffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i) (I64# x :: Int#
x)
  = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Int# -> State# d -> State# d
writeInt64OffAddr# Addr#
a Int#
i Int#
x State# RealWorld
s     of s2 :: State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeWord64OffPtr :: Ptr Word64 -> Int -> Word64 -> IO ()
writeWord64OffPtr (Ptr a :: Addr#
a) (I# i :: Int#
i) (W64# x :: Word#
x)
  = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \s :: State# RealWorld
s -> case Addr# -> Int# -> Word# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Word# -> State# d -> State# d
writeWord64OffAddr# Addr#
a Int#
i Word#
x State# RealWorld
s    of s2 :: State# RealWorld
s2 -> (# State# RealWorld
s2, () #)