typograffiti-0.1.0.3: Just let me draw nice text already

Safe HaskellNone
LanguageHaskell2010

Typograffiti.Utils

Synopsis

Documentation

newStablePtr :: a -> IO (StablePtr a) #

Create a stable pointer referring to the given Haskell value.

data Int #

A fixed-precision integer type with at least the range [-2^29 .. 2^29-1]. The exact range for a given implementation can be determined by using minBound and maxBound from the Bounded class.

Instances
Bounded Int

Since: base-2.1

Instance details

Defined in GHC.Enum

Methods

minBound :: Int #

maxBound :: Int #

Enum Int

Since: base-2.1

Instance details

Defined in GHC.Enum

Methods

succ :: Int -> Int #

pred :: Int -> Int #

toEnum :: Int -> Int #

fromEnum :: Int -> Int #

enumFrom :: Int -> [Int] #

enumFromThen :: Int -> Int -> [Int] #

enumFromTo :: Int -> Int -> [Int] #

enumFromThenTo :: Int -> Int -> Int -> [Int] #

Eq Int 
Instance details

Defined in GHC.Classes

Methods

(==) :: Int -> Int -> Bool #

(/=) :: Int -> Int -> Bool #

Integral Int

Since: base-2.0.1

Instance details

Defined in GHC.Real

Methods

quot :: Int -> Int -> Int #

rem :: Int -> Int -> Int #

div :: Int -> Int -> Int #

mod :: Int -> Int -> Int #

quotRem :: Int -> Int -> (Int, Int) #

divMod :: Int -> Int -> (Int, Int) #

toInteger :: Int -> Integer #

Num Int

Since: base-2.1

Instance details

Defined in GHC.Num

Methods

(+) :: Int -> Int -> Int #

(-) :: Int -> Int -> Int #

(*) :: Int -> Int -> Int #

negate :: Int -> Int #

abs :: Int -> Int #

signum :: Int -> Int #

fromInteger :: Integer -> Int #

Ord Int 
Instance details

Defined in GHC.Classes

Methods

compare :: Int -> Int -> Ordering #

(<) :: Int -> Int -> Bool #

(<=) :: Int -> Int -> Bool #

(>) :: Int -> Int -> Bool #

(>=) :: Int -> Int -> Bool #

max :: Int -> Int -> Int #

min :: Int -> Int -> Int #

Read Int

Since: base-2.1

Instance details

Defined in GHC.Read

Real Int

Since: base-2.0.1

Instance details

Defined in GHC.Real

Methods

toRational :: Int -> Rational #

Show Int

Since: base-2.1

Instance details

Defined in GHC.Show

Methods

showsPrec :: Int -> Int -> ShowS #

show :: Int -> String #

showList :: [Int] -> ShowS #

Ix Int

Since: base-2.1

Instance details

Defined in GHC.Arr

Methods

range :: (Int, Int) -> [Int] #

index :: (Int, Int) -> Int -> Int #

unsafeIndex :: (Int, Int) -> Int -> Int

inRange :: (Int, Int) -> Int -> Bool #

rangeSize :: (Int, Int) -> Int #

unsafeRangeSize :: (Int, Int) -> Int

Lift Int 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Int -> Q Exp #

Storable Int

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int -> Int #

alignment :: Int -> Int #

peekElemOff :: Ptr Int -> Int -> IO Int #

pokeElemOff :: Ptr Int -> Int -> Int -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int #

pokeByteOff :: Ptr b -> Int -> Int -> IO () #

peek :: Ptr Int -> IO Int #

poke :: Ptr Int -> Int -> IO () #

Bits Int

Since: base-2.1

Instance details

Defined in Data.Bits

Methods

(.&.) :: Int -> Int -> Int #

(.|.) :: Int -> Int -> Int #

xor :: Int -> Int -> Int #

complement :: Int -> Int #

shift :: Int -> Int -> Int #

rotate :: Int -> Int -> Int #

zeroBits :: Int #

bit :: Int -> Int #

setBit :: Int -> Int -> Int #

clearBit :: Int -> Int -> Int #

complementBit :: Int -> Int -> Int #

testBit :: Int -> Int -> Bool #

bitSizeMaybe :: Int -> Maybe Int #

bitSize :: Int -> Int #

isSigned :: Int -> Bool #

shiftL :: Int -> Int -> Int #

unsafeShiftL :: Int -> Int -> Int #

shiftR :: Int -> Int -> Int #

unsafeShiftR :: Int -> Int -> Int #

rotateL :: Int -> Int -> Int #

rotateR :: Int -> Int -> Int #

popCount :: Int -> Int #

FiniteBits Int

Since: base-4.6.0.0

Instance details

Defined in Data.Bits

Prim Int 
Instance details

Defined in Data.Primitive.Types

Unbox Int 
Instance details

Defined in Data.Vector.Unboxed.Base

Conjugate Int 
Instance details

Defined in Linear.Conjugate

Methods

conjugate :: Int -> Int #

TrivialConjugate Int 
Instance details

Defined in Linear.Conjugate

UniformValue Int Source # 
Instance details

Defined in Typograffiti.GL

Methods

updateUniform :: MonadIO m => GLuint -> GLint -> Int -> m () Source #

Vector Vector Int 
Instance details

Defined in Data.Vector.Unboxed.Base

MVector MVector Int 
Instance details

Defined in Data.Vector.Unboxed.Base

Generic1 (URec Int :: k -> Type) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep1 (URec Int) :: k -> Type #

Methods

from1 :: URec Int a -> Rep1 (URec Int) a #

to1 :: Rep1 (URec Int) a -> URec Int a #

FunctorWithIndex Int (V n) 
Instance details

Defined in Linear.V

Methods

imap :: (Int -> a -> b) -> V n a -> V n b #

imapped :: IndexedSetter Int (V n a) (V n b) a b #

FoldableWithIndex Int (V n) 
Instance details

Defined in Linear.V

Methods

ifoldMap :: Monoid m => (Int -> a -> m) -> V n a -> m #

ifolded :: IndexedFold Int (V n a) a #

ifoldr :: (Int -> a -> b -> b) -> b -> V n a -> b #

ifoldl :: (Int -> b -> a -> b) -> b -> V n a -> b #

ifoldr' :: (Int -> a -> b -> b) -> b -> V n a -> b #

ifoldl' :: (Int -> b -> a -> b) -> b -> V n a -> b #

TraversableWithIndex Int (V n) 
Instance details

Defined in Linear.V

Methods

itraverse :: Applicative f => (Int -> a -> f b) -> V n a -> f (V n b) #

itraversed :: IndexedTraversal Int (V n a) (V n b) a b #

UniformValue (V2 Int) Source # 
Instance details

Defined in Typograffiti.GL

Methods

updateUniform :: MonadIO m => GLuint -> GLint -> V2 Int -> m () Source #

Reifies Z Int 
Instance details

Defined in Data.Reflection

Methods

reflect :: proxy Z -> Int #

Reifies n Int => Reifies (D n :: Type) Int 
Instance details

Defined in Data.Reflection

Methods

reflect :: proxy (D n) -> Int #

Reifies n Int => Reifies (SD n :: Type) Int 
Instance details

Defined in Data.Reflection

Methods

reflect :: proxy (SD n) -> Int #

Reifies n Int => Reifies (PD n :: Type) Int 
Instance details

Defined in Data.Reflection

Methods

reflect :: proxy (PD n) -> Int #

Functor (URec Int :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

fmap :: (a -> b) -> URec Int a -> URec Int b #

(<$) :: a -> URec Int b -> URec Int a #

Foldable (URec Int :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => URec Int m -> m #

foldMap :: Monoid m => (a -> m) -> URec Int a -> m #

foldr :: (a -> b -> b) -> b -> URec Int a -> b #

foldr' :: (a -> b -> b) -> b -> URec Int a -> b #

foldl :: (b -> a -> b) -> b -> URec Int a -> b #

foldl' :: (b -> a -> b) -> b -> URec Int a -> b #

foldr1 :: (a -> a -> a) -> URec Int a -> a #

foldl1 :: (a -> a -> a) -> URec Int a -> a #

toList :: URec Int a -> [a] #

null :: URec Int a -> Bool #

length :: URec Int a -> Int #

elem :: Eq a => a -> URec Int a -> Bool #

maximum :: Ord a => URec Int a -> a #

minimum :: Ord a => URec Int a -> a #

sum :: Num a => URec Int a -> a #

product :: Num a => URec Int a -> a #

Traversable (URec Int :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Traversable

Methods

traverse :: Applicative f => (a -> f b) -> URec Int a -> f (URec Int b) #

sequenceA :: Applicative f => URec Int (f a) -> f (URec Int a) #

mapM :: Monad m => (a -> m b) -> URec Int a -> m (URec Int b) #

sequence :: Monad m => URec Int (m a) -> m (URec Int a) #

UniformValue (Int, Int) Source # 
Instance details

Defined in Typograffiti.GL

Methods

updateUniform :: MonadIO m => GLuint -> GLint -> (Int, Int) -> m () Source #

Eq (URec Int p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

(==) :: URec Int p -> URec Int p -> Bool #

(/=) :: URec Int p -> URec Int p -> Bool #

Ord (URec Int p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

compare :: URec Int p -> URec Int p -> Ordering #

(<) :: URec Int p -> URec Int p -> Bool #

(<=) :: URec Int p -> URec Int p -> Bool #

(>) :: URec Int p -> URec Int p -> Bool #

(>=) :: URec Int p -> URec Int p -> Bool #

max :: URec Int p -> URec Int p -> URec Int p #

min :: URec Int p -> URec Int p -> URec Int p #

Show (URec Int p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

showsPrec :: Int -> URec Int p -> ShowS #

show :: URec Int p -> String #

showList :: [URec Int p] -> ShowS #

Generic (URec Int p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (URec Int p) :: Type -> Type #

Methods

from :: URec Int p -> Rep (URec Int p) x #

to :: Rep (URec Int p) x -> URec Int p #

type Unsigned Int 
Instance details

Defined in Data.Bytes.Signed

type Signed Int 
Instance details

Defined in Data.Bytes.Signed

type Signed Int = Int
newtype Vector Int 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype Vector Int = V_Int (Vector Int)
data URec Int (p :: k)

Used for marking occurrences of Int#

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

data URec Int (p :: k) = UInt {}
newtype MVector s Int 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s Int = MV_Int (MVector s Int)
type Rep1 (URec Int :: k -> Type)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

type Rep1 (URec Int :: k -> Type) = D1 (MetaData "URec" "GHC.Generics" "base" False) (C1 (MetaCons "UInt" PrefixI True) (S1 (MetaSel (Just "uInt#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (UInt :: k -> Type)))
type Rep (URec Int p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

type Rep (URec Int p) = D1 (MetaData "URec" "GHC.Generics" "base" False) (C1 (MetaCons "UInt" PrefixI True) (S1 (MetaSel (Just "uInt#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (UInt :: Type -> Type)))

data Int8 #

8-bit signed integer type

Instances
Bounded Int8

Since: base-2.1

Instance details

Defined in GHC.Int

Enum Int8

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

succ :: Int8 -> Int8 #

pred :: Int8 -> Int8 #

toEnum :: Int -> Int8 #

fromEnum :: Int8 -> Int #

enumFrom :: Int8 -> [Int8] #

enumFromThen :: Int8 -> Int8 -> [Int8] #

enumFromTo :: Int8 -> Int8 -> [Int8] #

enumFromThenTo :: Int8 -> Int8 -> Int8 -> [Int8] #

Eq Int8

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

(==) :: Int8 -> Int8 -> Bool #

(/=) :: Int8 -> Int8 -> Bool #

Integral Int8

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

quot :: Int8 -> Int8 -> Int8 #

rem :: Int8 -> Int8 -> Int8 #

div :: Int8 -> Int8 -> Int8 #

mod :: Int8 -> Int8 -> Int8 #

quotRem :: Int8 -> Int8 -> (Int8, Int8) #

divMod :: Int8 -> Int8 -> (Int8, Int8) #

toInteger :: Int8 -> Integer #

Num Int8

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

(+) :: Int8 -> Int8 -> Int8 #

(-) :: Int8 -> Int8 -> Int8 #

(*) :: Int8 -> Int8 -> Int8 #

negate :: Int8 -> Int8 #

abs :: Int8 -> Int8 #

signum :: Int8 -> Int8 #

fromInteger :: Integer -> Int8 #

Ord Int8

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

compare :: Int8 -> Int8 -> Ordering #

(<) :: Int8 -> Int8 -> Bool #

(<=) :: Int8 -> Int8 -> Bool #

(>) :: Int8 -> Int8 -> Bool #

(>=) :: Int8 -> Int8 -> Bool #

max :: Int8 -> Int8 -> Int8 #

min :: Int8 -> Int8 -> Int8 #

Read Int8

Since: base-2.1

Instance details

Defined in GHC.Int

Real Int8

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

toRational :: Int8 -> Rational #

Show Int8

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

showsPrec :: Int -> Int8 -> ShowS #

show :: Int8 -> String #

showList :: [Int8] -> ShowS #

Ix Int8

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

range :: (Int8, Int8) -> [Int8] #

index :: (Int8, Int8) -> Int8 -> Int #

unsafeIndex :: (Int8, Int8) -> Int8 -> Int

inRange :: (Int8, Int8) -> Int8 -> Bool #

rangeSize :: (Int8, Int8) -> Int #

unsafeRangeSize :: (Int8, Int8) -> Int

Lift Int8 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Int8 -> Q Exp #

Storable Int8

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int8 -> Int #

alignment :: Int8 -> Int #

peekElemOff :: Ptr Int8 -> Int -> IO Int8 #

pokeElemOff :: Ptr Int8 -> Int -> Int8 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int8 #

pokeByteOff :: Ptr b -> Int -> Int8 -> IO () #

peek :: Ptr Int8 -> IO Int8 #

poke :: Ptr Int8 -> Int8 -> IO () #

Bits Int8

Since: base-2.1

Instance details

Defined in GHC.Int

FiniteBits Int8

Since: base-4.6.0.0

Instance details

Defined in GHC.Int

Prim Int8 
Instance details

Defined in Data.Primitive.Types

Unbox Int8 
Instance details

Defined in Data.Vector.Unboxed.Base

Conjugate Int8 
Instance details

Defined in Linear.Conjugate

Methods

conjugate :: Int8 -> Int8 #

TrivialConjugate Int8 
Instance details

Defined in Linear.Conjugate

Vector Vector Int8 
Instance details

Defined in Data.Vector.Unboxed.Base

MVector MVector Int8 
Instance details

Defined in Data.Vector.Unboxed.Base

type Unsigned Int8 
Instance details

Defined in Data.Bytes.Signed

type Signed Int8 
Instance details

Defined in Data.Bytes.Signed

newtype Vector Int8 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s Int8 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s Int8 = MV_Int8 (MVector s Int8)

data Int16 #

16-bit signed integer type

Instances
Bounded Int16

Since: base-2.1

Instance details

Defined in GHC.Int

Enum Int16

Since: base-2.1

Instance details

Defined in GHC.Int

Eq Int16

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

(==) :: Int16 -> Int16 -> Bool #

(/=) :: Int16 -> Int16 -> Bool #

Integral Int16

Since: base-2.1

Instance details

Defined in GHC.Int

Num Int16

Since: base-2.1

Instance details

Defined in GHC.Int

Ord Int16

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

compare :: Int16 -> Int16 -> Ordering #

(<) :: Int16 -> Int16 -> Bool #

(<=) :: Int16 -> Int16 -> Bool #

(>) :: Int16 -> Int16 -> Bool #

(>=) :: Int16 -> Int16 -> Bool #

max :: Int16 -> Int16 -> Int16 #

min :: Int16 -> Int16 -> Int16 #

Read Int16

Since: base-2.1

Instance details

Defined in GHC.Int

Real Int16

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

toRational :: Int16 -> Rational #

Show Int16

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

showsPrec :: Int -> Int16 -> ShowS #

show :: Int16 -> String #

showList :: [Int16] -> ShowS #

Ix Int16

Since: base-2.1

Instance details

Defined in GHC.Int

Lift Int16 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Int16 -> Q Exp #

Storable Int16

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int16 -> Int #

alignment :: Int16 -> Int #

peekElemOff :: Ptr Int16 -> Int -> IO Int16 #

pokeElemOff :: Ptr Int16 -> Int -> Int16 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int16 #

pokeByteOff :: Ptr b -> Int -> Int16 -> IO () #

peek :: Ptr Int16 -> IO Int16 #

poke :: Ptr Int16 -> Int16 -> IO () #

Bits Int16

Since: base-2.1

Instance details

Defined in GHC.Int

FiniteBits Int16

Since: base-4.6.0.0

Instance details

Defined in GHC.Int

Prim Int16 
Instance details

Defined in Data.Primitive.Types

Unbox Int16 
Instance details

Defined in Data.Vector.Unboxed.Base

Conjugate Int16 
Instance details

Defined in Linear.Conjugate

Methods

conjugate :: Int16 -> Int16 #

TrivialConjugate Int16 
Instance details

Defined in Linear.Conjugate

Vector Vector Int16 
Instance details

Defined in Data.Vector.Unboxed.Base

MVector MVector Int16 
Instance details

Defined in Data.Vector.Unboxed.Base

type Unsigned Int16 
Instance details

Defined in Data.Bytes.Signed

type Signed Int16 
Instance details

Defined in Data.Bytes.Signed

newtype Vector Int16 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s Int16 
Instance details

Defined in Data.Vector.Unboxed.Base

data Int32 #

32-bit signed integer type

Instances
Bounded Int32

Since: base-2.1

Instance details

Defined in GHC.Int

Enum Int32

Since: base-2.1

Instance details

Defined in GHC.Int

Eq Int32

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

(==) :: Int32 -> Int32 -> Bool #

(/=) :: Int32 -> Int32 -> Bool #

Integral Int32

Since: base-2.1

Instance details

Defined in GHC.Int

Num Int32

Since: base-2.1

Instance details

Defined in GHC.Int

Ord Int32

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

compare :: Int32 -> Int32 -> Ordering #

(<) :: Int32 -> Int32 -> Bool #

(<=) :: Int32 -> Int32 -> Bool #

(>) :: Int32 -> Int32 -> Bool #

(>=) :: Int32 -> Int32 -> Bool #

max :: Int32 -> Int32 -> Int32 #

min :: Int32 -> Int32 -> Int32 #

Read Int32

Since: base-2.1

Instance details

Defined in GHC.Int

Real Int32

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

toRational :: Int32 -> Rational #

Show Int32

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

showsPrec :: Int -> Int32 -> ShowS #

show :: Int32 -> String #

showList :: [Int32] -> ShowS #

Ix Int32

Since: base-2.1

Instance details

Defined in GHC.Int

Lift Int32 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Int32 -> Q Exp #

Storable Int32

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int32 -> Int #

alignment :: Int32 -> Int #

peekElemOff :: Ptr Int32 -> Int -> IO Int32 #

pokeElemOff :: Ptr Int32 -> Int -> Int32 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int32 #

pokeByteOff :: Ptr b -> Int -> Int32 -> IO () #

peek :: Ptr Int32 -> IO Int32 #

poke :: Ptr Int32 -> Int32 -> IO () #

Bits Int32

Since: base-2.1

Instance details

Defined in GHC.Int

FiniteBits Int32

Since: base-4.6.0.0

Instance details

Defined in GHC.Int

Prim Int32 
Instance details

Defined in Data.Primitive.Types

Unbox Int32 
Instance details

Defined in Data.Vector.Unboxed.Base

Conjugate Int32 
Instance details

Defined in Linear.Conjugate

Methods

conjugate :: Int32 -> Int32 #

TrivialConjugate Int32 
Instance details

Defined in Linear.Conjugate

Vector Vector Int32 
Instance details

Defined in Data.Vector.Unboxed.Base

MVector MVector Int32 
Instance details

Defined in Data.Vector.Unboxed.Base

type Unsigned Int32 
Instance details

Defined in Data.Bytes.Signed

type Signed Int32 
Instance details

Defined in Data.Bytes.Signed

newtype Vector Int32 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s Int32 
Instance details

Defined in Data.Vector.Unboxed.Base

data Int64 #

64-bit signed integer type

Instances
Bounded Int64

Since: base-2.1

Instance details

Defined in GHC.Int

Enum Int64

Since: base-2.1

Instance details

Defined in GHC.Int

Eq Int64

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

(==) :: Int64 -> Int64 -> Bool #

(/=) :: Int64 -> Int64 -> Bool #

Integral Int64

Since: base-2.1

Instance details

Defined in GHC.Int

Num Int64

Since: base-2.1

Instance details

Defined in GHC.Int

Ord Int64

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

compare :: Int64 -> Int64 -> Ordering #

(<) :: Int64 -> Int64 -> Bool #

(<=) :: Int64 -> Int64 -> Bool #

(>) :: Int64 -> Int64 -> Bool #

(>=) :: Int64 -> Int64 -> Bool #

max :: Int64 -> Int64 -> Int64 #

min :: Int64 -> Int64 -> Int64 #

Read Int64

Since: base-2.1

Instance details

Defined in GHC.Int

Real Int64

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

toRational :: Int64 -> Rational #

Show Int64

Since: base-2.1

Instance details

Defined in GHC.Int

Methods

showsPrec :: Int -> Int64 -> ShowS #

show :: Int64 -> String #

showList :: [Int64] -> ShowS #

Ix Int64

Since: base-2.1

Instance details

Defined in GHC.Int

Lift Int64 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Int64 -> Q Exp #

Storable Int64

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int64 -> Int #

alignment :: Int64 -> Int #

peekElemOff :: Ptr Int64 -> Int -> IO Int64 #

pokeElemOff :: Ptr Int64 -> Int -> Int64 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int64 #

pokeByteOff :: Ptr b -> Int -> Int64 -> IO () #

peek :: Ptr Int64 -> IO Int64 #

poke :: Ptr Int64 -> Int64 -> IO () #

Bits Int64

Since: base-2.1

Instance details

Defined in GHC.Int

FiniteBits Int64

Since: base-4.6.0.0

Instance details

Defined in GHC.Int

Prim Int64 
Instance details

Defined in Data.Primitive.Types

Unbox Int64 
Instance details

Defined in Data.Vector.Unboxed.Base

Conjugate Int64 
Instance details

Defined in Linear.Conjugate

Methods

conjugate :: Int64 -> Int64 #

TrivialConjugate Int64 
Instance details

Defined in Linear.Conjugate

Vector Vector Int64 
Instance details

Defined in Data.Vector.Unboxed.Base

MVector MVector Int64 
Instance details

Defined in Data.Vector.Unboxed.Base

type Unsigned Int64 
Instance details

Defined in Data.Bytes.Signed

type Signed Int64 
Instance details

Defined in Data.Bytes.Signed

newtype Vector Int64 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s Int64 
Instance details

Defined in Data.Vector.Unboxed.Base

data StablePtr a #

A stable pointer is a reference to a Haskell expression that is guaranteed not to be affected by garbage collection, i.e., it will neither be deallocated nor will the value of the stable pointer itself change during garbage collection (ordinary references may be relocated during garbage collection). Consequently, stable pointers can be passed to foreign code, which can treat it as an opaque reference to a Haskell value.

A value of type StablePtr a is a stable pointer to a Haskell expression of type a.

Instances
Eq (StablePtr a)

Since: base-2.1

Instance details

Defined in GHC.Stable

Methods

(==) :: StablePtr a -> StablePtr a -> Bool #

(/=) :: StablePtr a -> StablePtr a -> Bool #

Storable (StablePtr a)

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: StablePtr a -> Int #

alignment :: StablePtr a -> Int #

peekElemOff :: Ptr (StablePtr a) -> Int -> IO (StablePtr a) #

pokeElemOff :: Ptr (StablePtr a) -> Int -> StablePtr a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (StablePtr a) #

pokeByteOff :: Ptr b -> Int -> StablePtr a -> IO () #

peek :: Ptr (StablePtr a) -> IO (StablePtr a) #

poke :: Ptr (StablePtr a) -> StablePtr a -> IO () #

PrimUnlifted (StablePtr a)

Since: primitive-0.6.4.0

Instance details

Defined in Data.Primitive.UnliftedArray

data Word #

A Word is an unsigned integral type, with the same size as Int.

Instances
Bounded Word

Since: base-2.1

Instance details

Defined in GHC.Enum

Enum Word

Since: base-2.1

Instance details

Defined in GHC.Enum

Methods

succ :: Word -> Word #

pred :: Word -> Word #

toEnum :: Int -> Word #

fromEnum :: Word -> Int #

enumFrom :: Word -> [Word] #

enumFromThen :: Word -> Word -> [Word] #

enumFromTo :: Word -> Word -> [Word] #

enumFromThenTo :: Word -> Word -> Word -> [Word] #

Eq Word 
Instance details

Defined in GHC.Classes

Methods

(==) :: Word -> Word -> Bool #

(/=) :: Word -> Word -> Bool #

Integral Word

Since: base-2.1

Instance details

Defined in GHC.Real

Methods

quot :: Word -> Word -> Word #

rem :: Word -> Word -> Word #

div :: Word -> Word -> Word #

mod :: Word -> Word -> Word #

quotRem :: Word -> Word -> (Word, Word) #

divMod :: Word -> Word -> (Word, Word) #

toInteger :: Word -> Integer #

Num Word

Since: base-2.1

Instance details

Defined in GHC.Num

Methods

(+) :: Word -> Word -> Word #

(-) :: Word -> Word -> Word #

(*) :: Word -> Word -> Word #

negate :: Word -> Word #

abs :: Word -> Word #

signum :: Word -> Word #

fromInteger :: Integer -> Word #

Ord Word 
Instance details

Defined in GHC.Classes

Methods

compare :: Word -> Word -> Ordering #

(<) :: Word -> Word -> Bool #

(<=) :: Word -> Word -> Bool #

(>) :: Word -> Word -> Bool #

(>=) :: Word -> Word -> Bool #

max :: Word -> Word -> Word #

min :: Word -> Word -> Word #

Read Word

Since: base-4.5.0.0

Instance details

Defined in GHC.Read

Real Word

Since: base-2.1

Instance details

Defined in GHC.Real

Methods

toRational :: Word -> Rational #

Show Word

Since: base-2.1

Instance details

Defined in GHC.Show

Methods

showsPrec :: Int -> Word -> ShowS #

show :: Word -> String #

showList :: [Word] -> ShowS #

Ix Word

Since: base-4.6.0.0

Instance details

Defined in GHC.Arr

Methods

range :: (Word, Word) -> [Word] #

index :: (Word, Word) -> Word -> Int #

unsafeIndex :: (Word, Word) -> Word -> Int

inRange :: (Word, Word) -> Word -> Bool #

rangeSize :: (Word, Word) -> Int #

unsafeRangeSize :: (Word, Word) -> Int

Lift Word 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Word -> Q Exp #

Storable Word

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Word -> Int #

alignment :: Word -> Int #

peekElemOff :: Ptr Word -> Int -> IO Word #

pokeElemOff :: Ptr Word -> Int -> Word -> IO () #

peekByteOff :: Ptr b -> Int -> IO Word #

pokeByteOff :: Ptr b -> Int -> Word -> IO () #

peek :: Ptr Word -> IO Word #

poke :: Ptr Word -> Word -> IO () #

Bits Word

Since: base-2.1

Instance details

Defined in Data.Bits

FiniteBits Word

Since: base-4.6.0.0

Instance details

Defined in Data.Bits

Prim Word 
Instance details

Defined in Data.Primitive.Types

Unbox Word 
Instance details

Defined in Data.Vector.Unboxed.Base

Conjugate Word 
Instance details

Defined in Linear.Conjugate

Methods

conjugate :: Word -> Word #

TrivialConjugate Word 
Instance details

Defined in Linear.Conjugate

Vector Vector Word 
Instance details

Defined in Data.Vector.Unboxed.Base

MVector MVector Word 
Instance details

Defined in Data.Vector.Unboxed.Base

Generic1 (URec Word :: k -> Type) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep1 (URec Word) :: k -> Type #

Methods

from1 :: URec Word a -> Rep1 (URec Word) a #

to1 :: Rep1 (URec Word) a -> URec Word a #

Functor (URec Word :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

fmap :: (a -> b) -> URec Word a -> URec Word b #

(<$) :: a -> URec Word b -> URec Word a #

Foldable (URec Word :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => URec Word m -> m #

foldMap :: Monoid m => (a -> m) -> URec Word a -> m #

foldr :: (a -> b -> b) -> b -> URec Word a -> b #

foldr' :: (a -> b -> b) -> b -> URec Word a -> b #

foldl :: (b -> a -> b) -> b -> URec Word a -> b #

foldl' :: (b -> a -> b) -> b -> URec Word a -> b #

foldr1 :: (a -> a -> a) -> URec Word a -> a #

foldl1 :: (a -> a -> a) -> URec Word a -> a #

toList :: URec Word a -> [a] #

null :: URec Word a -> Bool #

length :: URec Word a -> Int #

elem :: Eq a => a -> URec Word a -> Bool #

maximum :: Ord a => URec Word a -> a #

minimum :: Ord a => URec Word a -> a #

sum :: Num a => URec Word a -> a #

product :: Num a => URec Word a -> a #

Traversable (URec Word :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Traversable

Methods

traverse :: Applicative f => (a -> f b) -> URec Word a -> f (URec Word b) #

sequenceA :: Applicative f => URec Word (f a) -> f (URec Word a) #

mapM :: Monad m => (a -> m b) -> URec Word a -> m (URec Word b) #

sequence :: Monad m => URec Word (m a) -> m (URec Word a) #

Eq (URec Word p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

(==) :: URec Word p -> URec Word p -> Bool #

(/=) :: URec Word p -> URec Word p -> Bool #

Ord (URec Word p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

compare :: URec Word p -> URec Word p -> Ordering #

(<) :: URec Word p -> URec Word p -> Bool #

(<=) :: URec Word p -> URec Word p -> Bool #

(>) :: URec Word p -> URec Word p -> Bool #

(>=) :: URec Word p -> URec Word p -> Bool #

max :: URec Word p -> URec Word p -> URec Word p #

min :: URec Word p -> URec Word p -> URec Word p #

Show (URec Word p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

showsPrec :: Int -> URec Word p -> ShowS #

show :: URec Word p -> String #

showList :: [URec Word p] -> ShowS #

Generic (URec Word p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (URec Word p) :: Type -> Type #

Methods

from :: URec Word p -> Rep (URec Word p) x #

to :: Rep (URec Word p) x -> URec Word p #

type Unsigned Word 
Instance details

Defined in Data.Bytes.Signed

type Signed Word 
Instance details

Defined in Data.Bytes.Signed

type Signed Word = Int
newtype Vector Word 
Instance details

Defined in Data.Vector.Unboxed.Base

data URec Word (p :: k)

Used for marking occurrences of Word#

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

data URec Word (p :: k) = UWord {}
newtype MVector s Word 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s Word = MV_Word (MVector s Word)
type Rep1 (URec Word :: k -> Type)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

type Rep1 (URec Word :: k -> Type) = D1 (MetaData "URec" "GHC.Generics" "base" False) (C1 (MetaCons "UWord" PrefixI True) (S1 (MetaSel (Just "uWord#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (UWord :: k -> Type)))
type Rep (URec Word p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

type Rep (URec Word p) = D1 (MetaData "URec" "GHC.Generics" "base" False) (C1 (MetaCons "UWord" PrefixI True) (S1 (MetaSel (Just "uWord#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (UWord :: Type -> Type)))

data Word8 #

8-bit unsigned integer type

Instances
Bounded Word8

Since: base-2.1

Instance details

Defined in GHC.Word

Enum Word8

Since: base-2.1

Instance details

Defined in GHC.Word

Eq Word8

Since: base-2.1

Instance details

Defined in GHC.Word

Methods

(==) :: Word8 -> Word8 -> Bool #

(/=) :: Word8 -> Word8 -> Bool #

Integral Word8

Since: base-2.1

Instance details

Defined in GHC.Word

Num Word8

Since: base-2.1

Instance details

Defined in GHC.Word

Ord Word8

Since: base-2.1

Instance details

Defined in GHC.Word

Methods

compare :: Word8 -> Word8 -> Ordering #

(<) :: Word8 -> Word8 -> Bool #

(<=) :: Word8 -> Word8 -> Bool #

(>) :: Word8 -> Word8 -> Bool #

(>=) :: Word8 -> Word8 -> Bool #

max :: Word8 -> Word8 -> Word8 #

min :: Word8 -> Word8 -> Word8 #

Read Word8

Since: base-2.1

Instance details

Defined in GHC.Read

Real Word8

Since: base-2.1

Instance details

Defined in GHC.Word

Methods

toRational :: Word8 -> Rational #

Show Word8

Since: base-2.1

Instance details

Defined in GHC.Word

Methods

showsPrec :: Int -> Word8 -> ShowS #

show :: Word8 -> String #

showList :: [Word8] -> ShowS #

Ix Word8

Since: base-2.1

Instance details

Defined in GHC.Word

Lift Word8 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Word8 -> Q Exp #

Storable Word8

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Word8 -> Int #

alignment :: Word8 -> Int #

peekElemOff :: Ptr Word8 -> Int -> IO Word8 #

pokeElemOff :: Ptr Word8 -> Int -> Word8 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Word8 #

pokeByteOff :: Ptr b -> Int -> Word8 -> IO () #

peek :: Ptr Word8 -> IO Word8 #

poke :: Ptr Word8 -> Word8 -> IO () #

Bits Word8

Since: base-2.1

Instance details

Defined in GHC.Word

FiniteBits Word8

Since: base-4.6.0.0

Instance details

Defined in GHC.Word

Prim Word8 
Instance details

Defined in Data.Primitive.Types

Unbox Word8 
Instance details

Defined in Data.Vector.Unboxed.Base

Conjugate Word8 
Instance details

Defined in Linear.Conjugate

Methods

conjugate :: Word8 -> Word8 #

TrivialConjugate Word8 
Instance details

Defined in Linear.Conjugate

Vector Vector Word8 
Instance details

Defined in Data.Vector.Unboxed.Base

MVector MVector Word8 
Instance details

Defined in Data.Vector.Unboxed.Base

type Unsigned Word8 
Instance details

Defined in Data.Bytes.Signed

type Signed Word8 
Instance details

Defined in Data.Bytes.Signed

newtype Vector Word8 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s Word8 
Instance details

Defined in Data.Vector.Unboxed.Base

data Word16 #

16-bit unsigned integer type

Instances
Bounded Word16

Since: base-2.1

Instance details

Defined in GHC.Word

Enum Word16

Since: base-2.1

Instance details

Defined in GHC.Word

Eq Word16

Since: base-2.1

Instance details

Defined in GHC.Word

Methods

(==) :: Word16 -> Word16 -> Bool #

(/=) :: Word16 -> Word16 -> Bool #

Integral Word16

Since: base-2.1

Instance details

Defined in GHC.Word

Num Word16

Since: base-2.1

Instance details

Defined in GHC.Word

Ord Word16

Since: base-2.1

Instance details

Defined in GHC.Word

Read Word16

Since: base-2.1

Instance details

Defined in GHC.Read

Real Word16

Since: base-2.1

Instance details

Defined in GHC.Word

Show Word16

Since: base-2.1

Instance details

Defined in GHC.Word

Ix Word16

Since: base-2.1

Instance details

Defined in GHC.Word

Lift Word16 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Word16 -> Q Exp #

Storable Word16

Since: base-2.1

Instance details

Defined in Foreign.Storable

Bits Word16

Since: base-2.1

Instance details

Defined in GHC.Word

FiniteBits Word16

Since: base-4.6.0.0

Instance details

Defined in GHC.Word

Prim Word16 
Instance details

Defined in Data.Primitive.Types

Unbox Word16 
Instance details

Defined in Data.Vector.Unboxed.Base

Conjugate Word16 
Instance details

Defined in Linear.Conjugate

Methods

conjugate :: Word16 -> Word16 #

TrivialConjugate Word16 
Instance details

Defined in Linear.Conjugate

Vector Vector Word16 
Instance details

Defined in Data.Vector.Unboxed.Base

MVector MVector Word16 
Instance details

Defined in Data.Vector.Unboxed.Base

type Unsigned Word16 
Instance details

Defined in Data.Bytes.Signed

type Signed Word16 
Instance details

Defined in Data.Bytes.Signed

newtype Vector Word16 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s Word16 
Instance details

Defined in Data.Vector.Unboxed.Base

data Word32 #

32-bit unsigned integer type

Instances
Bounded Word32

Since: base-2.1

Instance details

Defined in GHC.Word

Enum Word32

Since: base-2.1

Instance details

Defined in GHC.Word

Eq Word32

Since: base-2.1

Instance details

Defined in GHC.Word

Methods

(==) :: Word32 -> Word32 -> Bool #

(/=) :: Word32 -> Word32 -> Bool #

Integral Word32

Since: base-2.1

Instance details

Defined in GHC.Word

Num Word32

Since: base-2.1

Instance details

Defined in GHC.Word

Ord Word32

Since: base-2.1

Instance details

Defined in GHC.Word

Read Word32

Since: base-2.1

Instance details

Defined in GHC.Read

Real Word32

Since: base-2.1

Instance details

Defined in GHC.Word

Show Word32

Since: base-2.1

Instance details

Defined in GHC.Word

Ix Word32

Since: base-2.1

Instance details

Defined in GHC.Word

Lift Word32 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Word32 -> Q Exp #

Storable Word32

Since: base-2.1

Instance details

Defined in Foreign.Storable

Bits Word32

Since: base-2.1

Instance details

Defined in GHC.Word

FiniteBits Word32

Since: base-4.6.0.0

Instance details

Defined in GHC.Word

Prim Word32 
Instance details

Defined in Data.Primitive.Types

Unbox Word32 
Instance details

Defined in Data.Vector.Unboxed.Base

Conjugate Word32 
Instance details

Defined in Linear.Conjugate

Methods

conjugate :: Word32 -> Word32 #

TrivialConjugate Word32 
Instance details

Defined in Linear.Conjugate

Vector Vector Word32 
Instance details

Defined in Data.Vector.Unboxed.Base

MVector MVector Word32 
Instance details

Defined in Data.Vector.Unboxed.Base

type Unsigned Word32 
Instance details

Defined in Data.Bytes.Signed

type Signed Word32 
Instance details

Defined in Data.Bytes.Signed

newtype Vector Word32 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s Word32 
Instance details

Defined in Data.Vector.Unboxed.Base

data Word64 #

64-bit unsigned integer type

Instances
Bounded Word64

Since: base-2.1

Instance details

Defined in GHC.Word

Enum Word64

Since: base-2.1

Instance details

Defined in GHC.Word

Eq Word64

Since: base-2.1

Instance details

Defined in GHC.Word

Methods

(==) :: Word64 -> Word64 -> Bool #

(/=) :: Word64 -> Word64 -> Bool #

Integral Word64

Since: base-2.1

Instance details

Defined in GHC.Word

Num Word64

Since: base-2.1

Instance details

Defined in GHC.Word

Ord Word64

Since: base-2.1

Instance details

Defined in GHC.Word

Read Word64

Since: base-2.1

Instance details

Defined in GHC.Read

Real Word64

Since: base-2.1

Instance details

Defined in GHC.Word

Show Word64

Since: base-2.1

Instance details

Defined in GHC.Word

Ix Word64

Since: base-2.1

Instance details

Defined in GHC.Word

Lift Word64 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Word64 -> Q Exp #

Storable Word64

Since: base-2.1

Instance details

Defined in Foreign.Storable

Bits Word64

Since: base-2.1

Instance details

Defined in GHC.Word

FiniteBits Word64

Since: base-4.6.0.0

Instance details

Defined in GHC.Word

Prim Word64 
Instance details

Defined in Data.Primitive.Types

Unbox Word64 
Instance details

Defined in Data.Vector.Unboxed.Base

Conjugate Word64 
Instance details

Defined in Linear.Conjugate

Methods

conjugate :: Word64 -> Word64 #

TrivialConjugate Word64 
Instance details

Defined in Linear.Conjugate

Vector Vector Word64 
Instance details

Defined in Data.Vector.Unboxed.Base

MVector MVector Word64 
Instance details

Defined in Data.Vector.Unboxed.Base

type Unsigned Word64 
Instance details

Defined in Data.Bytes.Signed

type Signed Word64 
Instance details

Defined in Data.Bytes.Signed

newtype Vector Word64 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s Word64 
Instance details

Defined in Data.Vector.Unboxed.Base

data Ptr a #

A value of type Ptr a represents a pointer to an object, or an array of objects, which may be marshalled to or from Haskell values of type a.

The type a will often be an instance of class Storable which provides the marshalling operations. However this is not essential, and you can provide your own operations to access the pointer. For example you might write small foreign functions to get or set the fields of a C struct.

Instances
Generic1 (URec (Ptr ()) :: k -> Type) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep1 (URec (Ptr ())) :: k -> Type #

Methods

from1 :: URec (Ptr ()) a -> Rep1 (URec (Ptr ())) a #

to1 :: Rep1 (URec (Ptr ())) a -> URec (Ptr ()) a #

Eq (Ptr a)

Since: base-2.1

Instance details

Defined in GHC.Ptr

Methods

(==) :: Ptr a -> Ptr a -> Bool #

(/=) :: Ptr a -> Ptr a -> Bool #

Ord (Ptr a)

Since: base-2.1

Instance details

Defined in GHC.Ptr

Methods

compare :: Ptr a -> Ptr a -> Ordering #

(<) :: Ptr a -> Ptr a -> Bool #

(<=) :: Ptr a -> Ptr a -> Bool #

(>) :: Ptr a -> Ptr a -> Bool #

(>=) :: Ptr a -> Ptr a -> Bool #

max :: Ptr a -> Ptr a -> Ptr a #

min :: Ptr a -> Ptr a -> Ptr a #

Show (Ptr a)

Since: base-2.1

Instance details

Defined in GHC.Ptr

Methods

showsPrec :: Int -> Ptr a -> ShowS #

show :: Ptr a -> String #

showList :: [Ptr a] -> ShowS #

Storable (Ptr a)

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Ptr a -> Int #

alignment :: Ptr a -> Int #

peekElemOff :: Ptr (Ptr a) -> Int -> IO (Ptr a) #

pokeElemOff :: Ptr (Ptr a) -> Int -> Ptr a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Ptr a) #

pokeByteOff :: Ptr b -> Int -> Ptr a -> IO () #

peek :: Ptr (Ptr a) -> IO (Ptr a) #

poke :: Ptr (Ptr a) -> Ptr a -> IO () #

Prim (Ptr a) 
Instance details

Defined in Data.Primitive.Types

Functor (URec (Ptr ()) :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

fmap :: (a -> b) -> URec (Ptr ()) a -> URec (Ptr ()) b #

(<$) :: a -> URec (Ptr ()) b -> URec (Ptr ()) a #

Foldable (URec (Ptr ()) :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => URec (Ptr ()) m -> m #

foldMap :: Monoid m => (a -> m) -> URec (Ptr ()) a -> m #

foldr :: (a -> b -> b) -> b -> URec (Ptr ()) a -> b #

foldr' :: (a -> b -> b) -> b -> URec (Ptr ()) a -> b #

foldl :: (b -> a -> b) -> b -> URec (Ptr ()) a -> b #

foldl' :: (b -> a -> b) -> b -> URec (Ptr ()) a -> b #

foldr1 :: (a -> a -> a) -> URec (Ptr ()) a -> a #

foldl1 :: (a -> a -> a) -> URec (Ptr ()) a -> a #

toList :: URec (Ptr ()) a -> [a] #

null :: URec (Ptr ()) a -> Bool #

length :: URec (Ptr ()) a -> Int #

elem :: Eq a => a -> URec (Ptr ()) a -> Bool #

maximum :: Ord a => URec (Ptr ()) a -> a #

minimum :: Ord a => URec (Ptr ()) a -> a #

sum :: Num a => URec (Ptr ()) a -> a #

product :: Num a => URec (Ptr ()) a -> a #

Traversable (URec (Ptr ()) :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Traversable

Methods

traverse :: Applicative f => (a -> f b) -> URec (Ptr ()) a -> f (URec (Ptr ()) b) #

sequenceA :: Applicative f => URec (Ptr ()) (f a) -> f (URec (Ptr ()) a) #

mapM :: Monad m => (a -> m b) -> URec (Ptr ()) a -> m (URec (Ptr ()) b) #

sequence :: Monad m => URec (Ptr ()) (m a) -> m (URec (Ptr ()) a) #

Eq (URec (Ptr ()) p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

(==) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool #

(/=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool #

Ord (URec (Ptr ()) p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

compare :: URec (Ptr ()) p -> URec (Ptr ()) p -> Ordering #

(<) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool #

(<=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool #

(>) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool #

(>=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool #

max :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p #

min :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p #

Generic (URec (Ptr ()) p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (URec (Ptr ()) p) :: Type -> Type #

Methods

from :: URec (Ptr ()) p -> Rep (URec (Ptr ()) p) x #

to :: Rep (URec (Ptr ()) p) x -> URec (Ptr ()) p #

data URec (Ptr ()) (p :: k)

Used for marking occurrences of Addr#

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

data URec (Ptr ()) (p :: k) = UAddr {}
type Rep1 (URec (Ptr ()) :: k -> Type)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

type Rep1 (URec (Ptr ()) :: k -> Type) = D1 (MetaData "URec" "GHC.Generics" "base" False) (C1 (MetaCons "UAddr" PrefixI True) (S1 (MetaSel (Just "uAddr#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (UAddr :: k -> Type)))
type Rep (URec (Ptr ()) p)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

type Rep (URec (Ptr ()) p) = D1 (MetaData "URec" "GHC.Generics" "base" False) (C1 (MetaCons "UAddr" PrefixI True) (S1 (MetaSel (Just "uAddr#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (UAddr :: Type -> Type)))

data FunPtr a #

A value of type FunPtr a is a pointer to a function callable from foreign code. The type a will normally be a foreign type, a function type with zero or more arguments where

A value of type FunPtr a may be a pointer to a foreign function, either returned by another foreign function or imported with a a static address import like

foreign import ccall "stdlib.h &free"
  p_free :: FunPtr (Ptr a -> IO ())

or a pointer to a Haskell function created using a wrapper stub declared to produce a FunPtr of the correct type. For example:

type Compare = Int -> Int -> Bool
foreign import ccall "wrapper"
  mkCompare :: Compare -> IO (FunPtr Compare)

Calls to wrapper stubs like mkCompare allocate storage, which should be released with freeHaskellFunPtr when no longer required.

To convert FunPtr values to corresponding Haskell functions, one can define a dynamic stub for the specific foreign type, e.g.

type IntFunction = CInt -> IO ()
foreign import ccall "dynamic"
  mkFun :: FunPtr IntFunction -> IntFunction
Instances
Eq (FunPtr a) 
Instance details

Defined in GHC.Ptr

Methods

(==) :: FunPtr a -> FunPtr a -> Bool #

(/=) :: FunPtr a -> FunPtr a -> Bool #

Ord (FunPtr a) 
Instance details

Defined in GHC.Ptr

Methods

compare :: FunPtr a -> FunPtr a -> Ordering #

(<) :: FunPtr a -> FunPtr a -> Bool #

(<=) :: FunPtr a -> FunPtr a -> Bool #

(>) :: FunPtr a -> FunPtr a -> Bool #

(>=) :: FunPtr a -> FunPtr a -> Bool #

max :: FunPtr a -> FunPtr a -> FunPtr a #

min :: FunPtr a -> FunPtr a -> FunPtr a #

Show (FunPtr a)

Since: base-2.1

Instance details

Defined in GHC.Ptr

Methods

showsPrec :: Int -> FunPtr a -> ShowS #

show :: FunPtr a -> String #

showList :: [FunPtr a] -> ShowS #

Storable (FunPtr a)

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: FunPtr a -> Int #

alignment :: FunPtr a -> Int #

peekElemOff :: Ptr (FunPtr a) -> Int -> IO (FunPtr a) #

pokeElemOff :: Ptr (FunPtr a) -> Int -> FunPtr a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (FunPtr a) #

pokeByteOff :: Ptr b -> Int -> FunPtr a -> IO () #

peek :: Ptr (FunPtr a) -> IO (FunPtr a) #

poke :: Ptr (FunPtr a) -> FunPtr a -> IO () #

Prim (FunPtr a) 
Instance details

Defined in Data.Primitive.Types

data ForeignPtr a #

The type ForeignPtr represents references to objects that are maintained in a foreign language, i.e., that are not part of the data structures usually managed by the Haskell storage manager. The essential difference between ForeignPtrs and vanilla memory references of type Ptr a is that the former may be associated with finalizers. A finalizer is a routine that is invoked when the Haskell storage manager detects that - within the Haskell heap and stack - there are no more references left that are pointing to the ForeignPtr. Typically, the finalizer will, then, invoke routines in the foreign language that free the resources bound by the foreign object.

The ForeignPtr is parameterised in the same way as Ptr. The type argument of ForeignPtr should normally be an instance of class Storable.

Instances
Eq (ForeignPtr a)

Since: base-2.1

Instance details

Defined in GHC.ForeignPtr

Methods

(==) :: ForeignPtr a -> ForeignPtr a -> Bool #

(/=) :: ForeignPtr a -> ForeignPtr a -> Bool #

Ord (ForeignPtr a)

Since: base-2.1

Instance details

Defined in GHC.ForeignPtr

Show (ForeignPtr a)

Since: base-2.1

Instance details

Defined in GHC.ForeignPtr

pooledNewArray0 :: Storable a => Pool -> a -> [a] -> IO (Ptr a) #

Allocate consecutive storage for a list of values in the given pool and marshal these values into it, terminating the end with the given marker.

pooledNewArray :: Storable a => Pool -> [a] -> IO (Ptr a) #

Allocate consecutive storage for a list of values in the given pool and marshal these values into it.

pooledNew :: Storable a => Pool -> a -> IO (Ptr a) #

Allocate storage for a value in the given pool and marshal the value into this storage.

pooledReallocArray0 :: Storable a => Pool -> Ptr a -> Int -> IO (Ptr a) #

Adjust the size of an array with an end marker in the given pool.

pooledReallocArray :: Storable a => Pool -> Ptr a -> Int -> IO (Ptr a) #

Adjust the size of an array in the given pool.

pooledMallocArray0 :: Storable a => Pool -> Int -> IO (Ptr a) #

Allocate storage for the given number of elements of a storable type in the pool, but leave room for an extra element to signal the end of the array.

pooledMallocArray :: Storable a => Pool -> Int -> IO (Ptr a) #

Allocate storage for the given number of elements of a storable type in the pool.

pooledReallocBytes :: Pool -> Ptr a -> Int -> IO (Ptr a) #

Adjust the storage area for an element in the pool to the given size.

pooledRealloc :: Storable a => Pool -> Ptr a -> IO (Ptr a) #

Adjust the storage area for an element in the pool to the given size of the required type.

pooledMallocBytes :: Pool -> Int -> IO (Ptr a) #

Allocate the given number of bytes of storage in the pool.

pooledMalloc :: Storable a => Pool -> IO (Ptr a) #

Allocate space for storable type in the given pool. The size of the area allocated is determined by the sizeOf method from the instance of Storable for the appropriate type.

withPool :: (Pool -> IO b) -> IO b #

Execute an action with a fresh memory pool, which gets automatically deallocated (including its contents) after the action has finished.

freePool :: Pool -> IO () #

Deallocate a memory pool and everything which has been allocated in the pool itself.

newPool :: IO Pool #

Allocate a fresh memory pool.

data Pool #

A memory pool.

withCWStringLen :: String -> (CWStringLen -> IO a) -> IO a #

Marshal a Haskell string into a C wide string (i.e. wide character array) in temporary storage, with explicit length information.

  • the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.

withCWString :: String -> (CWString -> IO a) -> IO a #

Marshal a Haskell string into a NUL terminated C wide string using temporary storage.

  • the Haskell string may not contain any NUL characters
  • the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.

newCWStringLen :: String -> IO CWStringLen #

Marshal a Haskell string into a C wide string (ie, wide character array) with explicit length information.

  • new storage is allocated for the C wide string and must be explicitly freed using free or finalizerFree.

newCWString :: String -> IO CWString #

Marshal a Haskell string into a NUL terminated C wide string.

  • the Haskell string may not contain any NUL characters
  • new storage is allocated for the C wide string and must be explicitly freed using free or finalizerFree.

peekCWStringLen :: CWStringLen -> IO String #

Marshal a C wide string with explicit length into a Haskell string.

peekCWString :: CWString -> IO String #

Marshal a NUL terminated C wide string into a Haskell string.

withCAStringLen :: String -> (CStringLen -> IO a) -> IO a #

Marshal a Haskell string into a C string (ie, character array) in temporary storage, with explicit length information.

  • the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.

withCAString :: String -> (CString -> IO a) -> IO a #

Marshal a Haskell string into a NUL terminated C string using temporary storage.

  • the Haskell string may not contain any NUL characters
  • the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.

newCAStringLen :: String -> IO CStringLen #

Marshal a Haskell string into a C string (ie, character array) with explicit length information.

  • new storage is allocated for the C string and must be explicitly freed using free or finalizerFree.

newCAString :: String -> IO CString #

Marshal a Haskell string into a NUL terminated C string.

  • the Haskell string may not contain any NUL characters
  • new storage is allocated for the C string and must be explicitly freed using free or finalizerFree.

peekCAStringLen :: CStringLen -> IO String #

Marshal a C string with explicit length into a Haskell string.

peekCAString :: CString -> IO String #

Marshal a NUL terminated C string into a Haskell string.

castCharToCSChar :: Char -> CSChar #

Convert a Haskell character to a C signed char. This function is only safe on the first 256 characters.

castCSCharToChar :: CSChar -> Char #

Convert a C signed char, representing a Latin-1 character, to the corresponding Haskell character.

castCharToCUChar :: Char -> CUChar #

Convert a Haskell character to a C unsigned char. This function is only safe on the first 256 characters.

castCUCharToChar :: CUChar -> Char #

Convert a C unsigned char, representing a Latin-1 character, to the corresponding Haskell character.

castCharToCChar :: Char -> CChar #

Convert a Haskell character to a C character. This function is only safe on the first 256 characters.

castCCharToChar :: CChar -> Char #

Convert a C byte, representing a Latin-1 character, to the corresponding Haskell character.

withCStringLen :: String -> (CStringLen -> IO a) -> IO a #

Marshal a Haskell string into a C string (ie, character array) in temporary storage, with explicit length information.

  • the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.

withCString :: String -> (CString -> IO a) -> IO a #

Marshal a Haskell string into a NUL terminated C string using temporary storage.

  • the Haskell string may not contain any NUL characters
  • the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.

newCStringLen :: String -> IO CStringLen #

Marshal a Haskell string into a C string (ie, character array) with explicit length information.

  • new storage is allocated for the C string and must be explicitly freed using free or finalizerFree.

newCString :: String -> IO CString #

Marshal a Haskell string into a NUL terminated C string.

  • the Haskell string may not contain any NUL characters
  • new storage is allocated for the C string and must be explicitly freed using free or finalizerFree.

peekCStringLen :: CStringLen -> IO String #

Marshal a C string with explicit length into a Haskell string.

peekCString :: CString -> IO String #

Marshal a NUL terminated C string into a Haskell string.

type CString = Ptr CChar #

A C string is a reference to an array of C characters terminated by NUL.

type CStringLen = (Ptr CChar, Int) #

A string with explicit length information in bytes instead of a terminating NUL (allowing NUL characters in the middle of the string).

type CWString = Ptr CWchar #

A C wide string is a reference to an array of C wide characters terminated by NUL.

type CWStringLen = (Ptr CWchar, Int) #

A wide character string with explicit length information in CWchars instead of a terminating NUL (allowing NUL characters in the middle of the string).

advancePtr :: Storable a => Ptr a -> Int -> Ptr a #

Advance a pointer into an array by the given number of elements

lengthArray0 :: (Storable a, Eq a) => a -> Ptr a -> IO Int #

Return the number of elements in an array, excluding the terminator

moveArray :: Storable a => Ptr a -> Ptr a -> Int -> IO () #

Copy the given number of elements from the second array (source) into the first array (destination); the copied areas may overlap

copyArray :: Storable a => Ptr a -> Ptr a -> Int -> IO () #

Copy the given number of elements from the second array (source) into the first array (destination); the copied areas may not overlap

withArrayLen0 :: Storable a => a -> [a] -> (Int -> Ptr a -> IO b) -> IO b #

Like withArrayLen, but a terminator indicates where the array ends

withArray0 :: Storable a => a -> [a] -> (Ptr a -> IO b) -> IO b #

Like withArray, but a terminator indicates where the array ends

withArrayLen :: Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b #

Like withArray, but the action gets the number of values as an additional parameter

withArray :: Storable a => [a] -> (Ptr a -> IO b) -> IO b #

Temporarily store a list of storable values in memory (like with, but for multiple elements).

newArray0 :: Storable a => a -> [a] -> IO (Ptr a) #

Write a list of storable elements into a newly allocated, consecutive sequence of storable values, where the end is fixed by the given end marker

newArray :: Storable a => [a] -> IO (Ptr a) #

Write a list of storable elements into a newly allocated, consecutive sequence of storable values (like new, but for multiple elements).

pokeArray0 :: Storable a => a -> Ptr a -> [a] -> IO () #

Write the list elements consecutive into memory and terminate them with the given marker element

pokeArray :: Storable a => Ptr a -> [a] -> IO () #

Write the list elements consecutive into memory

peekArray0 :: (Storable a, Eq a) => a -> Ptr a -> IO [a] #

Convert an array terminated by the given end marker into a Haskell list

peekArray :: Storable a => Int -> Ptr a -> IO [a] #

Convert an array of given length into a Haskell list. The implementation is tail-recursive and so uses constant stack space.

reallocArray0 :: Storable a => Ptr a -> Int -> IO (Ptr a) #

Adjust the size of an array including an extra position for the end marker.

reallocArray :: Storable a => Ptr a -> Int -> IO (Ptr a) #

Adjust the size of an array

allocaArray0 :: Storable a => Int -> (Ptr a -> IO b) -> IO b #

Like allocaArray, but add an extra position to hold a special termination element.

allocaArray :: Storable a => Int -> (Ptr a -> IO b) -> IO b #

Temporarily allocate space for the given number of elements (like alloca, but for multiple elements).

callocArray0 :: Storable a => Int -> IO (Ptr a) #

Like callocArray0, but allocated memory is filled with bytes of value zero.

callocArray :: Storable a => Int -> IO (Ptr a) #

Like mallocArray, but allocated memory is filled with bytes of value zero.

mallocArray0 :: Storable a => Int -> IO (Ptr a) #

Like mallocArray, but add an extra position to hold a special termination element.

mallocArray :: Storable a => Int -> IO (Ptr a) #

Allocate storage for the given number of elements of a storable type (like malloc, but for multiple elements).

fillBytes :: Ptr a -> Word8 -> Int -> IO () #

Fill a given number of bytes in memory area with a byte value.

Since: base-4.8.0.0

moveBytes :: Ptr a -> Ptr a -> Int -> IO () #

Copies the given number of bytes from the second area (source) into the first (destination); the copied areas may overlap

copyBytes :: Ptr a -> Ptr a -> Int -> IO () #

Copies the given number of bytes from the second area (source) into the first (destination); the copied areas may not overlap

withMany :: (a -> (b -> res) -> res) -> [a] -> ([b] -> res) -> res #

Replicates a withXXX combinator over a list of objects, yielding a list of marshalled objects

maybePeek :: (Ptr a -> IO b) -> Ptr a -> IO (Maybe b) #

Convert a peek combinator into a one returning Nothing if applied to a nullPtr

maybeWith :: (a -> (Ptr b -> IO c) -> IO c) -> Maybe a -> (Ptr b -> IO c) -> IO c #

Converts a withXXX combinator into one marshalling a value wrapped into a Maybe, using nullPtr to represent Nothing.

maybeNew :: (a -> IO (Ptr b)) -> Maybe a -> IO (Ptr b) #

Allocate storage and marshal a storable value wrapped into a Maybe

toBool :: (Eq a, Num a) => a -> Bool #

Convert a Boolean in numeric representation to a Haskell value

fromBool :: Num a => Bool -> a #

Convert a Haskell Bool to its numeric representation

with :: Storable a => a -> (Ptr a -> IO b) -> IO b #

with val f executes the computation f, passing as argument a pointer to a temporarily allocated block of memory into which val has been marshalled (the combination of alloca and poke).

The memory is freed when f terminates (either normally or via an exception), so the pointer passed to f must not be used after this.

new :: Storable a => a -> IO (Ptr a) #

Allocate a block of memory and marshal a value into it (the combination of malloc and poke). The size of the area allocated is determined by the sizeOf method from the instance of Storable for the appropriate type.

The memory may be deallocated using free or finalizerFree when no longer required.

free :: Ptr a -> IO () #

Free a block of memory that was allocated with malloc, mallocBytes, realloc, reallocBytes, new or any of the newX functions in Foreign.Marshal.Array or Foreign.C.String.

reallocBytes :: Ptr a -> Int -> IO (Ptr a) #

Resize a memory area that was allocated with malloc or mallocBytes to the given size. The returned pointer may refer to an entirely different memory area, but will be sufficiently aligned for any of the basic foreign types that fits into a memory block of the given size. The contents of the referenced memory area will be the same as of the original pointer up to the minimum of the original size and the given size.

If the pointer argument to reallocBytes is nullPtr, reallocBytes behaves like malloc. If the requested size is 0, reallocBytes behaves like free.

realloc :: Storable b => Ptr a -> IO (Ptr b) #

Resize a memory area that was allocated with malloc or mallocBytes to the size needed to store values of type b. The returned pointer may refer to an entirely different memory area, but will be suitably aligned to hold values of type b. The contents of the referenced memory area will be the same as of the original pointer up to the minimum of the original size and the size of values of type b.

If the argument to realloc is nullPtr, realloc behaves like malloc.

allocaBytesAligned :: Int -> Int -> (Ptr a -> IO b) -> IO b #

allocaBytes :: Int -> (Ptr a -> IO b) -> IO b #

allocaBytes n f executes the computation f, passing as argument a pointer to a temporarily allocated block of memory of n bytes. The block of memory is sufficiently aligned for any of the basic foreign types that fits into a memory block of the allocated size.

The memory is freed when f terminates (either normally or via an exception), so the pointer passed to f must not be used after this.

alloca :: Storable a => (Ptr a -> IO b) -> IO b #

alloca f executes the computation f, passing as argument a pointer to a temporarily allocated block of memory sufficient to hold values of type a.

The memory is freed when f terminates (either normally or via an exception), so the pointer passed to f must not be used after this.

callocBytes :: Int -> IO (Ptr a) #

Llike mallocBytes but memory is filled with bytes of value zero.

mallocBytes :: Int -> IO (Ptr a) #

Allocate a block of memory of the given number of bytes. The block of memory is sufficiently aligned for any of the basic foreign types that fits into a memory block of the allocated size.

The memory may be deallocated using free or finalizerFree when no longer required.

calloc :: Storable a => IO (Ptr a) #

Like malloc but memory is filled with bytes of value zero.

malloc :: Storable a => IO (Ptr a) #

Allocate a block of memory that is sufficient to hold values of type a. The size of the area allocated is determined by the sizeOf method from the instance of Storable for the appropriate type.

The memory may be deallocated using free or finalizerFree when no longer required.

finalizerFree :: FinalizerPtr a #

A pointer to a foreign function equivalent to free, which may be used as a finalizer (cf ForeignPtr) for storage allocated with malloc, mallocBytes, realloc or reallocBytes.

void :: IO a -> IO () #

Discard the return value of an IO action

throwIfNull :: String -> IO (Ptr a) -> IO (Ptr a) #

Guards against null pointers

throwIfNeg_ :: (Ord a, Num a) => (a -> String) -> IO a -> IO () #

Like throwIfNeg, but discarding the result

throwIfNeg :: (Ord a, Num a) => (a -> String) -> IO a -> IO a #

Guards against negative result values

throwIf_ :: (a -> Bool) -> (a -> String) -> IO a -> IO () #

Like throwIf, but discarding the result

throwIf #

Arguments

:: (a -> Bool)

error condition on the result of the IO action

-> (a -> String)

computes an error message from erroneous results of the IO action

-> IO a

the IO action to be executed

-> IO a 

Execute an IO action, throwing a userError if the predicate yields True when applied to the result returned by the IO action. If no exception is raised, return the result of the computation.

mallocForeignPtrArray0 :: Storable a => Int -> IO (ForeignPtr a) #

This function is similar to mallocArray0, but yields a memory area that has a finalizer attached that releases the memory area. As with mallocForeignPtr, it is not guaranteed that the block of memory was allocated by malloc.

mallocForeignPtrArray :: Storable a => Int -> IO (ForeignPtr a) #

This function is similar to mallocArray, but yields a memory area that has a finalizer attached that releases the memory area. As with mallocForeignPtr, it is not guaranteed that the block of memory was allocated by malloc.

newForeignPtrEnv :: FinalizerEnvPtr env a -> Ptr env -> Ptr a -> IO (ForeignPtr a) #

This variant of newForeignPtr adds a finalizer that expects an environment in addition to the finalized pointer. The environment that will be passed to the finalizer is fixed by the second argument to newForeignPtrEnv.

withForeignPtr :: ForeignPtr a -> (Ptr a -> IO b) -> IO b #

This is a way to look at the pointer living inside a foreign object. This function takes a function which is applied to that pointer. The resulting IO action is then executed. The foreign object is kept alive at least during the whole action, even if it is not used directly inside. Note that it is not safe to return the pointer from the action and use it after the action completes. All uses of the pointer should be inside the withForeignPtr bracket. The reason for this unsafeness is the same as for unsafeForeignPtrToPtr below: the finalizer may run earlier than expected, because the compiler can only track usage of the ForeignPtr object, not a Ptr object made from it.

This function is normally used for marshalling data to or from the object pointed to by the ForeignPtr, using the operations from the Storable class.

newForeignPtr :: FinalizerPtr a -> Ptr a -> IO (ForeignPtr a) #

Turns a plain memory reference into a foreign pointer, and associates a finalizer with the reference. The finalizer will be executed after the last reference to the foreign object is dropped. There is no guarantee of promptness, however the finalizer will be executed before the program exits.

finalizeForeignPtr :: ForeignPtr a -> IO () #

Causes the finalizers associated with a foreign pointer to be run immediately.

plusForeignPtr :: ForeignPtr a -> Int -> ForeignPtr b #

Advances the given address by the given offset in bytes.

The new ForeignPtr shares the finalizer of the original, equivalent from a finalization standpoint to just creating another reference to the original. That is, the finalizer will not be called before the new ForeignPtr is unreachable, nor will it be called an additional time due to this call, and the finalizer will be called with the same address that it would have had this call not happened, *not* the new address.

Since: base-4.10.0.0

castForeignPtr :: ForeignPtr a -> ForeignPtr b #

This function casts a ForeignPtr parameterised by one type into another type.

touchForeignPtr :: ForeignPtr a -> IO () #

This function ensures that the foreign object in question is alive at the given place in the sequence of IO actions. In particular withForeignPtr does a touchForeignPtr after it executes the user action.

Note that this function should not be used to express dependencies between finalizers on ForeignPtrs. For example, if the finalizer for a ForeignPtr F1 calls touchForeignPtr on a second ForeignPtr F2, then the only guarantee is that the finalizer for F2 is never started before the finalizer for F1. They might be started together if for example both F1 and F2 are otherwise unreachable, and in that case the scheduler might end up running the finalizer for F2 first.

In general, it is not recommended to use finalizers on separate objects with ordering constraints between them. To express the ordering robustly requires explicit synchronisation using MVars between the finalizers, but even then the runtime sometimes runs multiple finalizers sequentially in a single thread (for performance reasons), so synchronisation between finalizers could result in artificial deadlock. Another alternative is to use explicit reference counting.

newForeignPtr_ :: Ptr a -> IO (ForeignPtr a) #

Turns a plain memory reference into a foreign pointer that may be associated with finalizers by using addForeignPtrFinalizer.

addForeignPtrFinalizerEnv :: FinalizerEnvPtr env a -> Ptr env -> ForeignPtr a -> IO () #

Like addForeignPtrFinalizerEnv but allows the finalizer to be passed an additional environment parameter to be passed to the finalizer. The environment passed to the finalizer is fixed by the second argument to addForeignPtrFinalizerEnv

addForeignPtrFinalizer :: FinalizerPtr a -> ForeignPtr a -> IO () #

This function adds a finalizer to the given foreign object. The finalizer will run before all other finalizers for the same object which have already been registered.

mallocForeignPtrBytes :: Int -> IO (ForeignPtr a) #

This function is similar to mallocForeignPtr, except that the size of the memory required is given explicitly as a number of bytes.

mallocForeignPtr :: Storable a => IO (ForeignPtr a) #

Allocate some memory and return a ForeignPtr to it. The memory will be released automatically when the ForeignPtr is discarded.

mallocForeignPtr is equivalent to

   do { p <- malloc; newForeignPtr finalizerFree p }

although it may be implemented differently internally: you may not assume that the memory returned by mallocForeignPtr has been allocated with malloc.

GHC notes: mallocForeignPtr has a heavily optimised implementation in GHC. It uses pinned memory in the garbage collected heap, so the ForeignPtr does not require a finalizer to free the memory. Use of mallocForeignPtr and associated functions is strongly recommended in preference to newForeignPtr with a finalizer.

type FinalizerPtr a = FunPtr (Ptr a -> IO ()) #

A finalizer is represented as a pointer to a foreign function that, at finalisation time, gets as an argument a plain pointer variant of the foreign pointer that the finalizer is associated with.

Note that the foreign function must use the ccall calling convention.

type FinalizerEnvPtr env a = FunPtr (Ptr env -> Ptr a -> IO ()) #

intPtrToPtr :: IntPtr -> Ptr a #

casts an IntPtr to a Ptr

ptrToIntPtr :: Ptr a -> IntPtr #

casts a Ptr to an IntPtr

wordPtrToPtr :: WordPtr -> Ptr a #

casts a WordPtr to a Ptr

ptrToWordPtr :: Ptr a -> WordPtr #

casts a Ptr to a WordPtr

freeHaskellFunPtr :: FunPtr a -> IO () #

Release the storage associated with the given FunPtr, which must have been obtained from a wrapper stub. This should be called whenever the return value from a foreign import wrapper function is no longer required; otherwise, the storage it uses will leak.

newtype WordPtr #

An unsigned integral type that can be losslessly converted to and from Ptr. This type is also compatible with the C99 type uintptr_t, and can be marshalled to and from that type safely.

Constructors

WordPtr Word 
Instances
Bounded WordPtr 
Instance details

Defined in Foreign.Ptr

Enum WordPtr 
Instance details

Defined in Foreign.Ptr

Eq WordPtr 
Instance details

Defined in Foreign.Ptr

Methods

(==) :: WordPtr -> WordPtr -> Bool #

(/=) :: WordPtr -> WordPtr -> Bool #

Integral WordPtr 
Instance details

Defined in Foreign.Ptr

Num WordPtr 
Instance details

Defined in Foreign.Ptr

Ord WordPtr 
Instance details

Defined in Foreign.Ptr

Read WordPtr 
Instance details

Defined in Foreign.Ptr

Real WordPtr 
Instance details

Defined in Foreign.Ptr

Show WordPtr 
Instance details

Defined in Foreign.Ptr

Storable WordPtr 
Instance details

Defined in Foreign.Ptr

Bits WordPtr 
Instance details

Defined in Foreign.Ptr

FiniteBits WordPtr 
Instance details

Defined in Foreign.Ptr

newtype IntPtr #

A signed integral type that can be losslessly converted to and from Ptr. This type is also compatible with the C99 type intptr_t, and can be marshalled to and from that type safely.

Constructors

IntPtr Int 
Instances
Bounded IntPtr 
Instance details

Defined in Foreign.Ptr

Enum IntPtr 
Instance details

Defined in Foreign.Ptr

Eq IntPtr 
Instance details

Defined in Foreign.Ptr

Methods

(==) :: IntPtr -> IntPtr -> Bool #

(/=) :: IntPtr -> IntPtr -> Bool #

Integral IntPtr 
Instance details

Defined in Foreign.Ptr

Num IntPtr 
Instance details

Defined in Foreign.Ptr

Ord IntPtr 
Instance details

Defined in Foreign.Ptr

Read IntPtr 
Instance details

Defined in Foreign.Ptr

Real IntPtr 
Instance details

Defined in Foreign.Ptr

Show IntPtr 
Instance details

Defined in Foreign.Ptr

Storable IntPtr 
Instance details

Defined in Foreign.Ptr

Bits IntPtr 
Instance details

Defined in Foreign.Ptr

FiniteBits IntPtr 
Instance details

Defined in Foreign.Ptr

class Storable a where #

The member functions of this class facilitate writing values of primitive types to raw memory (which may have been allocated with the above mentioned routines) and reading values from blocks of raw memory. The class, furthermore, includes support for computing the storage requirements and alignment restrictions of storable types.

Memory addresses are represented as values of type Ptr a, for some a which is an instance of class Storable. The type argument to Ptr helps provide some valuable type safety in FFI code (you can't mix pointers of different types without an explicit cast), while helping the Haskell type system figure out which marshalling method is needed for a given pointer.

All marshalling between Haskell and a foreign language ultimately boils down to translating Haskell data structures into the binary representation of a corresponding data structure of the foreign language and vice versa. To code this marshalling in Haskell, it is necessary to manipulate primitive data types stored in unstructured memory blocks. The class Storable facilitates this manipulation on all types for which it is instantiated, which are the standard basic types of Haskell, the fixed size Int types (Int8, Int16, Int32, Int64), the fixed size Word types (Word8, Word16, Word32, Word64), StablePtr, all types from Foreign.C.Types, as well as Ptr.

Minimal complete definition

sizeOf, alignment, (peek | peekElemOff | peekByteOff), (poke | pokeElemOff | pokeByteOff)

Methods

sizeOf :: a -> Int #

Computes the storage requirements (in bytes) of the argument. The value of the argument is not used.

alignment :: a -> Int #

Computes the alignment constraint of the argument. An alignment constraint x is fulfilled by any address divisible by x. The value of the argument is not used.

peekElemOff :: Ptr a -> Int -> IO a #

Read a value from a memory area regarded as an array of values of the same kind. The first argument specifies the start address of the array and the second the index into the array (the first element of the array has index 0). The following equality holds,

peekElemOff addr idx = IOExts.fixIO $ \result ->
  peek (addr `plusPtr` (idx * sizeOf result))

Note that this is only a specification, not necessarily the concrete implementation of the function.

pokeElemOff :: Ptr a -> Int -> a -> IO () #

Write a value to a memory area regarded as an array of values of the same kind. The following equality holds:

pokeElemOff addr idx x = 
  poke (addr `plusPtr` (idx * sizeOf x)) x

peekByteOff :: Ptr b -> Int -> IO a #

Read a value from a memory location given by a base address and offset. The following equality holds:

peekByteOff addr off = peek (addr `plusPtr` off)

pokeByteOff :: Ptr b -> Int -> a -> IO () #

Write a value to a memory location given by a base address and offset. The following equality holds:

pokeByteOff addr off x = poke (addr `plusPtr` off) x

peek :: Ptr a -> IO a #

Read a value from the given memory location.

Note that the peek and poke functions might require properly aligned addresses to function correctly. This is architecture dependent; thus, portable code should ensure that when peeking or poking values of some type a, the alignment constraint for a, as given by the function alignment is fulfilled.

poke :: Ptr a -> a -> IO () #

Write the given value to the given memory location. Alignment restrictions might apply; see peek.

Instances
Storable Bool

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Bool -> Int #

alignment :: Bool -> Int #

peekElemOff :: Ptr Bool -> Int -> IO Bool #

pokeElemOff :: Ptr Bool -> Int -> Bool -> IO () #

peekByteOff :: Ptr b -> Int -> IO Bool #

pokeByteOff :: Ptr b -> Int -> Bool -> IO () #

peek :: Ptr Bool -> IO Bool #

poke :: Ptr Bool -> Bool -> IO () #

Storable Char

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Char -> Int #

alignment :: Char -> Int #

peekElemOff :: Ptr Char -> Int -> IO Char #

pokeElemOff :: Ptr Char -> Int -> Char -> IO () #

peekByteOff :: Ptr b -> Int -> IO Char #

pokeByteOff :: Ptr b -> Int -> Char -> IO () #

peek :: Ptr Char -> IO Char #

poke :: Ptr Char -> Char -> IO () #

Storable Double

Since: base-2.1

Instance details

Defined in Foreign.Storable

Storable Float

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Float -> Int #

alignment :: Float -> Int #

peekElemOff :: Ptr Float -> Int -> IO Float #

pokeElemOff :: Ptr Float -> Int -> Float -> IO () #

peekByteOff :: Ptr b -> Int -> IO Float #

pokeByteOff :: Ptr b -> Int -> Float -> IO () #

peek :: Ptr Float -> IO Float #

poke :: Ptr Float -> Float -> IO () #

Storable Int

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int -> Int #

alignment :: Int -> Int #

peekElemOff :: Ptr Int -> Int -> IO Int #

pokeElemOff :: Ptr Int -> Int -> Int -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int #

pokeByteOff :: Ptr b -> Int -> Int -> IO () #

peek :: Ptr Int -> IO Int #

poke :: Ptr Int -> Int -> IO () #

Storable Int8

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int8 -> Int #

alignment :: Int8 -> Int #

peekElemOff :: Ptr Int8 -> Int -> IO Int8 #

pokeElemOff :: Ptr Int8 -> Int -> Int8 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int8 #

pokeByteOff :: Ptr b -> Int -> Int8 -> IO () #

peek :: Ptr Int8 -> IO Int8 #

poke :: Ptr Int8 -> Int8 -> IO () #

Storable Int16

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int16 -> Int #

alignment :: Int16 -> Int #

peekElemOff :: Ptr Int16 -> Int -> IO Int16 #

pokeElemOff :: Ptr Int16 -> Int -> Int16 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int16 #

pokeByteOff :: Ptr b -> Int -> Int16 -> IO () #

peek :: Ptr Int16 -> IO Int16 #

poke :: Ptr Int16 -> Int16 -> IO () #

Storable Int32

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int32 -> Int #

alignment :: Int32 -> Int #

peekElemOff :: Ptr Int32 -> Int -> IO Int32 #

pokeElemOff :: Ptr Int32 -> Int -> Int32 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int32 #

pokeByteOff :: Ptr b -> Int -> Int32 -> IO () #

peek :: Ptr Int32 -> IO Int32 #

poke :: Ptr Int32 -> Int32 -> IO () #

Storable Int64

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int64 -> Int #

alignment :: Int64 -> Int #

peekElemOff :: Ptr Int64 -> Int -> IO Int64 #

pokeElemOff :: Ptr Int64 -> Int -> Int64 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int64 #

pokeByteOff :: Ptr b -> Int -> Int64 -> IO () #

peek :: Ptr Int64 -> IO Int64 #

poke :: Ptr Int64 -> Int64 -> IO () #

Storable Word

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Word -> Int #

alignment :: Word -> Int #

peekElemOff :: Ptr Word -> Int -> IO Word #

pokeElemOff :: Ptr Word -> Int -> Word -> IO () #

peekByteOff :: Ptr b -> Int -> IO Word #

pokeByteOff :: Ptr b -> Int -> Word -> IO () #

peek :: Ptr Word -> IO Word #

poke :: Ptr Word -> Word -> IO () #

Storable Word8

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Word8 -> Int #

alignment :: Word8 -> Int #

peekElemOff :: Ptr Word8 -> Int -> IO Word8 #

pokeElemOff :: Ptr Word8 -> Int -> Word8 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Word8 #

pokeByteOff :: Ptr b -> Int -> Word8 -> IO () #

peek :: Ptr Word8 -> IO Word8 #

poke :: Ptr Word8 -> Word8 -> IO () #

Storable Word16

Since: base-2.1

Instance details

Defined in Foreign.Storable

Storable Word32

Since: base-2.1

Instance details

Defined in Foreign.Storable

Storable Word64

Since: base-2.1

Instance details

Defined in Foreign.Storable

Storable ()

Since: base-4.9.0.0

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: () -> Int #

alignment :: () -> Int #

peekElemOff :: Ptr () -> Int -> IO () #

pokeElemOff :: Ptr () -> Int -> () -> IO () #

peekByteOff :: Ptr b -> Int -> IO () #

pokeByteOff :: Ptr b -> Int -> () -> IO () #

peek :: Ptr () -> IO () #

poke :: Ptr () -> () -> IO () #

Storable CChar 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CChar -> Int #

alignment :: CChar -> Int #

peekElemOff :: Ptr CChar -> Int -> IO CChar #

pokeElemOff :: Ptr CChar -> Int -> CChar -> IO () #

peekByteOff :: Ptr b -> Int -> IO CChar #

pokeByteOff :: Ptr b -> Int -> CChar -> IO () #

peek :: Ptr CChar -> IO CChar #

poke :: Ptr CChar -> CChar -> IO () #

Storable CSChar 
Instance details

Defined in Foreign.C.Types

Storable CUChar 
Instance details

Defined in Foreign.C.Types

Storable CShort 
Instance details

Defined in Foreign.C.Types

Storable CUShort 
Instance details

Defined in Foreign.C.Types

Storable CInt 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CInt -> Int #

alignment :: CInt -> Int #

peekElemOff :: Ptr CInt -> Int -> IO CInt #

pokeElemOff :: Ptr CInt -> Int -> CInt -> IO () #

peekByteOff :: Ptr b -> Int -> IO CInt #

pokeByteOff :: Ptr b -> Int -> CInt -> IO () #

peek :: Ptr CInt -> IO CInt #

poke :: Ptr CInt -> CInt -> IO () #

Storable CUInt 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CUInt -> Int #

alignment :: CUInt -> Int #

peekElemOff :: Ptr CUInt -> Int -> IO CUInt #

pokeElemOff :: Ptr CUInt -> Int -> CUInt -> IO () #

peekByteOff :: Ptr b -> Int -> IO CUInt #

pokeByteOff :: Ptr b -> Int -> CUInt -> IO () #

peek :: Ptr CUInt -> IO CUInt #

poke :: Ptr CUInt -> CUInt -> IO () #

Storable CLong 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CLong -> Int #

alignment :: CLong -> Int #

peekElemOff :: Ptr CLong -> Int -> IO CLong #

pokeElemOff :: Ptr CLong -> Int -> CLong -> IO () #

peekByteOff :: Ptr b -> Int -> IO CLong #

pokeByteOff :: Ptr b -> Int -> CLong -> IO () #

peek :: Ptr CLong -> IO CLong #

poke :: Ptr CLong -> CLong -> IO () #

Storable CULong 
Instance details

Defined in Foreign.C.Types

Storable CLLong 
Instance details

Defined in Foreign.C.Types

Storable CULLong 
Instance details

Defined in Foreign.C.Types

Storable CBool 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CBool -> Int #

alignment :: CBool -> Int #

peekElemOff :: Ptr CBool -> Int -> IO CBool #

pokeElemOff :: Ptr CBool -> Int -> CBool -> IO () #

peekByteOff :: Ptr b -> Int -> IO CBool #

pokeByteOff :: Ptr b -> Int -> CBool -> IO () #

peek :: Ptr CBool -> IO CBool #

poke :: Ptr CBool -> CBool -> IO () #

Storable CFloat 
Instance details

Defined in Foreign.C.Types

Storable CDouble 
Instance details

Defined in Foreign.C.Types

Storable CPtrdiff 
Instance details

Defined in Foreign.C.Types

Storable CSize 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CSize -> Int #

alignment :: CSize -> Int #

peekElemOff :: Ptr CSize -> Int -> IO CSize #

pokeElemOff :: Ptr CSize -> Int -> CSize -> IO () #

peekByteOff :: Ptr b -> Int -> IO CSize #

pokeByteOff :: Ptr b -> Int -> CSize -> IO () #

peek :: Ptr CSize -> IO CSize #

poke :: Ptr CSize -> CSize -> IO () #

Storable CWchar 
Instance details

Defined in Foreign.C.Types

Storable CSigAtomic 
Instance details

Defined in Foreign.C.Types

Storable CClock 
Instance details

Defined in Foreign.C.Types

Storable CTime 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CTime -> Int #

alignment :: CTime -> Int #

peekElemOff :: Ptr CTime -> Int -> IO CTime #

pokeElemOff :: Ptr CTime -> Int -> CTime -> IO () #

peekByteOff :: Ptr b -> Int -> IO CTime #

pokeByteOff :: Ptr b -> Int -> CTime -> IO () #

peek :: Ptr CTime -> IO CTime #

poke :: Ptr CTime -> CTime -> IO () #

Storable CUSeconds 
Instance details

Defined in Foreign.C.Types

Storable CSUSeconds 
Instance details

Defined in Foreign.C.Types

Storable CIntPtr 
Instance details

Defined in Foreign.C.Types

Storable CUIntPtr 
Instance details

Defined in Foreign.C.Types

Storable CIntMax 
Instance details

Defined in Foreign.C.Types

Storable CUIntMax 
Instance details

Defined in Foreign.C.Types

Storable WordPtr 
Instance details

Defined in Foreign.Ptr

Storable IntPtr 
Instance details

Defined in Foreign.Ptr

Storable Fingerprint

Since: base-4.4.0.0

Instance details

Defined in Foreign.Storable

Storable FT_Outline 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.Outline

Storable FT_Outline_Funcs 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.Outline

Storable FT_Vector 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.Vector

Storable FT_Open_Args 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.OpenArgs

Storable FT_Raster_Params 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.RasterParams

Storable FT_Size_RequestRec 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.SizeRequest

Storable FT_BBox 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.BBox

Storable FT_Bitmap_Size 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.BitmapSize

Storable FT_Glyph_Metrics 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.GlyphMetrics

Storable FT_Matrix 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.Matrix

Storable FT_Render_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_Encoding 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_FACE_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_OPEN 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_Size_Request_Type 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_Kerning_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_SUBGLYPH_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_Glyph_Format 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_OUTLINE_FLAGS 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_Orientation 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_MemoryRec 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.Memory

Storable FT_Generic 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.Generic

Storable FT_Bitmap 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.Bitmap

Storable Half 
Instance details

Defined in Numeric.Half

Methods

sizeOf :: Half -> Int #

alignment :: Half -> Int #

peekElemOff :: Ptr Half -> Int -> IO Half #

pokeElemOff :: Ptr Half -> Int -> Half -> IO () #

peekByteOff :: Ptr b -> Int -> IO Half #

pokeByteOff :: Ptr b -> Int -> Half -> IO () #

peek :: Ptr Half -> IO Half #

poke :: Ptr Half -> Half -> IO () #

(Storable a, Integral a) => Storable (Ratio a)

Since: base-4.8.0.0

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Ratio a -> Int #

alignment :: Ratio a -> Int #

peekElemOff :: Ptr (Ratio a) -> Int -> IO (Ratio a) #

pokeElemOff :: Ptr (Ratio a) -> Int -> Ratio a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Ratio a) #

pokeByteOff :: Ptr b -> Int -> Ratio a -> IO () #

peek :: Ptr (Ratio a) -> IO (Ratio a) #

poke :: Ptr (Ratio a) -> Ratio a -> IO () #

Storable (StablePtr a)

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: StablePtr a -> Int #

alignment :: StablePtr a -> Int #

peekElemOff :: Ptr (StablePtr a) -> Int -> IO (StablePtr a) #

pokeElemOff :: Ptr (StablePtr a) -> Int -> StablePtr a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (StablePtr a) #

pokeByteOff :: Ptr b -> Int -> StablePtr a -> IO () #

peek :: Ptr (StablePtr a) -> IO (StablePtr a) #

poke :: Ptr (StablePtr a) -> StablePtr a -> IO () #

Storable (Ptr a)

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Ptr a -> Int #

alignment :: Ptr a -> Int #

peekElemOff :: Ptr (Ptr a) -> Int -> IO (Ptr a) #

pokeElemOff :: Ptr (Ptr a) -> Int -> Ptr a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Ptr a) #

pokeByteOff :: Ptr b -> Int -> Ptr a -> IO () #

peek :: Ptr (Ptr a) -> IO (Ptr a) #

poke :: Ptr (Ptr a) -> Ptr a -> IO () #

Storable (FunPtr a)

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: FunPtr a -> Int #

alignment :: FunPtr a -> Int #

peekElemOff :: Ptr (FunPtr a) -> Int -> IO (FunPtr a) #

pokeElemOff :: Ptr (FunPtr a) -> Int -> FunPtr a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (FunPtr a) #

pokeByteOff :: Ptr b -> Int -> FunPtr a -> IO () #

peek :: Ptr (FunPtr a) -> IO (FunPtr a) #

poke :: Ptr (FunPtr a) -> FunPtr a -> IO () #

Storable a => Storable (Complex a)

Since: base-4.8.0.0

Instance details

Defined in Data.Complex

Methods

sizeOf :: Complex a -> Int #

alignment :: Complex a -> Int #

peekElemOff :: Ptr (Complex a) -> Int -> IO (Complex a) #

pokeElemOff :: Ptr (Complex a) -> Int -> Complex a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Complex a) #

pokeByteOff :: Ptr b -> Int -> Complex a -> IO () #

peek :: Ptr (Complex a) -> IO (Complex a) #

poke :: Ptr (Complex a) -> Complex a -> IO () #

Storable a => Storable (Plucker a) 
Instance details

Defined in Linear.Plucker

Methods

sizeOf :: Plucker a -> Int #

alignment :: Plucker a -> Int #

peekElemOff :: Ptr (Plucker a) -> Int -> IO (Plucker a) #

pokeElemOff :: Ptr (Plucker a) -> Int -> Plucker a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Plucker a) #

pokeByteOff :: Ptr b -> Int -> Plucker a -> IO () #

peek :: Ptr (Plucker a) -> IO (Plucker a) #

poke :: Ptr (Plucker a) -> Plucker a -> IO () #

Storable a => Storable (Quaternion a) 
Instance details

Defined in Linear.Quaternion

Methods

sizeOf :: Quaternion a -> Int #

alignment :: Quaternion a -> Int #

peekElemOff :: Ptr (Quaternion a) -> Int -> IO (Quaternion a) #

pokeElemOff :: Ptr (Quaternion a) -> Int -> Quaternion a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Quaternion a) #

pokeByteOff :: Ptr b -> Int -> Quaternion a -> IO () #

peek :: Ptr (Quaternion a) -> IO (Quaternion a) #

poke :: Ptr (Quaternion a) -> Quaternion a -> IO () #

Storable (V0 a) 
Instance details

Defined in Linear.V0

Methods

sizeOf :: V0 a -> Int #

alignment :: V0 a -> Int #

peekElemOff :: Ptr (V0 a) -> Int -> IO (V0 a) #

pokeElemOff :: Ptr (V0 a) -> Int -> V0 a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (V0 a) #

pokeByteOff :: Ptr b -> Int -> V0 a -> IO () #

peek :: Ptr (V0 a) -> IO (V0 a) #

poke :: Ptr (V0 a) -> V0 a -> IO () #

Storable a => Storable (V4 a) 
Instance details

Defined in Linear.V4

Methods

sizeOf :: V4 a -> Int #

alignment :: V4 a -> Int #

peekElemOff :: Ptr (V4 a) -> Int -> IO (V4 a) #

pokeElemOff :: Ptr (V4 a) -> Int -> V4 a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (V4 a) #

pokeByteOff :: Ptr b -> Int -> V4 a -> IO () #

peek :: Ptr (V4 a) -> IO (V4 a) #

poke :: Ptr (V4 a) -> V4 a -> IO () #

Storable a => Storable (V3 a) 
Instance details

Defined in Linear.V3

Methods

sizeOf :: V3 a -> Int #

alignment :: V3 a -> Int #

peekElemOff :: Ptr (V3 a) -> Int -> IO (V3 a) #

pokeElemOff :: Ptr (V3 a) -> Int -> V3 a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (V3 a) #

pokeByteOff :: Ptr b -> Int -> V3 a -> IO () #

peek :: Ptr (V3 a) -> IO (V3 a) #

poke :: Ptr (V3 a) -> V3 a -> IO () #

Storable a => Storable (V2 a) 
Instance details

Defined in Linear.V2

Methods

sizeOf :: V2 a -> Int #

alignment :: V2 a -> Int #

peekElemOff :: Ptr (V2 a) -> Int -> IO (V2 a) #

pokeElemOff :: Ptr (V2 a) -> Int -> V2 a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (V2 a) #

pokeByteOff :: Ptr b -> Int -> V2 a -> IO () #

peek :: Ptr (V2 a) -> IO (V2 a) #

poke :: Ptr (V2 a) -> V2 a -> IO () #

Storable a => Storable (V1 a) 
Instance details

Defined in Linear.V1

Methods

sizeOf :: V1 a -> Int #

alignment :: V1 a -> Int #

peekElemOff :: Ptr (V1 a) -> Int -> IO (V1 a) #

pokeElemOff :: Ptr (V1 a) -> Int -> V1 a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (V1 a) #

pokeByteOff :: Ptr b -> Int -> V1 a -> IO () #

peek :: Ptr (V1 a) -> IO (V1 a) #

poke :: Ptr (V1 a) -> V1 a -> IO () #

Prim a => Storable (PrimStorable a) 
Instance details

Defined in Data.Primitive.Types

(Dim n, Storable a) => Storable (V n a) 
Instance details

Defined in Linear.V

Methods

sizeOf :: V n a -> Int #

alignment :: V n a -> Int #

peekElemOff :: Ptr (V n a) -> Int -> IO (V n a) #

pokeElemOff :: Ptr (V n a) -> Int -> V n a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (V n a) #

pokeByteOff :: Ptr b -> Int -> V n a -> IO () #

peek :: Ptr (V n a) -> IO (V n a) #

poke :: Ptr (V n a) -> V n a -> IO () #

Storable a => Storable (Tagged s a) 
Instance details

Defined in Data.Tagged

Methods

sizeOf :: Tagged s a -> Int #

alignment :: Tagged s a -> Int #

peekElemOff :: Ptr (Tagged s a) -> Int -> IO (Tagged s a) #

pokeElemOff :: Ptr (Tagged s a) -> Int -> Tagged s a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Tagged s a) #

pokeByteOff :: Ptr b -> Int -> Tagged s a -> IO () #

peek :: Ptr (Tagged s a) -> IO (Tagged s a) #

poke :: Ptr (Tagged s a) -> Tagged s a -> IO () #

castPtrToStablePtr :: Ptr () -> StablePtr a #

The inverse of castStablePtrToPtr, i.e., we have the identity

sp == castPtrToStablePtr (castStablePtrToPtr sp)

for any stable pointer sp on which freeStablePtr has not been executed yet. Moreover, castPtrToStablePtr may only be applied to pointers that have been produced by castStablePtrToPtr.

castStablePtrToPtr :: StablePtr a -> Ptr () #

Coerce a stable pointer to an address. No guarantees are made about the resulting value, except that the original stable pointer can be recovered by castPtrToStablePtr. In particular, the address may not refer to an accessible memory location and any attempt to pass it to the member functions of the class Storable leads to undefined behaviour.

deRefStablePtr :: StablePtr a -> IO a #

Obtain the Haskell value referenced by a stable pointer, i.e., the same value that was passed to the corresponding call to makeStablePtr. If the argument to deRefStablePtr has already been freed using freeStablePtr, the behaviour of deRefStablePtr is undefined.

freeStablePtr :: StablePtr a -> IO () #

Dissolve the association between the stable pointer and the Haskell value. Afterwards, if the stable pointer is passed to deRefStablePtr or freeStablePtr, the behaviour is undefined. However, the stable pointer may still be passed to castStablePtrToPtr, but the Ptr () value returned by castStablePtrToPtr, in this case, is undefined (in particular, it may be nullPtr). Nevertheless, the call to castStablePtrToPtr is guaranteed not to diverge.

castPtrToFunPtr :: Ptr a -> FunPtr b #

Casts a Ptr to a FunPtr.

Note: this is valid only on architectures where data and function pointers range over the same set of addresses, and should only be used for bindings to external libraries whose interface already relies on this assumption.

castFunPtrToPtr :: FunPtr a -> Ptr b #

Casts a FunPtr to a Ptr.

Note: this is valid only on architectures where data and function pointers range over the same set of addresses, and should only be used for bindings to external libraries whose interface already relies on this assumption.

castFunPtr :: FunPtr a -> FunPtr b #

Casts a FunPtr to a FunPtr of a different type.

nullFunPtr :: FunPtr a #

The constant nullFunPtr contains a distinguished value of FunPtr that is not associated with a valid memory location.

minusPtr :: Ptr a -> Ptr b -> Int #

Computes the offset required to get from the second to the first argument. We have

p2 == p1 `plusPtr` (p2 `minusPtr` p1)

alignPtr :: Ptr a -> Int -> Ptr a #

Given an arbitrary address and an alignment constraint, alignPtr yields the next higher address that fulfills the alignment constraint. An alignment constraint x is fulfilled by any address divisible by x. This operation is idempotent.

plusPtr :: Ptr a -> Int -> Ptr b #

Advances the given address by the given offset in bytes.

castPtr :: Ptr a -> Ptr b #

The castPtr function casts a pointer from one type to another.

nullPtr :: Ptr a #

The constant nullPtr contains a distinguished value of Ptr that is not associated with a valid memory location.

byteSwap64 :: Word64 -> Word64 #

Reverse order of bytes in Word64.

Since: base-4.7.0.0

byteSwap32 :: Word32 -> Word32 #

Reverse order of bytes in Word32.

Since: base-4.7.0.0

byteSwap16 :: Word16 -> Word16 #

Swap bytes in Word16.

Since: base-4.7.0.0

toIntegralSized :: (Integral a, Integral b, Bits a, Bits b) => a -> Maybe b #

Attempt to convert an Integral type a to an Integral type b using the size of the types as measured by Bits methods.

A simpler version of this function is:

toIntegral :: (Integral a, Integral b) => a -> Maybe b
toIntegral x
  | toInteger x == y = Just (fromInteger y)
  | otherwise        = Nothing
  where
    y = toInteger x

This version requires going through Integer, which can be inefficient. However, toIntegralSized is optimized to allow GHC to statically determine the relative type sizes (as measured by bitSizeMaybe and isSigned) and avoid going through Integer for many types. (The implementation uses fromIntegral, which is itself optimized with rules for base types but may go through Integer for some type pairs.)

Since: base-4.8.0.0

popCountDefault :: (Bits a, Num a) => a -> Int #

Default implementation for popCount.

This implementation is intentionally naive. Instances are expected to provide an optimized implementation for their size.

Since: base-4.6.0.0

testBitDefault :: (Bits a, Num a) => a -> Int -> Bool #

Default implementation for testBit.

Note that: testBitDefault x i = (x .&. bit i) /= 0

Since: base-4.6.0.0

bitDefault :: (Bits a, Num a) => Int -> a #

Default implementation for bit.

Note that: bitDefault i = 1 shiftL i

Since: base-4.6.0.0

class Eq a => Bits a where #

The Bits class defines bitwise operations over integral types.

  • Bits are numbered from 0 with bit 0 being the least significant bit.

Methods

(.&.) :: a -> a -> a infixl 7 #

Bitwise "and"

(.|.) :: a -> a -> a infixl 5 #

Bitwise "or"

xor :: a -> a -> a infixl 6 #

Bitwise "xor"

complement :: a -> a #

Reverse all the bits in the argument

shift :: a -> Int -> a infixl 8 #

shift x i shifts x left by i bits if i is positive, or right by -i bits otherwise. Right shifts perform sign extension on signed number types; i.e. they fill the top bits with 1 if the x is negative and with 0 otherwise.

An instance can define either this unified shift or shiftL and shiftR, depending on which is more convenient for the type in question.

rotate :: a -> Int -> a infixl 8 #

rotate x i rotates x left by i bits if i is positive, or right by -i bits otherwise.

For unbounded types like Integer, rotate is equivalent to shift.

An instance can define either this unified rotate or rotateL and rotateR, depending on which is more convenient for the type in question.

zeroBits :: a #

zeroBits is the value with all bits unset.

The following laws ought to hold (for all valid bit indices n):

This method uses clearBit (bit 0) 0 as its default implementation (which ought to be equivalent to zeroBits for types which possess a 0th bit).

Since: base-4.7.0.0

bit :: Int -> a #

bit i is a value with the ith bit set and all other bits clear.

Can be implemented using bitDefault if a is also an instance of Num.

See also zeroBits.

setBit :: a -> Int -> a #

x `setBit` i is the same as x .|. bit i

clearBit :: a -> Int -> a #

x `clearBit` i is the same as x .&. complement (bit i)

complementBit :: a -> Int -> a #

x `complementBit` i is the same as x `xor` bit i

testBit :: a -> Int -> Bool #

Return True if the nth bit of the argument is 1

Can be implemented using testBitDefault if a is also an instance of Num.

bitSizeMaybe :: a -> Maybe Int #

Return the number of bits in the type of the argument. The actual value of the argument is ignored. Returns Nothing for types that do not have a fixed bitsize, like Integer.

Since: base-4.7.0.0

bitSize :: a -> Int #

Return the number of bits in the type of the argument. The actual value of the argument is ignored. The function bitSize is undefined for types that do not have a fixed bitsize, like Integer.

Default implementation based upon bitSizeMaybe provided since 4.12.0.0.

isSigned :: a -> Bool #

Return True if the argument is a signed type. The actual value of the argument is ignored

shiftL :: a -> Int -> a infixl 8 #

Shift the argument left by the specified number of bits (which must be non-negative).

An instance can define either this and shiftR or the unified shift, depending on which is more convenient for the type in question.

unsafeShiftL :: a -> Int -> a #

Shift the argument left by the specified number of bits. The result is undefined for negative shift amounts and shift amounts greater or equal to the bitSize.

Defaults to shiftL unless defined explicitly by an instance.

Since: base-4.5.0.0

shiftR :: a -> Int -> a infixl 8 #

Shift the first argument right by the specified number of bits. The result is undefined for negative shift amounts and shift amounts greater or equal to the bitSize.

Right shifts perform sign extension on signed number types; i.e. they fill the top bits with 1 if the x is negative and with 0 otherwise.

An instance can define either this and shiftL or the unified shift, depending on which is more convenient for the type in question.

unsafeShiftR :: a -> Int -> a #

Shift the first argument right by the specified number of bits, which must be non-negative and smaller than the number of bits in the type.

Right shifts perform sign extension on signed number types; i.e. they fill the top bits with 1 if the x is negative and with 0 otherwise.

Defaults to shiftR unless defined explicitly by an instance.

Since: base-4.5.0.0

rotateL :: a -> Int -> a infixl 8 #

Rotate the argument left by the specified number of bits (which must be non-negative).

An instance can define either this and rotateR or the unified rotate, depending on which is more convenient for the type in question.

rotateR :: a -> Int -> a infixl 8 #

Rotate the argument right by the specified number of bits (which must be non-negative).

An instance can define either this and rotateL or the unified rotate, depending on which is more convenient for the type in question.

popCount :: a -> Int #

Return the number of set bits in the argument. This number is known as the population count or the Hamming weight.

Can be implemented using popCountDefault if a is also an instance of Num.

Since: base-4.5.0.0

Instances
Bits Bool

Interpret Bool as 1-bit bit-field

Since: base-4.7.0.0

Instance details

Defined in Data.Bits

Bits Int

Since: base-2.1

Instance details

Defined in Data.Bits

Methods

(.&.) :: Int -> Int -> Int #

(.|.) :: Int -> Int -> Int #

xor :: Int -> Int -> Int #

complement :: Int -> Int #

shift :: Int -> Int -> Int #

rotate :: Int -> Int -> Int #

zeroBits :: Int #

bit :: Int -> Int #

setBit :: Int -> Int -> Int #

clearBit :: Int -> Int -> Int #

complementBit :: Int -> Int -> Int #

testBit :: Int -> Int -> Bool #

bitSizeMaybe :: Int -> Maybe Int #

bitSize :: Int -> Int #

isSigned :: Int -> Bool #

shiftL :: Int -> Int -> Int #

unsafeShiftL :: Int -> Int -> Int #

shiftR :: Int -> Int -> Int #

unsafeShiftR :: Int -> Int -> Int #

rotateL :: Int -> Int -> Int #

rotateR :: Int -> Int -> Int #

popCount :: Int -> Int #

Bits Int8

Since: base-2.1

Instance details

Defined in GHC.Int

Bits Int16

Since: base-2.1

Instance details

Defined in GHC.Int

Bits Int32

Since: base-2.1

Instance details

Defined in GHC.Int

Bits Int64

Since: base-2.1

Instance details

Defined in GHC.Int

Bits Integer

Since: base-2.1

Instance details

Defined in Data.Bits

Bits Natural

Since: base-4.8.0

Instance details

Defined in Data.Bits

Bits Word

Since: base-2.1

Instance details

Defined in Data.Bits

Bits Word8

Since: base-2.1

Instance details

Defined in GHC.Word

Bits Word16

Since: base-2.1

Instance details

Defined in GHC.Word

Bits Word32

Since: base-2.1

Instance details

Defined in GHC.Word

Bits Word64

Since: base-2.1

Instance details

Defined in GHC.Word

Bits CChar 
Instance details

Defined in Foreign.C.Types

Bits CSChar 
Instance details

Defined in Foreign.C.Types

Bits CUChar 
Instance details

Defined in Foreign.C.Types

Bits CShort 
Instance details

Defined in Foreign.C.Types

Bits CUShort 
Instance details

Defined in Foreign.C.Types

Bits CInt 
Instance details

Defined in Foreign.C.Types

Bits CUInt 
Instance details

Defined in Foreign.C.Types

Bits CLong 
Instance details

Defined in Foreign.C.Types

Bits CULong 
Instance details

Defined in Foreign.C.Types

Bits CLLong 
Instance details

Defined in Foreign.C.Types

Bits CULLong 
Instance details

Defined in Foreign.C.Types

Bits CBool 
Instance details

Defined in Foreign.C.Types

Bits CPtrdiff 
Instance details

Defined in Foreign.C.Types

Bits CSize 
Instance details

Defined in Foreign.C.Types

Bits CWchar 
Instance details

Defined in Foreign.C.Types

Bits CSigAtomic 
Instance details

Defined in Foreign.C.Types

Bits CIntPtr 
Instance details

Defined in Foreign.C.Types

Bits CUIntPtr 
Instance details

Defined in Foreign.C.Types

Bits CIntMax 
Instance details

Defined in Foreign.C.Types

Bits CUIntMax 
Instance details

Defined in Foreign.C.Types

Bits WordPtr 
Instance details

Defined in Foreign.Ptr

Bits IntPtr 
Instance details

Defined in Foreign.Ptr

Bits n => Bits (VarInt n) 
Instance details

Defined in Data.Bytes.VarInt

Methods

(.&.) :: VarInt n -> VarInt n -> VarInt n #

(.|.) :: VarInt n -> VarInt n -> VarInt n #

xor :: VarInt n -> VarInt n -> VarInt n #

complement :: VarInt n -> VarInt n #

shift :: VarInt n -> Int -> VarInt n #

rotate :: VarInt n -> Int -> VarInt n #

zeroBits :: VarInt n #

bit :: Int -> VarInt n #

setBit :: VarInt n -> Int -> VarInt n #

clearBit :: VarInt n -> Int -> VarInt n #

complementBit :: VarInt n -> Int -> VarInt n #

testBit :: VarInt n -> Int -> Bool #

bitSizeMaybe :: VarInt n -> Maybe Int #

bitSize :: VarInt n -> Int #

isSigned :: VarInt n -> Bool #

shiftL :: VarInt n -> Int -> VarInt n #

unsafeShiftL :: VarInt n -> Int -> VarInt n #

shiftR :: VarInt n -> Int -> VarInt n #

unsafeShiftR :: VarInt n -> Int -> VarInt n #

rotateL :: VarInt n -> Int -> VarInt n #

rotateR :: VarInt n -> Int -> VarInt n #

popCount :: VarInt n -> Int #

Bits a => Bits (Tagged s a) 
Instance details

Defined in Data.Tagged

Methods

(.&.) :: Tagged s a -> Tagged s a -> Tagged s a #

(.|.) :: Tagged s a -> Tagged s a -> Tagged s a #

xor :: Tagged s a -> Tagged s a -> Tagged s a #

complement :: Tagged s a -> Tagged s a #

shift :: Tagged s a -> Int -> Tagged s a #

rotate :: Tagged s a -> Int -> Tagged s a #

zeroBits :: Tagged s a #

bit :: Int -> Tagged s a #

setBit :: Tagged s a -> Int -> Tagged s a #

clearBit :: Tagged s a -> Int -> Tagged s a #

complementBit :: Tagged s a -> Int -> Tagged s a #

testBit :: Tagged s a -> Int -> Bool #

bitSizeMaybe :: Tagged s a -> Maybe Int #

bitSize :: Tagged s a -> Int #

isSigned :: Tagged s a -> Bool #

shiftL :: Tagged s a -> Int -> Tagged s a #

unsafeShiftL :: Tagged s a -> Int -> Tagged s a #

shiftR :: Tagged s a -> Int -> Tagged s a #

unsafeShiftR :: Tagged s a -> Int -> Tagged s a #

rotateL :: Tagged s a -> Int -> Tagged s a #

rotateR :: Tagged s a -> Int -> Tagged s a #

popCount :: Tagged s a -> Int #

class Bits b => FiniteBits b where #

The FiniteBits class denotes types with a finite, fixed number of bits.

Since: base-4.7.0.0

Minimal complete definition

finiteBitSize

Methods

finiteBitSize :: b -> Int #

Return the number of bits in the type of the argument. The actual value of the argument is ignored. Moreover, finiteBitSize is total, in contrast to the deprecated bitSize function it replaces.

finiteBitSize = bitSize
bitSizeMaybe = Just . finiteBitSize

Since: base-4.7.0.0

countLeadingZeros :: b -> Int #

Count number of zero bits preceding the most significant set bit.

countLeadingZeros (zeroBits :: a) = finiteBitSize (zeroBits :: a)

countLeadingZeros can be used to compute log base 2 via

logBase2 x = finiteBitSize x - 1 - countLeadingZeros x

Note: The default implementation for this method is intentionally naive. However, the instances provided for the primitive integral types are implemented using CPU specific machine instructions.

Since: base-4.8.0.0

countTrailingZeros :: b -> Int #

Count number of zero bits following the least significant set bit.

countTrailingZeros (zeroBits :: a) = finiteBitSize (zeroBits :: a)
countTrailingZeros . negate = countTrailingZeros

The related find-first-set operation can be expressed in terms of countTrailingZeros as follows

findFirstSet x = 1 + countTrailingZeros x

Note: The default implementation for this method is intentionally naive. However, the instances provided for the primitive integral types are implemented using CPU specific machine instructions.

Since: base-4.8.0.0

Instances
FiniteBits Bool

Since: base-4.7.0.0

Instance details

Defined in Data.Bits

FiniteBits Int

Since: base-4.6.0.0

Instance details

Defined in Data.Bits

FiniteBits Int8

Since: base-4.6.0.0

Instance details

Defined in GHC.Int

FiniteBits Int16

Since: base-4.6.0.0

Instance details

Defined in GHC.Int

FiniteBits Int32

Since: base-4.6.0.0

Instance details

Defined in GHC.Int

FiniteBits Int64

Since: base-4.6.0.0

Instance details

Defined in GHC.Int

FiniteBits Word

Since: base-4.6.0.0

Instance details

Defined in Data.Bits

FiniteBits Word8

Since: base-4.6.0.0

Instance details

Defined in GHC.Word

FiniteBits Word16

Since: base-4.6.0.0

Instance details

Defined in GHC.Word

FiniteBits Word32

Since: base-4.6.0.0

Instance details

Defined in GHC.Word

FiniteBits Word64

Since: base-4.6.0.0

Instance details

Defined in GHC.Word

FiniteBits CChar 
Instance details

Defined in Foreign.C.Types

FiniteBits CSChar 
Instance details

Defined in Foreign.C.Types

FiniteBits CUChar 
Instance details

Defined in Foreign.C.Types

FiniteBits CShort 
Instance details

Defined in Foreign.C.Types

FiniteBits CUShort 
Instance details

Defined in Foreign.C.Types

FiniteBits CInt 
Instance details

Defined in Foreign.C.Types

FiniteBits CUInt 
Instance details

Defined in Foreign.C.Types

FiniteBits CLong 
Instance details

Defined in Foreign.C.Types

FiniteBits CULong 
Instance details

Defined in Foreign.C.Types

FiniteBits CLLong 
Instance details

Defined in Foreign.C.Types

FiniteBits CULLong 
Instance details

Defined in Foreign.C.Types

FiniteBits CBool 
Instance details

Defined in Foreign.C.Types

FiniteBits CPtrdiff 
Instance details

Defined in Foreign.C.Types

FiniteBits CSize 
Instance details

Defined in Foreign.C.Types

FiniteBits CWchar 
Instance details

Defined in Foreign.C.Types

FiniteBits CSigAtomic 
Instance details

Defined in Foreign.C.Types

FiniteBits CIntPtr 
Instance details

Defined in Foreign.C.Types

FiniteBits CUIntPtr 
Instance details

Defined in Foreign.C.Types

FiniteBits CIntMax 
Instance details

Defined in Foreign.C.Types

FiniteBits CUIntMax 
Instance details

Defined in Foreign.C.Types

FiniteBits WordPtr 
Instance details

Defined in Foreign.Ptr

FiniteBits IntPtr 
Instance details

Defined in Foreign.Ptr

FiniteBits a => FiniteBits (Tagged s a) 
Instance details

Defined in Data.Tagged

ft_Face_CheckTrueTypePatents :: FT_Face -> IO FT_Bool #

This is just here for completeness, TrueType hinting is no longer patented

ft_Face_SetUnpatentedHinting :: FT_Face -> FT_Bool -> IO FT_Bool #

This is just here for completeness, TrueType hinting is no longer patented.

type FT_Char = CChar #

type FT_Int = CInt #

type FT_UInt = CUInt #

type FT_Long = CLong #

type FT_Error = CInt #

type FT_Pos = CLong #

type FT_Pointer = Ptr () #

newtype FT_Render_Mode #

Constructors

FT_Render_Mode CUInt 
Instances
Enum FT_Render_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Eq FT_Render_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Integral FT_Render_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Num FT_Render_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Ord FT_Render_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Real FT_Render_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Show FT_Render_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_Render_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

newtype FT_Encoding #

Constructors

FT_Encoding FT_UInt32 
Instances
Enum FT_Encoding 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Eq FT_Encoding 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Integral FT_Encoding 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Num FT_Encoding 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Ord FT_Encoding 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Real FT_Encoding 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Show FT_Encoding 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_Encoding 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

newtype FT_FACE_FLAG #

Constructors

FT_FACE_FLAG FT_Int 
Instances
Enum FT_FACE_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Eq FT_FACE_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Integral FT_FACE_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Num FT_FACE_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Ord FT_FACE_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Real FT_FACE_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Show FT_FACE_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_FACE_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

newtype FT_OPEN #

Constructors

FT_OPEN FT_UInt 
Instances
Enum FT_OPEN 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Eq FT_OPEN 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Methods

(==) :: FT_OPEN -> FT_OPEN -> Bool #

(/=) :: FT_OPEN -> FT_OPEN -> Bool #

Integral FT_OPEN 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Num FT_OPEN 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Ord FT_OPEN 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Real FT_OPEN 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Show FT_OPEN 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_OPEN 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

newtype FT_Size_Request_Type #

Instances
Enum FT_Size_Request_Type 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Eq FT_Size_Request_Type 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Integral FT_Size_Request_Type 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Num FT_Size_Request_Type 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Ord FT_Size_Request_Type 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Real FT_Size_Request_Type 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Show FT_Size_Request_Type 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_Size_Request_Type 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

newtype FT_Kerning_Mode #

Instances
Enum FT_Kerning_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Eq FT_Kerning_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Integral FT_Kerning_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Num FT_Kerning_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Ord FT_Kerning_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Real FT_Kerning_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Show FT_Kerning_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_Kerning_Mode 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

newtype FT_SUBGLYPH_FLAG #

Instances
Enum FT_SUBGLYPH_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Eq FT_SUBGLYPH_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Integral FT_SUBGLYPH_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Num FT_SUBGLYPH_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Ord FT_SUBGLYPH_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Real FT_SUBGLYPH_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Show FT_SUBGLYPH_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_SUBGLYPH_FLAG 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

newtype FT_Glyph_Format #

Instances
Enum FT_Glyph_Format 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Eq FT_Glyph_Format 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Integral FT_Glyph_Format 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Num FT_Glyph_Format 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Ord FT_Glyph_Format 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Real FT_Glyph_Format 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Show FT_Glyph_Format 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_Glyph_Format 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

newtype FT_OUTLINE_FLAGS #

Instances
Enum FT_OUTLINE_FLAGS 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Eq FT_OUTLINE_FLAGS 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Integral FT_OUTLINE_FLAGS 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Num FT_OUTLINE_FLAGS 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Ord FT_OUTLINE_FLAGS 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Real FT_OUTLINE_FLAGS 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Show FT_OUTLINE_FLAGS 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_OUTLINE_FLAGS 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

newtype FT_Orientation #

Constructors

FT_Orientation FT_UInt 
Instances
Enum FT_Orientation 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Eq FT_Orientation 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Integral FT_Orientation 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Num FT_Orientation 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Ord FT_Orientation 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Real FT_Orientation 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Show FT_Orientation 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

Storable FT_Orientation 
Instance details

Defined in Graphics.Rendering.FreeType.Internal.PrimitiveTypes

setCharSize :: (MonadIO m, Integral i) => FT_Face -> i -> i -> i -> i -> FreeTypeT m () Source #

setPixelSizes :: (MonadIO m, Integral i) => FT_Face -> i -> i -> FreeTypeT m () Source #