Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.GI.Base.ShortPrelude
Description
The Haskell Prelude exports a number of symbols that can easily collide with functions appearing in bindings. The generated code requires just a small subset of the functions in the Prelude, together with some of the functionality in Data.GI.Base, we reexport this explicitly here.
Synopsis
- data Char
- ord :: Char -> Int
- chr :: Int -> Char
- module Data.Int
- data Word8
- data Word64
- data Word32
- data Word16
- data ByteString
- newtype CFloat = CFloat Float
- newtype CDouble = CDouble Double
- type CString = Ptr CChar
- newtype CUIntPtr = CUIntPtr Word64
- newtype CIntPtr = CIntPtr Int64
- newtype CULong = CULong Word64
- newtype CLong = CLong Int64
- newtype CUInt = CUInt Word32
- newtype CInt = CInt Int32
- data Ptr a
- nullPtr :: Ptr a
- data FunPtr a
- plusPtr :: Ptr a -> Int -> Ptr b
- castFunPtrToPtr :: FunPtr a -> Ptr b
- castPtrToFunPtr :: Ptr a -> FunPtr b
- data ForeignPtr a
- module Foreign.ForeignPtr.Unsafe
- sizeOf :: Storable a => a -> Int
- peek :: Storable a => Ptr a -> IO a
- poke :: Storable a => Ptr a -> a -> IO ()
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- onException :: IO a -> IO b -> IO a
- module Control.Monad.IO.Class
- clear :: forall info (attr :: Symbol) obj m. (AttrClearC info obj attr, MonadIO m) => obj -> AttrLabelProxy attr -> m ()
- data AttrOp obj (tag :: AttrOpTag) where
- (:=) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrSetTypeConstraint info b) => AttrLabelProxy attr -> b -> AttrOp obj tag
- (:=>) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrSetTypeConstraint info b) => AttrLabelProxy attr -> IO b -> AttrOp obj tag
- (:~) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b a. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, tag ~ 'AttrSet, AttrOpAllowed 'AttrSet info obj, AttrOpAllowed 'AttrGet info obj, AttrSetTypeConstraint info b, a ~ AttrGetType info) => AttrLabelProxy attr -> (a -> b) -> AttrOp obj tag
- (:~>) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b a. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, tag ~ 'AttrSet, AttrOpAllowed 'AttrSet info obj, AttrOpAllowed 'AttrGet info obj, AttrSetTypeConstraint info b, a ~ AttrGetType info) => AttrLabelProxy attr -> (a -> IO b) -> AttrOp obj tag
- (:&=) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrTransferTypeConstraint info b, AttrSetTypeConstraint info (AttrTransferType info)) => AttrLabelProxy attr -> b -> AttrOp obj tag
- On :: forall obj info (tag :: AttrOpTag). (GObject obj, SignalInfo info) => SignalProxy obj info -> ((?self :: obj) => HaskellCallbackType info) -> AttrOp obj tag
- After :: forall obj info (tag :: AttrOpTag). (GObject obj, SignalInfo info) => SignalProxy obj info -> ((?self :: obj) => HaskellCallbackType info) -> AttrOp obj tag
- class AttrInfo info where
- type AttrAllowedOps info :: [AttrOpTag]
- type AttrBaseTypeConstraint info :: Type -> Constraint
- type AttrGetType info
- type AttrSetTypeConstraint info :: Type -> Constraint
- type AttrTransferTypeConstraint info :: Type -> Constraint
- type AttrTransferType info
- type AttrLabel info :: Symbol
- type AttrOrigin info
- attrGet :: AttrBaseTypeConstraint info o => o -> IO (AttrGetType info)
- attrSet :: (AttrBaseTypeConstraint info o, AttrSetTypeConstraint info b) => o -> b -> IO ()
- attrClear :: AttrBaseTypeConstraint info o => o -> IO ()
- attrConstruct :: (AttrBaseTypeConstraint info o, AttrSetTypeConstraint info b) => b -> IO (GValueConstruct o)
- attrTransfer :: (AttrBaseTypeConstraint info o, AttrTransferTypeConstraint info b) => Proxy o -> b -> IO (AttrTransferType info)
- dbgAttrInfo :: Maybe ResolvedSymbolInfo
- data AttrOpTag
- type family AttrOpAllowed (tag :: AttrOpTag) info useType where ...
- type AttrGetC info obj (attr :: Symbol) result = (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed 'AttrGet info obj, result ~ AttrGetType info)
- type AttrSetC info obj (attr :: Symbol) value = (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed 'AttrSet info obj, AttrSetTypeConstraint info value)
- type AttrConstructC info obj (attr :: Symbol) value = (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed 'AttrConstruct info obj, AttrSetTypeConstraint info value)
- type AttrClearC info obj (attr :: Symbol) = (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed 'AttrClear info obj)
- data AttrLabelProxy (a :: Symbol) = AttrLabelProxy
- resolveAttr :: forall info (attr :: Symbol) obj. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info) => obj -> AttrLabelProxy attr -> Maybe ResolvedSymbolInfo
- type family AttrLabel info :: Symbol
- type family AttrAllowedOps info :: [AttrOpTag]
- type family AttrBaseTypeConstraint info :: Type -> Constraint
- type family AttrGetType info
- type family AttrSetTypeConstraint info :: Type -> Constraint
- type family AttrTransferTypeConstraint info :: Type -> Constraint
- type family AttrTransferType info
- type family AttrOrigin info
- module Data.GI.Base.BasicTypes
- module Data.GI.Base.BasicConversions
- data GClosure a
- module Data.GI.Base.Constructible
- module Data.GI.Base.GError
- module Data.GI.Base.GHashTable
- module Data.GI.Base.GParamSpec
- module Data.GI.Base.GObject
- module Data.GI.Base.GVariant
- module Data.GI.Base.GValue
- module Data.GI.Base.ManagedPtr
- class SignalInfo info where
- type HaskellCallbackType info
- connectSignal :: GObject o => o -> (o -> HaskellCallbackType info) -> SignalConnectMode -> Maybe Text -> IO SignalHandlerId
- dbgSignalInfo :: Maybe ResolvedSymbolInfo
- data SignalConnectMode
- connectSignalFunPtr :: GObject o => o -> Text -> FunPtr a -> SignalConnectMode -> Maybe Text -> IO SignalHandlerId
- type SignalHandlerId = CULong
- data GObjectNotifySignalInfo
- type family HaskellCallbackType info
- module Data.GI.Base.Utils
- data Symbol
- class Enum a where
- class Show a where
- class Eq a where
- data IO a
- class Applicative m => Monad (m :: Type -> Type) where
- data Maybe a
- (.) :: (b -> c) -> (a -> b) -> a -> c
- ($) :: (a -> b) -> a -> b
- (++) :: [a] -> [a] -> [a]
- (=<<) :: Monad m => (a -> m b) -> m a -> m b
- (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
- data Bool
- data Float
- data Double
- undefined :: HasCallStack => a
- error :: HasCallStack => [Char] -> a
- map :: (a -> b) -> [a] -> [b]
- length :: Foldable t => t a -> Int
- mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)
- mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
- when :: Applicative f => Bool -> f () -> f ()
- fromIntegral :: (Integral a, Num b) => a -> b
- realToFrac :: (Real a, Fractional b) => a -> b
Documentation
The character type Char
represents Unicode codespace
and its elements are code points as in definitions
D9 and D10 of the Unicode Standard.
Character literals in Haskell are single-quoted: 'Q'
, 'Я'
or 'Ω'
.
To represent a single quote itself use '\''
, and to represent a backslash
use '\\'
. The full grammar can be found in the section 2.6 of the
Haskell 2010 Language Report.
To specify a character by its code point one can use decimal, hexadecimal
or octal notation: '\65'
, '\x41'
and '\o101'
are all alternative forms
of 'A'
. The largest code point is '\x10ffff'
.
There is a special escape syntax for ASCII control characters:
Escape | Alternatives | Meaning |
---|---|---|
'\NUL' | '\0' | null character |
'\SOH' | '\1' | start of heading |
'\STX' | '\2' | start of text |
'\ETX' | '\3' | end of text |
'\EOT' | '\4' | end of transmission |
'\ENQ' | '\5' | enquiry |
'\ACK' | '\6' | acknowledge |
'\BEL' | '\7' , '\a' | bell (alert) |
'\BS' | '\8' , '\b' | backspace |
'\HT' | '\9' , '\t' | horizontal tab |
'\LF' | '\10' , '\n' | line feed (new line) |
'\VT' | '\11' , '\v' | vertical tab |
'\FF' | '\12' , '\f' | form feed |
'\CR' | '\13' , '\r' | carriage return |
'\SO' | '\14' | shift out |
'\SI' | '\15' | shift in |
'\DLE' | '\16' | data link escape |
'\DC1' | '\17' | device control 1 |
'\DC2' | '\18' | device control 2 |
'\DC3' | '\19' | device control 3 |
'\DC4' | '\20' | device control 4 |
'\NAK' | '\21' | negative acknowledge |
'\SYN' | '\22' | synchronous idle |
'\ETB' | '\23' | end of transmission block |
'\CAN' | '\24' | cancel |
'\EM' | '\25' | end of medium |
'\SUB' | '\26' | substitute |
'\ESC' | '\27' | escape |
'\FS' | '\28' | file separator |
'\GS' | '\29' | group separator |
'\RS' | '\30' | record separator |
'\US' | '\31' | unit separator |
'\SP' | '\32' , ' ' | space |
'\DEL' | '\127' | delete |
Instances
Data Char | Since: base-4.0.0.0 | ||||
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Char -> c Char # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Char # dataTypeOf :: Char -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Char) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Char) # gmapT :: (forall b. Data b => b -> b) -> Char -> Char # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Char -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Char -> r # gmapQ :: (forall d. Data d => d -> u) -> Char -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Char -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Char -> m Char # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Char -> m Char # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Char -> m Char # | |||||
Storable Char | Since: base-2.1 | ||||
Defined in Foreign.Storable | |||||
Bounded Char | Since: base-2.1 | ||||
Enum Char | Since: base-2.1 | ||||
Ix Char | Since: base-2.1 | ||||
Read Char | Since: base-2.1 | ||||
Show Char | Since: base-2.1 | ||||
IsChar Char | Since: base-2.1 | ||||
PrintfArg Char | Since: base-2.1 | ||||
Defined in Text.Printf | |||||
Eq Char | |||||
Ord Char | |||||
TestCoercion SChar | Since: base-4.18.0.0 | ||||
Defined in GHC.TypeLits | |||||
TestEquality SChar | Since: base-4.18.0.0 | ||||
Defined in GHC.TypeLits | |||||
Generic1 (URec Char :: k -> Type) | |||||
Defined in GHC.Generics Associated Types
| |||||
Foldable (UChar :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in Data.Foldable Methods fold :: Monoid m => UChar m -> m # foldMap :: Monoid m => (a -> m) -> UChar a -> m # foldMap' :: Monoid m => (a -> m) -> UChar a -> m # foldr :: (a -> b -> b) -> b -> UChar a -> b # foldr' :: (a -> b -> b) -> b -> UChar a -> b # foldl :: (b -> a -> b) -> b -> UChar a -> b # foldl' :: (b -> a -> b) -> b -> UChar a -> b # foldr1 :: (a -> a -> a) -> UChar a -> a # foldl1 :: (a -> a -> a) -> UChar a -> a # elem :: Eq a => a -> UChar a -> Bool # maximum :: Ord a => UChar a -> a # minimum :: Ord a => UChar a -> a # | |||||
Traversable (UChar :: Type -> Type) | Since: base-4.9.0.0 | ||||
IsGValue (Maybe String) Source # | |||||
Functor (URec Char :: Type -> Type) | Since: base-4.9.0.0 | ||||
Generic (URec Char p) | |||||
Defined in GHC.Generics Associated Types
| |||||
Show (URec Char p) | Since: base-4.9.0.0 | ||||
Eq (URec Char p) | Since: base-4.9.0.0 | ||||
Ord (URec Char p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
data URec Char (p :: k) | Used for marking occurrences of Since: base-4.9.0.0 | ||||
type Compare (a :: Char) (b :: Char) | |||||
Defined in Data.Type.Ord | |||||
type Rep1 (URec Char :: k -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
type Rep (URec Char p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics |
module Data.Int
8-bit unsigned integer type
Instances
Data Word8 | Since: base-4.0.0.0 |
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word8 -> c Word8 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word8 # dataTypeOf :: Word8 -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word8) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word8) # gmapT :: (forall b. Data b => b -> b) -> Word8 -> Word8 # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word8 -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word8 -> r # gmapQ :: (forall d. Data d => d -> u) -> Word8 -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word8 -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word8 -> m Word8 # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word8 -> m Word8 # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word8 -> m Word8 # | |
Storable Word8 | Since: base-2.1 |
Bits Word8 | Since: base-2.1 |
Defined in GHC.Word Methods (.&.) :: Word8 -> Word8 -> Word8 # (.|.) :: Word8 -> Word8 -> Word8 # xor :: Word8 -> Word8 -> Word8 # complement :: Word8 -> Word8 # shift :: Word8 -> Int -> Word8 # rotate :: Word8 -> Int -> Word8 # setBit :: Word8 -> Int -> Word8 # clearBit :: Word8 -> Int -> Word8 # complementBit :: Word8 -> Int -> Word8 # testBit :: Word8 -> Int -> Bool # bitSizeMaybe :: Word8 -> Maybe Int # shiftL :: Word8 -> Int -> Word8 # unsafeShiftL :: Word8 -> Int -> Word8 # shiftR :: Word8 -> Int -> Word8 # unsafeShiftR :: Word8 -> Int -> Word8 # rotateL :: Word8 -> Int -> Word8 # | |
FiniteBits Word8 | Since: base-4.6.0.0 |
Defined in GHC.Word Methods finiteBitSize :: Word8 -> Int # countLeadingZeros :: Word8 -> Int # countTrailingZeros :: Word8 -> Int # | |
Bounded Word8 | Since: base-2.1 |
Enum Word8 | Since: base-2.1 |
Ix Word8 | Since: base-2.1 |
Num Word8 | Since: base-2.1 |
Read Word8 | Since: base-2.1 |
Integral Word8 | Since: base-2.1 |
Real Word8 | Since: base-2.1 |
Defined in GHC.Word Methods toRational :: Word8 -> Rational # | |
Show Word8 | Since: base-2.1 |
PrintfArg Word8 | Since: base-2.1 |
Defined in Text.Printf | |
Eq Word8 | Since: base-2.1 |
Ord Word8 | Since: base-2.1 |
IsGVariant Word8 Source # | |
Defined in Data.GI.Base.GVariant | |
IsGVariantBasicType Word8 Source # | |
Defined in Data.GI.Base.GVariant |
64-bit unsigned integer type
Instances
Data Word64 | Since: base-4.0.0.0 |
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word64 -> c Word64 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word64 # toConstr :: Word64 -> Constr # dataTypeOf :: Word64 -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word64) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word64) # gmapT :: (forall b. Data b => b -> b) -> Word64 -> Word64 # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word64 -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word64 -> r # gmapQ :: (forall d. Data d => d -> u) -> Word64 -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word64 -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word64 -> m Word64 # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word64 -> m Word64 # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word64 -> m Word64 # | |
Storable Word64 | Since: base-2.1 |
Bits Word64 | Since: base-2.1 |
Defined in GHC.Word Methods (.&.) :: Word64 -> Word64 -> Word64 # (.|.) :: Word64 -> Word64 -> Word64 # xor :: Word64 -> Word64 -> Word64 # complement :: Word64 -> Word64 # shift :: Word64 -> Int -> Word64 # rotate :: Word64 -> Int -> Word64 # setBit :: Word64 -> Int -> Word64 # clearBit :: Word64 -> Int -> Word64 # complementBit :: Word64 -> Int -> Word64 # testBit :: Word64 -> Int -> Bool # bitSizeMaybe :: Word64 -> Maybe Int # shiftL :: Word64 -> Int -> Word64 # unsafeShiftL :: Word64 -> Int -> Word64 # shiftR :: Word64 -> Int -> Word64 # unsafeShiftR :: Word64 -> Int -> Word64 # rotateL :: Word64 -> Int -> Word64 # | |
FiniteBits Word64 | Since: base-4.6.0.0 |
Defined in GHC.Word Methods finiteBitSize :: Word64 -> Int # countLeadingZeros :: Word64 -> Int # countTrailingZeros :: Word64 -> Int # | |
Bounded Word64 | Since: base-2.1 |
Enum Word64 | Since: base-2.1 |
Defined in GHC.Word | |
Ix Word64 | Since: base-2.1 |
Num Word64 | Since: base-2.1 |
Read Word64 | Since: base-2.1 |
Integral Word64 | Since: base-2.1 |
Real Word64 | Since: base-2.1 |
Defined in GHC.Word Methods toRational :: Word64 -> Rational # | |
Show Word64 | Since: base-2.1 |
PrintfArg Word64 | Since: base-2.1 |
Defined in Text.Printf | |
Eq Word64 | Since: base-2.1 |
Ord Word64 | Since: base-2.1 |
IsGValue Word64 Source # | |
Defined in Data.GI.Base.GValue | |
IsGVariant Word64 Source # | |
Defined in Data.GI.Base.GVariant | |
IsGVariantBasicType Word64 Source # | |
Defined in Data.GI.Base.GVariant |
32-bit unsigned integer type
Instances
Data Word32 | Since: base-4.0.0.0 |
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word32 -> c Word32 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word32 # toConstr :: Word32 -> Constr # dataTypeOf :: Word32 -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word32) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word32) # gmapT :: (forall b. Data b => b -> b) -> Word32 -> Word32 # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word32 -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word32 -> r # gmapQ :: (forall d. Data d => d -> u) -> Word32 -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word32 -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word32 -> m Word32 # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word32 -> m Word32 # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word32 -> m Word32 # | |
Storable Word32 | Since: base-2.1 |
Bits Word32 | Since: base-2.1 |
Defined in GHC.Word Methods (.&.) :: Word32 -> Word32 -> Word32 # (.|.) :: Word32 -> Word32 -> Word32 # xor :: Word32 -> Word32 -> Word32 # complement :: Word32 -> Word32 # shift :: Word32 -> Int -> Word32 # rotate :: Word32 -> Int -> Word32 # setBit :: Word32 -> Int -> Word32 # clearBit :: Word32 -> Int -> Word32 # complementBit :: Word32 -> Int -> Word32 # testBit :: Word32 -> Int -> Bool # bitSizeMaybe :: Word32 -> Maybe Int # shiftL :: Word32 -> Int -> Word32 # unsafeShiftL :: Word32 -> Int -> Word32 # shiftR :: Word32 -> Int -> Word32 # unsafeShiftR :: Word32 -> Int -> Word32 # rotateL :: Word32 -> Int -> Word32 # | |
FiniteBits Word32 | Since: base-4.6.0.0 |
Defined in GHC.Word Methods finiteBitSize :: Word32 -> Int # countLeadingZeros :: Word32 -> Int # countTrailingZeros :: Word32 -> Int # | |
Bounded Word32 | Since: base-2.1 |
Enum Word32 | Since: base-2.1 |
Defined in GHC.Word | |
Ix Word32 | Since: base-2.1 |
Num Word32 | Since: base-2.1 |
Read Word32 | Since: base-2.1 |
Integral Word32 | Since: base-2.1 |
Real Word32 | Since: base-2.1 |
Defined in GHC.Word Methods toRational :: Word32 -> Rational # | |
Show Word32 | Since: base-2.1 |
PrintfArg Word32 | Since: base-2.1 |
Defined in Text.Printf | |
Eq Word32 | Since: base-2.1 |
Ord Word32 | Since: base-2.1 |
IsGValue Word32 Source # | |
Defined in Data.GI.Base.GValue | |
IsGVariant Word32 Source # | |
Defined in Data.GI.Base.GVariant | |
IsGVariantBasicType Word32 Source # | |
Defined in Data.GI.Base.GVariant |
16-bit unsigned integer type
Instances
Data Word16 | Since: base-4.0.0.0 |
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word16 -> c Word16 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word16 # toConstr :: Word16 -> Constr # dataTypeOf :: Word16 -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word16) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word16) # gmapT :: (forall b. Data b => b -> b) -> Word16 -> Word16 # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word16 -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word16 -> r # gmapQ :: (forall d. Data d => d -> u) -> Word16 -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word16 -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word16 -> m Word16 # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word16 -> m Word16 # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word16 -> m Word16 # | |
Storable Word16 | Since: base-2.1 |
Bits Word16 | Since: base-2.1 |
Defined in GHC.Word Methods (.&.) :: Word16 -> Word16 -> Word16 # (.|.) :: Word16 -> Word16 -> Word16 # xor :: Word16 -> Word16 -> Word16 # complement :: Word16 -> Word16 # shift :: Word16 -> Int -> Word16 # rotate :: Word16 -> Int -> Word16 # setBit :: Word16 -> Int -> Word16 # clearBit :: Word16 -> Int -> Word16 # complementBit :: Word16 -> Int -> Word16 # testBit :: Word16 -> Int -> Bool # bitSizeMaybe :: Word16 -> Maybe Int # shiftL :: Word16 -> Int -> Word16 # unsafeShiftL :: Word16 -> Int -> Word16 # shiftR :: Word16 -> Int -> Word16 # unsafeShiftR :: Word16 -> Int -> Word16 # rotateL :: Word16 -> Int -> Word16 # | |
FiniteBits Word16 | Since: base-4.6.0.0 |
Defined in GHC.Word Methods finiteBitSize :: Word16 -> Int # countLeadingZeros :: Word16 -> Int # countTrailingZeros :: Word16 -> Int # | |
Bounded Word16 | Since: base-2.1 |
Enum Word16 | Since: base-2.1 |
Defined in GHC.Word | |
Ix Word16 | Since: base-2.1 |
Num Word16 | Since: base-2.1 |
Read Word16 | Since: base-2.1 |
Integral Word16 | Since: base-2.1 |
Real Word16 | Since: base-2.1 |
Defined in GHC.Word Methods toRational :: Word16 -> Rational # | |
Show Word16 | Since: base-2.1 |
PrintfArg Word16 | Since: base-2.1 |
Defined in Text.Printf | |
Eq Word16 | Since: base-2.1 |
Ord Word16 | Since: base-2.1 |
IsGVariant Word16 Source # | |
Defined in Data.GI.Base.GVariant | |
IsGVariantBasicType Word16 Source # | |
Defined in Data.GI.Base.GVariant |
data ByteString #
A space-efficient representation of a Word8
vector, supporting many
efficient operations.
A ByteString
contains 8-bit bytes, or by using the operations from
Data.ByteString.Char8 it can be interpreted as containing 8-bit
characters.
Instances
Haskell type representing the C float
type.
(The concrete types of Foreign.C.Types are platform-specific.)
Instances
Storable CFloat | |
Enum CFloat | |
Defined in Foreign.C.Types | |
Floating CFloat | |
RealFloat CFloat | |
Defined in Foreign.C.Types Methods floatRadix :: CFloat -> Integer # floatDigits :: CFloat -> Int # floatRange :: CFloat -> (Int, Int) # decodeFloat :: CFloat -> (Integer, Int) # encodeFloat :: Integer -> Int -> CFloat # significand :: CFloat -> CFloat # scaleFloat :: Int -> CFloat -> CFloat # isInfinite :: CFloat -> Bool # isDenormalized :: CFloat -> Bool # isNegativeZero :: CFloat -> Bool # | |
Num CFloat | |
Read CFloat | |
Fractional CFloat | |
Real CFloat | |
Defined in Foreign.C.Types Methods toRational :: CFloat -> Rational # | |
RealFrac CFloat | |
Show CFloat | |
Eq CFloat | |
Ord CFloat | |
Haskell type representing the C double
type.
(The concrete types of Foreign.C.Types are platform-specific.)
Instances
Storable CDouble | |
Enum CDouble | |
Floating CDouble | |
RealFloat CDouble | |
Defined in Foreign.C.Types Methods floatRadix :: CDouble -> Integer # floatDigits :: CDouble -> Int # floatRange :: CDouble -> (Int, Int) # decodeFloat :: CDouble -> (Integer, Int) # encodeFloat :: Integer -> Int -> CDouble # significand :: CDouble -> CDouble # scaleFloat :: Int -> CDouble -> CDouble # isInfinite :: CDouble -> Bool # isDenormalized :: CDouble -> Bool # isNegativeZero :: CDouble -> Bool # | |
Num CDouble | |
Read CDouble | |
Fractional CDouble | |
Real CDouble | |
Defined in Foreign.C.Types Methods toRational :: CDouble -> Rational # | |
RealFrac CDouble | |
Show CDouble | |
Eq CDouble | |
Ord CDouble | |
Instances
Storable CUIntPtr | |
Defined in Foreign.C.Types | |
Bits CUIntPtr | |
Defined in Foreign.C.Types Methods (.&.) :: CUIntPtr -> CUIntPtr -> CUIntPtr # (.|.) :: CUIntPtr -> CUIntPtr -> CUIntPtr # xor :: CUIntPtr -> CUIntPtr -> CUIntPtr # complement :: CUIntPtr -> CUIntPtr # shift :: CUIntPtr -> Int -> CUIntPtr # rotate :: CUIntPtr -> Int -> CUIntPtr # setBit :: CUIntPtr -> Int -> CUIntPtr # clearBit :: CUIntPtr -> Int -> CUIntPtr # complementBit :: CUIntPtr -> Int -> CUIntPtr # testBit :: CUIntPtr -> Int -> Bool # bitSizeMaybe :: CUIntPtr -> Maybe Int # isSigned :: CUIntPtr -> Bool # shiftL :: CUIntPtr -> Int -> CUIntPtr # unsafeShiftL :: CUIntPtr -> Int -> CUIntPtr # shiftR :: CUIntPtr -> Int -> CUIntPtr # unsafeShiftR :: CUIntPtr -> Int -> CUIntPtr # rotateL :: CUIntPtr -> Int -> CUIntPtr # | |
FiniteBits CUIntPtr | |
Defined in Foreign.C.Types Methods finiteBitSize :: CUIntPtr -> Int # countLeadingZeros :: CUIntPtr -> Int # countTrailingZeros :: CUIntPtr -> Int # | |
Bounded CUIntPtr | |
Enum CUIntPtr | |
Ix CUIntPtr | |
Defined in Foreign.C.Types Methods range :: (CUIntPtr, CUIntPtr) -> [CUIntPtr] # index :: (CUIntPtr, CUIntPtr) -> CUIntPtr -> Int # unsafeIndex :: (CUIntPtr, CUIntPtr) -> CUIntPtr -> Int # inRange :: (CUIntPtr, CUIntPtr) -> CUIntPtr -> Bool # rangeSize :: (CUIntPtr, CUIntPtr) -> Int # unsafeRangeSize :: (CUIntPtr, CUIntPtr) -> Int # | |
Num CUIntPtr | |
Read CUIntPtr | |
Integral CUIntPtr | |
Defined in Foreign.C.Types | |
Real CUIntPtr | |
Defined in Foreign.C.Types Methods toRational :: CUIntPtr -> Rational # | |
Show CUIntPtr | |
Eq CUIntPtr | |
Ord CUIntPtr | |
Defined in Foreign.C.Types |
Instances
Storable CIntPtr | |
Bits CIntPtr | |
Defined in Foreign.C.Types Methods (.&.) :: CIntPtr -> CIntPtr -> CIntPtr # (.|.) :: CIntPtr -> CIntPtr -> CIntPtr # xor :: CIntPtr -> CIntPtr -> CIntPtr # complement :: CIntPtr -> CIntPtr # shift :: CIntPtr -> Int -> CIntPtr # rotate :: CIntPtr -> Int -> CIntPtr # setBit :: CIntPtr -> Int -> CIntPtr # clearBit :: CIntPtr -> Int -> CIntPtr # complementBit :: CIntPtr -> Int -> CIntPtr # testBit :: CIntPtr -> Int -> Bool # bitSizeMaybe :: CIntPtr -> Maybe Int # shiftL :: CIntPtr -> Int -> CIntPtr # unsafeShiftL :: CIntPtr -> Int -> CIntPtr # shiftR :: CIntPtr -> Int -> CIntPtr # unsafeShiftR :: CIntPtr -> Int -> CIntPtr # rotateL :: CIntPtr -> Int -> CIntPtr # | |
FiniteBits CIntPtr | |
Defined in Foreign.C.Types Methods finiteBitSize :: CIntPtr -> Int # countLeadingZeros :: CIntPtr -> Int # countTrailingZeros :: CIntPtr -> Int # | |
Bounded CIntPtr | |
Enum CIntPtr | |
Ix CIntPtr | |
Defined in Foreign.C.Types | |
Num CIntPtr | |
Read CIntPtr | |
Integral CIntPtr | |
Defined in Foreign.C.Types | |
Real CIntPtr | |
Defined in Foreign.C.Types Methods toRational :: CIntPtr -> Rational # | |
Show CIntPtr | |
Eq CIntPtr | |
Ord CIntPtr | |
Haskell type representing the C unsigned long
type.
(The concrete types of Foreign.C.Types are platform-specific.)
Instances
Storable CULong | |
Bits CULong | |
Defined in Foreign.C.Types Methods (.&.) :: CULong -> CULong -> CULong # (.|.) :: CULong -> CULong -> CULong # xor :: CULong -> CULong -> CULong # complement :: CULong -> CULong # shift :: CULong -> Int -> CULong # rotate :: CULong -> Int -> CULong # setBit :: CULong -> Int -> CULong # clearBit :: CULong -> Int -> CULong # complementBit :: CULong -> Int -> CULong # testBit :: CULong -> Int -> Bool # bitSizeMaybe :: CULong -> Maybe Int # shiftL :: CULong -> Int -> CULong # unsafeShiftL :: CULong -> Int -> CULong # shiftR :: CULong -> Int -> CULong # unsafeShiftR :: CULong -> Int -> CULong # rotateL :: CULong -> Int -> CULong # | |
FiniteBits CULong | |
Defined in Foreign.C.Types Methods finiteBitSize :: CULong -> Int # countLeadingZeros :: CULong -> Int # countTrailingZeros :: CULong -> Int # | |
Bounded CULong | |
Enum CULong | |
Defined in Foreign.C.Types | |
Ix CULong | |
Num CULong | |
Read CULong | |
Integral CULong | |
Defined in Foreign.C.Types | |
Real CULong | |
Defined in Foreign.C.Types Methods toRational :: CULong -> Rational # | |
Show CULong | |
Eq CULong | |
Ord CULong | |
IsGValue CULong Source # | |
Defined in Data.GI.Base.GValue |
Haskell type representing the C long
type.
(The concrete types of Foreign.C.Types are platform-specific.)
Instances
Storable CLong | |
Bits CLong | |
Defined in Foreign.C.Types Methods (.&.) :: CLong -> CLong -> CLong # (.|.) :: CLong -> CLong -> CLong # xor :: CLong -> CLong -> CLong # complement :: CLong -> CLong # shift :: CLong -> Int -> CLong # rotate :: CLong -> Int -> CLong # setBit :: CLong -> Int -> CLong # clearBit :: CLong -> Int -> CLong # complementBit :: CLong -> Int -> CLong # testBit :: CLong -> Int -> Bool # bitSizeMaybe :: CLong -> Maybe Int # shiftL :: CLong -> Int -> CLong # unsafeShiftL :: CLong -> Int -> CLong # shiftR :: CLong -> Int -> CLong # unsafeShiftR :: CLong -> Int -> CLong # rotateL :: CLong -> Int -> CLong # | |
FiniteBits CLong | |
Defined in Foreign.C.Types Methods finiteBitSize :: CLong -> Int # countLeadingZeros :: CLong -> Int # countTrailingZeros :: CLong -> Int # | |
Bounded CLong | |
Enum CLong | |
Defined in Foreign.C.Types | |
Ix CLong | |
Num CLong | |
Read CLong | |
Integral CLong | |
Real CLong | |
Defined in Foreign.C.Types Methods toRational :: CLong -> Rational # | |
Show CLong | |
Eq CLong | |
Ord CLong | |
IsGValue CLong Source # | |
Defined in Data.GI.Base.GValue |
Haskell type representing the C unsigned int
type.
(The concrete types of Foreign.C.Types are platform-specific.)
Instances
Storable CUInt | |
Bits CUInt | |
Defined in Foreign.C.Types Methods (.&.) :: CUInt -> CUInt -> CUInt # (.|.) :: CUInt -> CUInt -> CUInt # xor :: CUInt -> CUInt -> CUInt # complement :: CUInt -> CUInt # shift :: CUInt -> Int -> CUInt # rotate :: CUInt -> Int -> CUInt # setBit :: CUInt -> Int -> CUInt # clearBit :: CUInt -> Int -> CUInt # complementBit :: CUInt -> Int -> CUInt # testBit :: CUInt -> Int -> Bool # bitSizeMaybe :: CUInt -> Maybe Int # shiftL :: CUInt -> Int -> CUInt # unsafeShiftL :: CUInt -> Int -> CUInt # shiftR :: CUInt -> Int -> CUInt # unsafeShiftR :: CUInt -> Int -> CUInt # rotateL :: CUInt -> Int -> CUInt # | |
FiniteBits CUInt | |
Defined in Foreign.C.Types Methods finiteBitSize :: CUInt -> Int # countLeadingZeros :: CUInt -> Int # countTrailingZeros :: CUInt -> Int # | |
Bounded CUInt | |
Enum CUInt | |
Defined in Foreign.C.Types | |
Ix CUInt | |
Num CUInt | |
Read CUInt | |
Integral CUInt | |
Real CUInt | |
Defined in Foreign.C.Types Methods toRational :: CUInt -> Rational # | |
Show CUInt | |
Eq CUInt | |
Ord CUInt | |
IsGValue CUInt Source # | |
Defined in Data.GI.Base.GValue |
Haskell type representing the C int
type.
(The concrete types of Foreign.C.Types are platform-specific.)
Instances
Storable CInt | |
Defined in Foreign.C.Types | |
Bits CInt | |
Defined in Foreign.C.Types Methods (.&.) :: CInt -> CInt -> CInt # (.|.) :: CInt -> CInt -> CInt # complement :: CInt -> CInt # shift :: CInt -> Int -> CInt # rotate :: CInt -> Int -> CInt # setBit :: CInt -> Int -> CInt # clearBit :: CInt -> Int -> CInt # complementBit :: CInt -> Int -> CInt # testBit :: CInt -> Int -> Bool # bitSizeMaybe :: CInt -> Maybe Int # shiftL :: CInt -> Int -> CInt # unsafeShiftL :: CInt -> Int -> CInt # shiftR :: CInt -> Int -> CInt # unsafeShiftR :: CInt -> Int -> CInt # rotateL :: CInt -> Int -> CInt # | |
FiniteBits CInt | |
Defined in Foreign.C.Types Methods finiteBitSize :: CInt -> Int # countLeadingZeros :: CInt -> Int # countTrailingZeros :: CInt -> Int # | |
Bounded CInt | |
Enum CInt | |
Ix CInt | |
Num CInt | |
Read CInt | |
Integral CInt | |
Real CInt | |
Defined in Foreign.C.Types Methods toRational :: CInt -> Rational # | |
Show CInt | |
Eq CInt | |
Ord CInt | |
IsGValue CInt Source # | |
Defined in Data.GI.Base.GValue |
A value of type
represents a pointer to an object, or an
array of objects, which may be marshalled to or from Haskell values
of type Ptr
aa
.
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) | |||||
Defined in GHC.Generics Associated Types
| |||||
Data a => Data (Ptr a) | Since: base-4.8.0.0 | ||||
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Ptr a -> c (Ptr a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Ptr a) # dataTypeOf :: Ptr a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Ptr a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Ptr a)) # gmapT :: (forall b. Data b => b -> b) -> Ptr a -> Ptr a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Ptr a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Ptr a -> r # gmapQ :: (forall d. Data d => d -> u) -> Ptr a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Ptr a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Ptr a -> m (Ptr a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Ptr a -> m (Ptr a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Ptr a -> m (Ptr a) # | |||||
Foldable (UAddr :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in Data.Foldable Methods fold :: Monoid m => UAddr m -> m # foldMap :: Monoid m => (a -> m) -> UAddr a -> m # foldMap' :: Monoid m => (a -> m) -> UAddr a -> m # foldr :: (a -> b -> b) -> b -> UAddr a -> b # foldr' :: (a -> b -> b) -> b -> UAddr a -> b # foldl :: (b -> a -> b) -> b -> UAddr a -> b # foldl' :: (b -> a -> b) -> b -> UAddr a -> b # foldr1 :: (a -> a -> a) -> UAddr a -> a # foldl1 :: (a -> a -> a) -> UAddr a -> a # elem :: Eq a => a -> UAddr a -> Bool # maximum :: Ord a => UAddr a -> a # minimum :: Ord a => UAddr a -> a # | |||||
Traversable (UAddr :: Type -> Type) | Since: base-4.9.0.0 | ||||
Storable (Ptr a) | Since: base-2.1 | ||||
Show (Ptr a) | Since: base-2.1 | ||||
Eq (Ptr a) | Since: base-2.1 | ||||
Ord (Ptr a) | Since: base-2.1 | ||||
IsGValue (Ptr a) Source # | |||||
Defined in Data.GI.Base.GValue | |||||
Functor (URec (Ptr ()) :: Type -> Type) | Since: base-4.9.0.0 | ||||
Generic (URec (Ptr ()) p) | |||||
Defined in GHC.Generics Associated Types
| |||||
Eq (URec (Ptr ()) p) | Since: base-4.9.0.0 | ||||
Ord (URec (Ptr ()) p) | Since: base-4.9.0.0 | ||||
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 # | |||||
data URec (Ptr ()) (p :: k) | Used for marking occurrences of Since: base-4.9.0.0 | ||||
type Rep1 (URec (Ptr ()) :: k -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
type Rep (URec (Ptr ()) p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics |
A value of type
is a pointer to a function callable
from foreign code. The type FunPtr
aa
will normally be a foreign type,
a function type with zero or more arguments where
- the argument types are marshallable foreign types,
i.e.
Char
,Int
,Double
,Float
,Bool
,Int8
,Int16
,Int32
,Int64
,Word8
,Word16
,Word32
,Word64
,
,Ptr
a
,FunPtr
a
or a renaming of any of these usingStablePtr
anewtype
. - the return type is either a marshallable foreign type or has the form
whereIO
tt
is a marshallable foreign type or()
.
A value of type
may be a pointer to a foreign function,
either returned by another foreign function or imported with a
a static address import likeFunPtr
a
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
Storable (FunPtr a) | Since: base-2.1 |
Defined in Foreign.Storable | |
Show (FunPtr a) | Since: base-2.1 |
Eq (FunPtr a) | |
Ord (FunPtr a) | |
Defined in GHC.Ptr |
castFunPtrToPtr :: FunPtr a -> Ptr b #
castPtrToFunPtr :: Ptr a -> FunPtr b #
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 ForeignPtr
s 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
Data a => Data (ForeignPtr a) | Since: base-4.8.0.0 |
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ForeignPtr a -> c (ForeignPtr a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ForeignPtr a) # toConstr :: ForeignPtr a -> Constr # dataTypeOf :: ForeignPtr a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ForeignPtr a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ForeignPtr a)) # gmapT :: (forall b. Data b => b -> b) -> ForeignPtr a -> ForeignPtr a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ForeignPtr a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ForeignPtr a -> r # gmapQ :: (forall d. Data d => d -> u) -> ForeignPtr a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ForeignPtr a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ForeignPtr a -> m (ForeignPtr a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ForeignPtr a -> m (ForeignPtr a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ForeignPtr a -> m (ForeignPtr a) # | |
Show (ForeignPtr a) | Since: base-2.1 |
Defined in GHC.ForeignPtr Methods showsPrec :: Int -> ForeignPtr a -> ShowS # show :: ForeignPtr a -> String # showList :: [ForeignPtr a] -> ShowS # | |
Eq (ForeignPtr a) | Since: base-2.1 |
Defined in GHC.ForeignPtr | |
Ord (ForeignPtr a) | Since: base-2.1 |
Defined in GHC.ForeignPtr Methods compare :: ForeignPtr a -> ForeignPtr a -> Ordering # (<) :: ForeignPtr a -> ForeignPtr a -> Bool # (<=) :: ForeignPtr a -> ForeignPtr a -> Bool # (>) :: ForeignPtr a -> ForeignPtr a -> Bool # (>=) :: ForeignPtr a -> ForeignPtr a -> Bool # max :: ForeignPtr a -> ForeignPtr a -> ForeignPtr a # min :: ForeignPtr a -> ForeignPtr a -> ForeignPtr a # |
module Foreign.ForeignPtr.Unsafe
sizeOf :: Storable a => a -> Int #
Computes the storage requirements (in bytes) of the argument. The value of the argument is not used.
peek :: Storable a => 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 :: Storable a => Ptr a -> a -> IO () #
Write the given value to the given memory location. Alignment
restrictions might apply; see peek
.
(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 #
An infix synonym for fmap
.
The name of this operator is an allusion to $
.
Note the similarities between their types:
($) :: (a -> b) -> a -> b (<$>) :: Functor f => (a -> b) -> f a -> f b
Whereas $
is function application, <$>
is function
application lifted over a Functor
.
Examples
Convert from a
to a Maybe
Int
using Maybe
String
show
:
>>>
show <$> Nothing
Nothing>>>
show <$> Just 3
Just "3"
Convert from an
to an
Either
Int
Int
Either
Int
String
using show
:
>>>
show <$> Left 17
Left 17>>>
show <$> Right 17
Right "17"
Double each element of a list:
>>>
(*2) <$> [1,2,3]
[2,4,6]
Apply even
to the second element of a pair:
>>>
even <$> (2,2)
(2,True)
onException :: IO a -> IO b -> IO a #
Like finally
, but only performs the final action if there was an
exception raised by the computation.
module Control.Monad.IO.Class
clear :: forall info (attr :: Symbol) obj m. (AttrClearC info obj attr, MonadIO m) => obj -> AttrLabelProxy attr -> m () Source #
Set a nullable attribute to NULL
.
data AttrOp obj (tag :: AttrOpTag) where Source #
Constructors for the different operations allowed on an attribute.
Constructors
(:=) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrSetTypeConstraint info b) => AttrLabelProxy attr -> b -> AttrOp obj tag infixr 0 | Assign a value to an attribute |
(:=>) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrSetTypeConstraint info b) => AttrLabelProxy attr -> IO b -> AttrOp obj tag infixr 0 | Assign the result of an IO action to an attribute |
(:~) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b a. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, tag ~ 'AttrSet, AttrOpAllowed 'AttrSet info obj, AttrOpAllowed 'AttrGet info obj, AttrSetTypeConstraint info b, a ~ AttrGetType info) => AttrLabelProxy attr -> (a -> b) -> AttrOp obj tag infixr 0 | Apply an update function to an attribute |
(:~>) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b a. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, tag ~ 'AttrSet, AttrOpAllowed 'AttrSet info obj, AttrOpAllowed 'AttrGet info obj, AttrSetTypeConstraint info b, a ~ AttrGetType info) => AttrLabelProxy attr -> (a -> IO b) -> AttrOp obj tag infixr 0 | Apply an IO update function to an attribute |
(:&=) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrTransferTypeConstraint info b, AttrSetTypeConstraint info (AttrTransferType info)) => AttrLabelProxy attr -> b -> AttrOp obj tag | Assign a value to an attribute, allocating any necessary
memory for representing the Haskell value as a C value. Note
that it is the responsibility of the caller to make sure that
the memory is freed when no longer used, otherwise there will
be a memory leak. In the majority of cases you probably want to
use |
On :: forall obj info (tag :: AttrOpTag). (GObject obj, SignalInfo info) => SignalProxy obj info -> ((?self :: obj) => HaskellCallbackType info) -> AttrOp obj tag | Connect the given signal to a signal handler. |
After :: forall obj info (tag :: AttrOpTag). (GObject obj, SignalInfo info) => SignalProxy obj info -> ((?self :: obj) => HaskellCallbackType info) -> AttrOp obj tag | Like |
class AttrInfo info where Source #
Info describing an attribute.
Minimal complete definition
Nothing
Associated Types
type AttrAllowedOps info :: [AttrOpTag] Source #
The operations that are allowed on the attribute.
type AttrBaseTypeConstraint info :: Type -> Constraint Source #
Constraint on the type for which we are allowed to create/set/get the attribute.
type AttrGetType info Source #
Type returned by attrGet
.
type AttrSetTypeConstraint info :: Type -> Constraint Source #
Constraint on the value being set.
type AttrSetTypeConstraint info = Type ~ AttrGetType info
type AttrTransferTypeConstraint info :: Type -> Constraint Source #
Constraint on the value being set, with allocation allowed
(see :&=
below).
type AttrTransferTypeConstraint info = Type ~ AttrTransferType info
type AttrTransferType info Source #
Type resulting from the allocation.
type AttrTransferType info = AttrGetType info
type AttrLabel info :: Symbol Source #
Name of the attribute.
type AttrOrigin info Source #
Type which introduces the attribute.
Methods
attrGet :: AttrBaseTypeConstraint info o => o -> IO (AttrGetType info) Source #
Get the value of the given attribute.
default attrGet :: CheckNotElem 'AttrGet (AttrAllowedOps info) (GetNotProvidedError info) => o -> IO (AttrGetType info) Source #
attrSet :: (AttrBaseTypeConstraint info o, AttrSetTypeConstraint info b) => o -> b -> IO () Source #
Set the value of the given attribute, after the object having the attribute has already been created.
default attrSet :: CheckNotElem 'AttrSet (AttrAllowedOps info) (SetNotProvidedError info) => o -> b -> IO () Source #
attrClear :: AttrBaseTypeConstraint info o => o -> IO () Source #
Set the value of the given attribute to NULL
(for nullable
attributes).
default attrClear :: CheckNotElem 'AttrClear (AttrAllowedOps info) (ClearNotProvidedError info) => o -> IO () Source #
attrConstruct :: (AttrBaseTypeConstraint info o, AttrSetTypeConstraint info b) => b -> IO (GValueConstruct o) Source #
Build a GValue
representing the attribute.
default attrConstruct :: CheckNotElem 'AttrConstruct (AttrAllowedOps info) (ConstructNotProvidedError info) => b -> IO (GValueConstruct o) Source #
attrTransfer :: (AttrBaseTypeConstraint info o, AttrTransferTypeConstraint info b) => Proxy o -> b -> IO (AttrTransferType info) Source #
Allocate memory as necessary to generate a settable type from the transfer type. This is useful for types which needs allocations for marshalling from Haskell to C, this makes the allocation explicit.
default attrTransfer :: (AttrBaseTypeConstraint info o, AttrTransferTypeConstraint info b, b ~ AttrGetType info, b ~ AttrTransferType info) => Proxy o -> b -> IO (AttrTransferType info) Source #
dbgAttrInfo :: Maybe ResolvedSymbolInfo Source #
Return some information about the overloaded attribute,
useful for debugging. See resolveAttr
for how to access this
conveniently.
Possible operations on an attribute.
Constructors
AttrGet | It is possible to read the value of the attribute
with |
AttrSet | It is possible to write the value of the attribute
with |
AttrConstruct | It is possible to set the value of the attribute
in |
AttrClear | It is possible to clear the value of the
(nullable) attribute with |
Instances
Bounded AttrOpTag Source # | |
Enum AttrOpTag Source # | |
Defined in Data.GI.Base.Attributes Methods succ :: AttrOpTag -> AttrOpTag # pred :: AttrOpTag -> AttrOpTag # fromEnum :: AttrOpTag -> Int # enumFrom :: AttrOpTag -> [AttrOpTag] # enumFromThen :: AttrOpTag -> AttrOpTag -> [AttrOpTag] # enumFromTo :: AttrOpTag -> AttrOpTag -> [AttrOpTag] # enumFromThenTo :: AttrOpTag -> AttrOpTag -> AttrOpTag -> [AttrOpTag] # | |
Show AttrOpTag Source # | |
Eq AttrOpTag Source # | |
Ord AttrOpTag Source # | |
type family AttrOpAllowed (tag :: AttrOpTag) info useType where ... Source #
Whether a given AttrOpTag
is allowed on an attribute, given the
info type.
Equations
AttrOpAllowed tag info useType = AttrOpIsAllowed tag (AttrAllowedOps info) (AttrLabel info) (AttrOrigin info) useType |
type AttrGetC info obj (attr :: Symbol) result = (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed 'AttrGet info obj, result ~ AttrGetType info) Source #
Constraints on a obj
/attr
pair so get
is possible,
producing a value of type result
.
type AttrSetC info obj (attr :: Symbol) value = (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed 'AttrSet info obj, AttrSetTypeConstraint info value) Source #
Constraint on a obj
/attr
pair so that set
works on values
of type value
.
type AttrConstructC info obj (attr :: Symbol) value = (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed 'AttrConstruct info obj, AttrSetTypeConstraint info value) Source #
Constraint on a obj
/value
pair so that
new
works on values of type value
.
type AttrClearC info obj (attr :: Symbol) = (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed 'AttrClear info obj) Source #
Constraint on a obj
/attr
pair so that clear
is allowed.
data AttrLabelProxy (a :: Symbol) Source #
A proxy for attribute labels.
Constructors
AttrLabelProxy |
Instances
a ~ x => IsLabel x (AttrLabelProxy a) Source # | |
Defined in Data.GI.Base.Attributes Methods fromLabel :: AttrLabelProxy a # |
resolveAttr :: forall info (attr :: Symbol) obj. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info) => obj -> AttrLabelProxy attr -> Maybe ResolvedSymbolInfo Source #
Return the fully qualified attribute name that a given overloaded attribute resolves to (mostly useful for debugging).
resolveAttr #sensitive button
type family AttrAllowedOps info :: [AttrOpTag] Source #
The operations that are allowed on the attribute.
type family AttrBaseTypeConstraint info :: Type -> Constraint Source #
Constraint on the type for which we are allowed to create/set/get the attribute.
type family AttrGetType info Source #
Type returned by attrGet
.
type family AttrSetTypeConstraint info :: Type -> Constraint Source #
Constraint on the value being set.
type family AttrTransferTypeConstraint info :: Type -> Constraint Source #
Constraint on the value being set, with allocation allowed
(see :&=
below).
type family AttrTransferType info Source #
Type resulting from the allocation.
type family AttrOrigin info Source #
Type which introduces the attribute.
module Data.GI.Base.BasicTypes
The basic type. This corresponds to a wrapped GClosure
on the C
side, which is a boxed object.
Instances
GBoxed (GClosure a) Source # |
|
Defined in Data.GI.Base.GClosure | |
TypedObject (GClosure a) Source # | Find the associated |
HasParentTypes (GClosure a) Source # | |
Defined in Data.GI.Base.GClosure | |
type ParentTypes (GClosure a) Source # | There are no types in the bindings that a closure can be safely cast to. |
Defined in Data.GI.Base.GClosure |
module Data.GI.Base.Constructible
module Data.GI.Base.GError
module Data.GI.Base.GHashTable
module Data.GI.Base.GParamSpec
module Data.GI.Base.GObject
module Data.GI.Base.GVariant
module Data.GI.Base.GValue
module Data.GI.Base.ManagedPtr
class SignalInfo info where Source #
Information about an overloaded signal.
Minimal complete definition
Methods
connectSignal :: GObject o => o -> (o -> HaskellCallbackType info) -> SignalConnectMode -> Maybe Text -> IO SignalHandlerId Source #
Connect a Haskell function to a signal of the given GObject
,
specifying whether the handler will be called before or after the
default handler. Note that the callback being passed here admits
an extra initial parameter with respect to the usual Haskell
callback type. This will be passed as an implicit ?self
argument to the Haskell callback.
dbgSignalInfo :: Maybe ResolvedSymbolInfo Source #
Optional extra debug information, for resolveSignal
below.
Instances
SignalInfo GObjectNotifySignalInfo Source # | |||||
Defined in Data.GI.Base.Signals Associated Types
Methods connectSignal :: GObject o => o -> (o -> HaskellCallbackType GObjectNotifySignalInfo) -> SignalConnectMode -> Maybe Text -> IO SignalHandlerId Source # |
data SignalConnectMode Source #
Whether to connect a handler to a signal with connectSignal
so
that it runs before/after the default handler for the given signal.
Constructors
SignalConnectBefore | Run before the default handler. |
SignalConnectAfter | Run after the default handler. |
connectSignalFunPtr :: GObject o => o -> Text -> FunPtr a -> SignalConnectMode -> Maybe Text -> IO SignalHandlerId Source #
Connect a signal to a handler, given as a FunPtr
.
type SignalHandlerId = CULong Source #
Type of a GObject
signal handler id.
data GObjectNotifySignalInfo Source #
Connection information for a "notify" signal indicating that a
specific property changed (see PropertyNotify
for the relevant
constructor).
Instances
SignalInfo GObjectNotifySignalInfo Source # | |||||
Defined in Data.GI.Base.Signals Associated Types
Methods connectSignal :: GObject o => o -> (o -> HaskellCallbackType GObjectNotifySignalInfo) -> SignalConnectMode -> Maybe Text -> IO SignalHandlerId Source # | |||||
type HaskellCallbackType GObjectNotifySignalInfo Source # | |||||
Defined in Data.GI.Base.Signals |
module Data.GI.Base.Utils
(Kind) This is the kind of type-level symbols.
Instances
SingKind Symbol | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics Associated Types
| |||||
TestCoercion SSymbol | Since: base-4.18.0.0 | ||||
Defined in GHC.TypeLits | |||||
TestEquality SSymbol | Since: base-4.18.0.0 | ||||
Defined in GHC.TypeLits | |||||
KnownSymbol a => SingI (a :: Symbol) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics Methods sing :: Sing a | |||||
type DemoteRep Symbol | |||||
Defined in GHC.Generics | |||||
data Sing (s :: Symbol) | |||||
Defined in GHC.Generics | |||||
type Compare (a :: Symbol) (b :: Symbol) | |||||
Defined in Data.Type.Ord |
Class Enum
defines operations on sequentially ordered types.
The enumFrom
... methods are used in Haskell's translation of
arithmetic sequences.
Instances of Enum
may be derived for any enumeration type (types
whose constructors have no fields). The nullary constructors are
assumed to be numbered left-to-right by fromEnum
from 0
through n-1
.
See Chapter 10 of the Haskell Report for more details.
For any type that is an instance of class Bounded
as well as Enum
,
the following should hold:
- The calls
andsucc
maxBound
should result in a runtime error.pred
minBound
fromEnum
andtoEnum
should give a runtime error if the result value is not representable in the result type. For example,
is an error.toEnum
7 ::Bool
enumFrom
andenumFromThen
should be defined with an implicit bound, thus:
enumFrom x = enumFromTo x maxBound enumFromThen x y = enumFromThenTo x y bound where bound | fromEnum y >= fromEnum x = maxBound | otherwise = minBound
Methods
Convert from an Int
.
Instances
Enum CBool | |
Defined in Foreign.C.Types | |
Enum CChar | |
Defined in Foreign.C.Types | |
Enum CClock | |
Defined in Foreign.C.Types | |
Enum CDouble | |
Enum CFloat | |
Defined in Foreign.C.Types | |
Enum CInt | |
Enum CIntMax | |
Enum CIntPtr | |
Enum CLLong | |
Defined in Foreign.C.Types | |
Enum CLong | |
Defined in Foreign.C.Types | |
Enum CPtrdiff | |
Enum CSChar | |
Defined in Foreign.C.Types | |
Enum CSUSeconds | |
Defined in Foreign.C.Types Methods succ :: CSUSeconds -> CSUSeconds # pred :: CSUSeconds -> CSUSeconds # toEnum :: Int -> CSUSeconds # fromEnum :: CSUSeconds -> Int # enumFrom :: CSUSeconds -> [CSUSeconds] # enumFromThen :: CSUSeconds -> CSUSeconds -> [CSUSeconds] # enumFromTo :: CSUSeconds -> CSUSeconds -> [CSUSeconds] # enumFromThenTo :: CSUSeconds -> CSUSeconds -> CSUSeconds -> [CSUSeconds] # | |
Enum CShort | |
Defined in Foreign.C.Types | |
Enum CSigAtomic | |
Defined in Foreign.C.Types Methods succ :: CSigAtomic -> CSigAtomic # pred :: CSigAtomic -> CSigAtomic # toEnum :: Int -> CSigAtomic # fromEnum :: CSigAtomic -> Int # enumFrom :: CSigAtomic -> [CSigAtomic] # enumFromThen :: CSigAtomic -> CSigAtomic -> [CSigAtomic] # enumFromTo :: CSigAtomic -> CSigAtomic -> [CSigAtomic] # enumFromThenTo :: CSigAtomic -> CSigAtomic -> CSigAtomic -> [CSigAtomic] # | |
Enum CSize | |
Defined in Foreign.C.Types | |
Enum CTime | |
Defined in Foreign.C.Types | |
Enum CUChar | |
Defined in Foreign.C.Types | |
Enum CUInt | |
Defined in Foreign.C.Types | |
Enum CUIntMax | |
Enum CUIntPtr | |
Enum CULLong | |
Enum CULong | |
Defined in Foreign.C.Types | |
Enum CUSeconds | |
Defined in Foreign.C.Types Methods succ :: CUSeconds -> CUSeconds # pred :: CUSeconds -> CUSeconds # fromEnum :: CUSeconds -> Int # enumFrom :: CUSeconds -> [CUSeconds] # enumFromThen :: CUSeconds -> CUSeconds -> [CUSeconds] # enumFromTo :: CUSeconds -> CUSeconds -> [CUSeconds] # enumFromThenTo :: CUSeconds -> CUSeconds -> CUSeconds -> [CUSeconds] # | |
Enum CUShort | |
Enum CWchar | |
Defined in Foreign.C.Types | |
Enum IntPtr | |
Defined in Foreign.Ptr | |
Enum WordPtr | |
Enum ByteOrder | Since: base-4.11.0.0 |
Defined in GHC.ByteOrder Methods succ :: ByteOrder -> ByteOrder # pred :: ByteOrder -> ByteOrder # fromEnum :: ByteOrder -> Int # enumFrom :: ByteOrder -> [ByteOrder] # enumFromThen :: ByteOrder -> ByteOrder -> [ByteOrder] # enumFromTo :: ByteOrder -> ByteOrder -> [ByteOrder] # enumFromThenTo :: ByteOrder -> ByteOrder -> ByteOrder -> [ByteOrder] # | |
Enum Associativity | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods succ :: Associativity -> Associativity # pred :: Associativity -> Associativity # toEnum :: Int -> Associativity # fromEnum :: Associativity -> Int # enumFrom :: Associativity -> [Associativity] # enumFromThen :: Associativity -> Associativity -> [Associativity] # enumFromTo :: Associativity -> Associativity -> [Associativity] # enumFromThenTo :: Associativity -> Associativity -> Associativity -> [Associativity] # | |
Enum DecidedStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods succ :: DecidedStrictness -> DecidedStrictness # pred :: DecidedStrictness -> DecidedStrictness # toEnum :: Int -> DecidedStrictness # fromEnum :: DecidedStrictness -> Int # enumFrom :: DecidedStrictness -> [DecidedStrictness] # enumFromThen :: DecidedStrictness -> DecidedStrictness -> [DecidedStrictness] # enumFromTo :: DecidedStrictness -> DecidedStrictness -> [DecidedStrictness] # enumFromThenTo :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness -> [DecidedStrictness] # | |
Enum SourceStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods succ :: SourceStrictness -> SourceStrictness # pred :: SourceStrictness -> SourceStrictness # toEnum :: Int -> SourceStrictness # fromEnum :: SourceStrictness -> Int # enumFrom :: SourceStrictness -> [SourceStrictness] # enumFromThen :: SourceStrictness -> SourceStrictness -> [SourceStrictness] # enumFromTo :: SourceStrictness -> SourceStrictness -> [SourceStrictness] # enumFromThenTo :: SourceStrictness -> SourceStrictness -> SourceStrictness -> [SourceStrictness] # | |
Enum SourceUnpackedness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods succ :: SourceUnpackedness -> SourceUnpackedness # pred :: SourceUnpackedness -> SourceUnpackedness # toEnum :: Int -> SourceUnpackedness # fromEnum :: SourceUnpackedness -> Int # enumFrom :: SourceUnpackedness -> [SourceUnpackedness] # enumFromThen :: SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness] # enumFromTo :: SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness] # enumFromThenTo :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness] # | |
Enum SeekMode | Since: base-4.2.0.0 |
Enum IOMode | Since: base-4.2.0.0 |
Defined in GHC.IO.IOMode | |
Enum Int16 | Since: base-2.1 |
Enum Int32 | Since: base-2.1 |
Enum Int64 | Since: base-2.1 |
Enum Int8 | Since: base-2.1 |
Enum DoCostCentres | Since: base-4.8.0.0 |
Defined in GHC.RTS.Flags Methods succ :: DoCostCentres -> DoCostCentres # pred :: DoCostCentres -> DoCostCentres # toEnum :: Int -> DoCostCentres # fromEnum :: DoCostCentres -> Int # enumFrom :: DoCostCentres -> [DoCostCentres] # enumFromThen :: DoCostCentres -> DoCostCentres -> [DoCostCentres] # enumFromTo :: DoCostCentres -> DoCostCentres -> [DoCostCentres] # enumFromThenTo :: DoCostCentres -> DoCostCentres -> DoCostCentres -> [DoCostCentres] # | |
Enum DoHeapProfile | Since: base-4.8.0.0 |
Defined in GHC.RTS.Flags Methods succ :: DoHeapProfile -> DoHeapProfile # pred :: DoHeapProfile -> DoHeapProfile # toEnum :: Int -> DoHeapProfile # fromEnum :: DoHeapProfile -> Int # enumFrom :: DoHeapProfile -> [DoHeapProfile] # enumFromThen :: DoHeapProfile -> DoHeapProfile -> [DoHeapProfile] # enumFromTo :: DoHeapProfile -> DoHeapProfile -> [DoHeapProfile] # enumFromThenTo :: DoHeapProfile -> DoHeapProfile -> DoHeapProfile -> [DoHeapProfile] # | |
Enum DoTrace | Since: base-4.8.0.0 |
Enum GiveGCStats | Since: base-4.8.0.0 |
Defined in GHC.RTS.Flags Methods succ :: GiveGCStats -> GiveGCStats # pred :: GiveGCStats -> GiveGCStats # toEnum :: Int -> GiveGCStats # fromEnum :: GiveGCStats -> Int # enumFrom :: GiveGCStats -> [GiveGCStats] # enumFromThen :: GiveGCStats -> GiveGCStats -> [GiveGCStats] # enumFromTo :: GiveGCStats -> GiveGCStats -> [GiveGCStats] # enumFromThenTo :: GiveGCStats -> GiveGCStats -> GiveGCStats -> [GiveGCStats] # | |
Enum IoSubSystem | Since: base-4.9.0.0 |
Defined in GHC.RTS.Flags Methods succ :: IoSubSystem -> IoSubSystem # pred :: IoSubSystem -> IoSubSystem # toEnum :: Int -> IoSubSystem # fromEnum :: IoSubSystem -> Int # enumFrom :: IoSubSystem -> [IoSubSystem] # enumFromThen :: IoSubSystem -> IoSubSystem -> [IoSubSystem] # enumFromTo :: IoSubSystem -> IoSubSystem -> [IoSubSystem] # enumFromThenTo :: IoSubSystem -> IoSubSystem -> IoSubSystem -> [IoSubSystem] # | |
Enum GeneralCategory | Since: base-2.1 |
Defined in GHC.Unicode Methods succ :: GeneralCategory -> GeneralCategory # pred :: GeneralCategory -> GeneralCategory # toEnum :: Int -> GeneralCategory # fromEnum :: GeneralCategory -> Int # enumFrom :: GeneralCategory -> [GeneralCategory] # enumFromThen :: GeneralCategory -> GeneralCategory -> [GeneralCategory] # enumFromTo :: GeneralCategory -> GeneralCategory -> [GeneralCategory] # enumFromThenTo :: GeneralCategory -> GeneralCategory -> GeneralCategory -> [GeneralCategory] # | |
Enum Word16 | Since: base-2.1 |
Defined in GHC.Word | |
Enum Word32 | Since: base-2.1 |
Defined in GHC.Word | |
Enum Word64 | Since: base-2.1 |
Defined in GHC.Word | |
Enum Word8 | Since: base-2.1 |
Enum CBlkCnt | |
Enum CBlkSize | |
Defined in System.Posix.Types | |
Enum CCc | |
Enum CClockId | |
Defined in System.Posix.Types | |
Enum CDev | |
Enum CFsBlkCnt | |
Defined in System.Posix.Types Methods succ :: CFsBlkCnt -> CFsBlkCnt # pred :: CFsBlkCnt -> CFsBlkCnt # fromEnum :: CFsBlkCnt -> Int # enumFrom :: CFsBlkCnt -> [CFsBlkCnt] # enumFromThen :: CFsBlkCnt -> CFsBlkCnt -> [CFsBlkCnt] # enumFromTo :: CFsBlkCnt -> CFsBlkCnt -> [CFsBlkCnt] # enumFromThenTo :: CFsBlkCnt -> CFsBlkCnt -> CFsBlkCnt -> [CFsBlkCnt] # | |
Enum CFsFilCnt | |
Defined in System.Posix.Types Methods succ :: CFsFilCnt -> CFsFilCnt # pred :: CFsFilCnt -> CFsFilCnt # fromEnum :: CFsFilCnt -> Int # enumFrom :: CFsFilCnt -> [CFsFilCnt] # enumFromThen :: CFsFilCnt -> CFsFilCnt -> [CFsFilCnt] # enumFromTo :: CFsFilCnt -> CFsFilCnt -> [CFsFilCnt] # enumFromThenTo :: CFsFilCnt -> CFsFilCnt -> CFsFilCnt -> [CFsFilCnt] # | |
Enum CGid | |
Enum CId | |
Enum CIno | |
Enum CKey | |
Enum CMode | |
Defined in System.Posix.Types | |
Enum CNfds | |
Defined in System.Posix.Types | |
Enum CNlink | |
Defined in System.Posix.Types | |
Enum COff | |
Enum CPid | |
Enum CRLim | |
Defined in System.Posix.Types | |
Enum CSocklen | |
Defined in System.Posix.Types | |
Enum CSpeed | |
Defined in System.Posix.Types | |
Enum CSsize | |
Defined in System.Posix.Types | |
Enum CTcflag | |
Enum CUid | |
Enum Fd | |
Enum Ordering | Since: base-2.1 |
Enum AttrOpTag Source # | |
Defined in Data.GI.Base.Attributes Methods succ :: AttrOpTag -> AttrOpTag # pred :: AttrOpTag -> AttrOpTag # fromEnum :: AttrOpTag -> Int # enumFrom :: AttrOpTag -> [AttrOpTag] # enumFromThen :: AttrOpTag -> AttrOpTag -> [AttrOpTag] # enumFromTo :: AttrOpTag -> AttrOpTag -> [AttrOpTag] # enumFromThenTo :: AttrOpTag -> AttrOpTag -> AttrOpTag -> [AttrOpTag] # | |
Enum GParamFlag Source # | |
Defined in Data.GI.Base.GParamSpec Methods succ :: GParamFlag -> GParamFlag # pred :: GParamFlag -> GParamFlag # toEnum :: Int -> GParamFlag # fromEnum :: GParamFlag -> Int # enumFrom :: GParamFlag -> [GParamFlag] # enumFromThen :: GParamFlag -> GParamFlag -> [GParamFlag] # enumFromTo :: GParamFlag -> GParamFlag -> [GParamFlag] # enumFromThenTo :: GParamFlag -> GParamFlag -> GParamFlag -> [GParamFlag] # | |
Enum I8 | |
Enum FPFormat | |
Defined in Data.Text.Lazy.Builder.RealFloat | |
Enum Integer | Since: base-2.1 |
Enum Natural | Since: base-4.8.0.0 |
Enum () | Since: base-2.1 |
Enum Bool | Since: base-2.1 |
Enum Char | Since: base-2.1 |
Enum Int | Since: base-2.1 |
Enum Levity | Since: base-4.16.0.0 |
Defined in GHC.Enum | |
Enum VecCount | Since: base-4.10.0.0 |
Enum VecElem | Since: base-4.10.0.0 |
Enum Word | Since: base-2.1 |
Enum a => Enum (And a) | Since: base-4.16 |
Enum a => Enum (Iff a) | Since: base-4.16 |
Enum a => Enum (Ior a) | Since: base-4.16 |
Enum a => Enum (Xor a) | Since: base-4.16 |
Enum a => Enum (Identity a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Identity Methods succ :: Identity a -> Identity a # pred :: Identity a -> Identity a # fromEnum :: Identity a -> Int # enumFrom :: Identity a -> [Identity a] # enumFromThen :: Identity a -> Identity a -> [Identity a] # enumFromTo :: Identity a -> Identity a -> [Identity a] # enumFromThenTo :: Identity a -> Identity a -> Identity a -> [Identity a] # | |
(Enum a, Bounded a, Eq a) => Enum (Down a) | Swaps Since: base-4.18.0.0 |
Defined in Data.Ord | |
Enum a => Enum (First a) | Since: base-4.9.0.0 |
Enum a => Enum (Last a) | Since: base-4.9.0.0 |
Defined in Data.Semigroup | |
Enum a => Enum (Max a) | Since: base-4.9.0.0 |
Enum a => Enum (Min a) | Since: base-4.9.0.0 |
Enum a => Enum (WrappedMonoid a) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods succ :: WrappedMonoid a -> WrappedMonoid a # pred :: WrappedMonoid a -> WrappedMonoid a # toEnum :: Int -> WrappedMonoid a # fromEnum :: WrappedMonoid a -> Int # enumFrom :: WrappedMonoid a -> [WrappedMonoid a] # enumFromThen :: WrappedMonoid a -> WrappedMonoid a -> [WrappedMonoid a] # enumFromTo :: WrappedMonoid a -> WrappedMonoid a -> [WrappedMonoid a] # enumFromThenTo :: WrappedMonoid a -> WrappedMonoid a -> WrappedMonoid a -> [WrappedMonoid a] # | |
Integral a => Enum (Ratio a) | Since: base-2.0.1 |
Enum a => Enum (Solo a) | |
Defined in GHC.Enum | |
Enum (Fixed a) | Recall that, for numeric types, succ (0.000 :: Milli) == 0.001 and likewise pred (0.000 :: Milli) == -0.001 In other words, succ (0.000000000000 :: Pico) == 0.000000000001 and similarly pred (0.000000000000 :: Pico) == -0.000000000001 This is worth bearing in mind when defining [1..10] :: [Pico] evaluates to However, this is not true. On the contrary, similarly to the above
implementations of [1.000000000000, 1.00000000001, 1.00000000002, ..., 10.000000000000] and contains Since: base-2.1 |
Enum (Proxy s) | Since: base-4.7.0.0 |
Enum a => Enum (Const a b) | Since: base-4.9.0.0 |
Defined in Data.Functor.Const Methods succ :: Const a b -> Const a b # pred :: Const a b -> Const a b # fromEnum :: Const a b -> Int # enumFrom :: Const a b -> [Const a b] # enumFromThen :: Const a b -> Const a b -> [Const a b] # enumFromTo :: Const a b -> Const a b -> [Const a b] # enumFromThenTo :: Const a b -> Const a b -> Const a b -> [Const a b] # | |
Enum (f a) => Enum (Ap f a) | Since: base-4.12.0.0 |
Defined in Data.Monoid | |
Coercible a b => Enum (Coercion a b) | Since: base-4.7.0.0 |
Defined in Data.Type.Coercion Methods succ :: Coercion a b -> Coercion a b # pred :: Coercion a b -> Coercion a b # toEnum :: Int -> Coercion a b # fromEnum :: Coercion a b -> Int # enumFrom :: Coercion a b -> [Coercion a b] # enumFromThen :: Coercion a b -> Coercion a b -> [Coercion a b] # enumFromTo :: Coercion a b -> Coercion a b -> [Coercion a b] # enumFromThenTo :: Coercion a b -> Coercion a b -> Coercion a b -> [Coercion a b] # | |
a ~ b => Enum (a :~: b) | Since: base-4.7.0.0 |
Defined in Data.Type.Equality Methods succ :: (a :~: b) -> a :~: b # pred :: (a :~: b) -> a :~: b # fromEnum :: (a :~: b) -> Int # enumFrom :: (a :~: b) -> [a :~: b] # enumFromThen :: (a :~: b) -> (a :~: b) -> [a :~: b] # enumFromTo :: (a :~: b) -> (a :~: b) -> [a :~: b] # enumFromThenTo :: (a :~: b) -> (a :~: b) -> (a :~: b) -> [a :~: b] # | |
a ~~ b => Enum (a :~~: b) | Since: base-4.10.0.0 |
Defined in Data.Type.Equality Methods succ :: (a :~~: b) -> a :~~: b # pred :: (a :~~: b) -> a :~~: b # fromEnum :: (a :~~: b) -> Int # enumFrom :: (a :~~: b) -> [a :~~: b] # enumFromThen :: (a :~~: b) -> (a :~~: b) -> [a :~~: b] # enumFromTo :: (a :~~: b) -> (a :~~: b) -> [a :~~: b] # enumFromThenTo :: (a :~~: b) -> (a :~~: b) -> (a :~~: b) -> [a :~~: b] # | |
Enum (f (g a)) => Enum (Compose f g a) | Since: base-4.19.0.0 |
Defined in Data.Functor.Compose Methods succ :: Compose f g a -> Compose f g a # pred :: Compose f g a -> Compose f g a # toEnum :: Int -> Compose f g a # fromEnum :: Compose f g a -> Int # enumFrom :: Compose f g a -> [Compose f g a] # enumFromThen :: Compose f g a -> Compose f g a -> [Compose f g a] # enumFromTo :: Compose f g a -> Compose f g a -> [Compose f g a] # enumFromThenTo :: Compose f g a -> Compose f g a -> Compose f g a -> [Compose f g a] # |
Conversion of values to readable String
s.
Derived instances of Show
have the following properties, which
are compatible with derived instances of Read
:
- The result of
show
is a syntactically correct Haskell expression containing only constants, given the fixity declarations in force at the point where the type is declared. It contains only the constructor names defined in the data type, parentheses, and spaces. When labelled constructor fields are used, braces, commas, field names, and equal signs are also used. - If the constructor is defined to be an infix operator, then
showsPrec
will produce infix applications of the constructor. - the representation will be enclosed in parentheses if the
precedence of the top-level constructor in
x
is less thand
(associativity is ignored). Thus, ifd
is0
then the result is never surrounded in parentheses; ifd
is11
it is always surrounded in parentheses, unless it is an atomic expression. - If the constructor is defined using record syntax, then
show
will produce the record-syntax form, with the fields given in the same order as the original declaration.
For example, given the declarations
infixr 5 :^: data Tree a = Leaf a | Tree a :^: Tree a
the derived instance of Show
is equivalent to
instance (Show a) => Show (Tree a) where showsPrec d (Leaf m) = showParen (d > app_prec) $ showString "Leaf " . showsPrec (app_prec+1) m where app_prec = 10 showsPrec d (u :^: v) = showParen (d > up_prec) $ showsPrec (up_prec+1) u . showString " :^: " . showsPrec (up_prec+1) v where up_prec = 5
Note that right-associativity of :^:
is ignored. For example,
produces the stringshow
(Leaf 1 :^: Leaf 2 :^: Leaf 3)"Leaf 1 :^: (Leaf 2 :^: Leaf 3)"
.
Methods
Arguments
:: Int | the operator precedence of the enclosing
context (a number from |
-> a | the value to be converted to a |
-> ShowS |
Convert a value to a readable String
.
showsPrec
should satisfy the law
showsPrec d x r ++ s == showsPrec d x (r ++ s)
Derived instances of Read
and Show
satisfy the following:
That is, readsPrec
parses the string produced by
showsPrec
, and delivers the value that showsPrec
started with.
Instances
Show NestedAtomically | Since: base-4.0 |
Defined in Control.Exception.Base Methods showsPrec :: Int -> NestedAtomically -> ShowS # show :: NestedAtomically -> String # showList :: [NestedAtomically] -> ShowS # | |
Show NoMatchingContinuationPrompt | Since: base-4.18 |
Defined in Control.Exception.Base Methods showsPrec :: Int -> NoMatchingContinuationPrompt -> ShowS # show :: NoMatchingContinuationPrompt -> String # showList :: [NoMatchingContinuationPrompt] -> ShowS # | |
Show NoMethodError | Since: base-4.0 |
Defined in Control.Exception.Base Methods showsPrec :: Int -> NoMethodError -> ShowS # show :: NoMethodError -> String # showList :: [NoMethodError] -> ShowS # | |
Show NonTermination | Since: base-4.0 |
Defined in Control.Exception.Base Methods showsPrec :: Int -> NonTermination -> ShowS # show :: NonTermination -> String # showList :: [NonTermination] -> ShowS # | |
Show PatternMatchFail | Since: base-4.0 |
Defined in Control.Exception.Base Methods showsPrec :: Int -> PatternMatchFail -> ShowS # show :: PatternMatchFail -> String # showList :: [PatternMatchFail] -> ShowS # | |
Show RecConError | Since: base-4.0 |
Defined in Control.Exception.Base Methods showsPrec :: Int -> RecConError -> ShowS # show :: RecConError -> String # showList :: [RecConError] -> ShowS # | |
Show RecSelError | Since: base-4.0 |
Defined in Control.Exception.Base Methods showsPrec :: Int -> RecSelError -> ShowS # show :: RecSelError -> String # showList :: [RecSelError] -> ShowS # | |
Show RecUpdError | Since: base-4.0 |
Defined in Control.Exception.Base Methods showsPrec :: Int -> RecUpdError -> ShowS # show :: RecUpdError -> String # showList :: [RecUpdError] -> ShowS # | |
Show TypeError | Since: base-4.9.0.0 |
Show ByteArray | Since: base-4.17.0.0 |
Show Constr | Since: base-4.0.0.0 |
Show ConstrRep | Since: base-4.0.0.0 |
Show DataRep | Since: base-4.0.0.0 |
Show DataType | Since: base-4.0.0.0 |
Show Fixity | Since: base-4.0.0.0 |
Show Dynamic | Since: base-2.1 |
Show SomeTypeRep | Since: base-4.10.0.0 |
Defined in Data.Typeable.Internal Methods showsPrec :: Int -> SomeTypeRep -> ShowS # show :: SomeTypeRep -> String # showList :: [SomeTypeRep] -> ShowS # | |
Show Version | Since: base-2.1 |
Show CBool | |
Show CChar | |
Show CClock | |
Show CDouble | |
Show CFloat | |
Show CInt | |
Show CIntMax | |
Show CIntPtr | |
Show CLLong | |
Show CLong | |
Show CPtrdiff | |
Show CSChar | |
Show CSUSeconds | |
Defined in Foreign.C.Types Methods showsPrec :: Int -> CSUSeconds -> ShowS # show :: CSUSeconds -> String # showList :: [CSUSeconds] -> ShowS # | |
Show CShort | |
Show CSigAtomic | |
Defined in Foreign.C.Types Methods showsPrec :: Int -> CSigAtomic -> ShowS # show :: CSigAtomic -> String # showList :: [CSigAtomic] -> ShowS # | |
Show CSize | |
Show CTime | |
Show CUChar | |
Show CUInt | |
Show CUIntMax | |
Show CUIntPtr | |
Show CULLong | |
Show CULong | |
Show CUSeconds | |
Show CUShort | |
Show CWchar | |
Show IntPtr | |
Show WordPtr | |
Show Void | Since: base-4.8.0.0 |
Show ByteOrder | Since: base-4.11.0.0 |
Show BlockReason | Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync Methods showsPrec :: Int -> BlockReason -> ShowS # show :: BlockReason -> String # showList :: [BlockReason] -> ShowS # | |
Show ThreadId | Since: base-4.2.0.0 |
Show ThreadStatus | Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync Methods showsPrec :: Int -> ThreadStatus -> ShowS # show :: ThreadStatus -> String # showList :: [ThreadStatus] -> ShowS # | |
Show ErrorCall | Since: base-4.0.0.0 |
Show ArithException | Since: base-4.0.0.0 |
Defined in GHC.Exception.Type Methods showsPrec :: Int -> ArithException -> ShowS # show :: ArithException -> String # showList :: [ArithException] -> ShowS # | |
Show SomeException | Since: base-3.0 |
Defined in GHC.Exception.Type Methods showsPrec :: Int -> SomeException -> ShowS # show :: SomeException -> String # showList :: [SomeException] -> ShowS # | |
Show Fingerprint | Since: base-4.7.0.0 |
Defined in GHC.Fingerprint.Type Methods showsPrec :: Int -> Fingerprint -> ShowS # show :: Fingerprint -> String # showList :: [Fingerprint] -> ShowS # | |
Show Associativity | Since: base-4.6.0.0 |
Defined in GHC.Generics Methods showsPrec :: Int -> Associativity -> ShowS # show :: Associativity -> String # showList :: [Associativity] -> ShowS # | |
Show DecidedStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods showsPrec :: Int -> DecidedStrictness -> ShowS # show :: DecidedStrictness -> String # showList :: [DecidedStrictness] -> ShowS # | |
Show Fixity | Since: base-4.6.0.0 |
Show SourceStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods showsPrec :: Int -> SourceStrictness -> ShowS # show :: SourceStrictness -> String # showList :: [SourceStrictness] -> ShowS # | |
Show SourceUnpackedness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods showsPrec :: Int -> SourceUnpackedness -> ShowS # show :: SourceUnpackedness -> String # showList :: [SourceUnpackedness] -> ShowS # | |
Show MaskingState | Since: base-4.3.0.0 |
Defined in GHC.IO Methods showsPrec :: Int -> MaskingState -> ShowS # show :: MaskingState -> String # showList :: [MaskingState] -> ShowS # | |
Show SeekMode | Since: base-4.2.0.0 |
Show CodingFailureMode | Since: base-4.4.0.0 |
Defined in GHC.IO.Encoding.Failure Methods showsPrec :: Int -> CodingFailureMode -> ShowS # show :: CodingFailureMode -> String # showList :: [CodingFailureMode] -> ShowS # | |
Show CodingProgress | Since: base-4.4.0.0 |
Defined in GHC.IO.Encoding.Types Methods showsPrec :: Int -> CodingProgress -> ShowS # show :: CodingProgress -> String # showList :: [CodingProgress] -> ShowS # | |
Show TextEncoding | Since: base-4.3.0.0 |
Defined in GHC.IO.Encoding.Types Methods showsPrec :: Int -> TextEncoding -> ShowS # show :: TextEncoding -> String # showList :: [TextEncoding] -> ShowS # | |
Show AllocationLimitExceeded | Since: base-4.7.1.0 |
Defined in GHC.IO.Exception Methods showsPrec :: Int -> AllocationLimitExceeded -> ShowS # show :: AllocationLimitExceeded -> String # showList :: [AllocationLimitExceeded] -> ShowS # | |
Show ArrayException | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception Methods showsPrec :: Int -> ArrayException -> ShowS # show :: ArrayException -> String # showList :: [ArrayException] -> ShowS # | |
Show AssertionFailed | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception Methods showsPrec :: Int -> AssertionFailed -> ShowS # show :: AssertionFailed -> String # showList :: [AssertionFailed] -> ShowS # | |
Show AsyncException | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception Methods showsPrec :: Int -> AsyncException -> ShowS # show :: AsyncException -> String # showList :: [AsyncException] -> ShowS # | |
Show BlockedIndefinitelyOnMVar | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception Methods showsPrec :: Int -> BlockedIndefinitelyOnMVar -> ShowS # show :: BlockedIndefinitelyOnMVar -> String # showList :: [BlockedIndefinitelyOnMVar] -> ShowS # | |
Show BlockedIndefinitelyOnSTM | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception Methods showsPrec :: Int -> BlockedIndefinitelyOnSTM -> ShowS # show :: BlockedIndefinitelyOnSTM -> String # showList :: [BlockedIndefinitelyOnSTM] -> ShowS # | |
Show CompactionFailed | Since: base-4.10.0.0 |
Defined in GHC.IO.Exception Methods showsPrec :: Int -> CompactionFailed -> ShowS # show :: CompactionFailed -> String # showList :: [CompactionFailed] -> ShowS # | |
Show Deadlock | Since: base-4.1.0.0 |
Show ExitCode | |
Show FixIOException | Since: base-4.11.0.0 |
Defined in GHC.IO.Exception Methods showsPrec :: Int -> FixIOException -> ShowS # show :: FixIOException -> String # showList :: [FixIOException] -> ShowS # | |
Show IOErrorType | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception Methods showsPrec :: Int -> IOErrorType -> ShowS # show :: IOErrorType -> String # showList :: [IOErrorType] -> ShowS # | |
Show IOException | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception Methods showsPrec :: Int -> IOException -> ShowS # show :: IOException -> String # showList :: [IOException] -> ShowS # | |
Show SomeAsyncException | Since: base-4.7.0.0 |
Defined in GHC.IO.Exception Methods showsPrec :: Int -> SomeAsyncException -> ShowS # show :: SomeAsyncException -> String # showList :: [SomeAsyncException] -> ShowS # | |
Show FD | Since: base-4.1.0.0 |
Show HandlePosn | Since: base-4.1.0.0 |
Defined in GHC.IO.Handle Methods showsPrec :: Int -> HandlePosn -> ShowS # show :: HandlePosn -> String # showList :: [HandlePosn] -> ShowS # | |
Show BufferMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types Methods showsPrec :: Int -> BufferMode -> ShowS # show :: BufferMode -> String # showList :: [BufferMode] -> ShowS # | |
Show Handle | Since: base-4.1.0.0 |
Show HandleType | Since: base-4.1.0.0 |
Defined in GHC.IO.Handle.Types Methods showsPrec :: Int -> HandleType -> ShowS # show :: HandleType -> String # showList :: [HandleType] -> ShowS # | |
Show Newline | Since: base-4.3.0.0 |
Show NewlineMode | Since: base-4.3.0.0 |
Defined in GHC.IO.Handle.Types Methods showsPrec :: Int -> NewlineMode -> ShowS # show :: NewlineMode -> String # showList :: [NewlineMode] -> ShowS # | |
Show IOMode | Since: base-4.2.0.0 |
Show IOPortException | |
Show InfoProv | |
Show Int16 | Since: base-2.1 |
Show Int32 | Since: base-2.1 |
Show Int64 | Since: base-2.1 |
Show Int8 | Since: base-2.1 |
Show CCFlags | Since: base-4.8.0.0 |
Show ConcFlags | Since: base-4.8.0.0 |
Show DebugFlags | Since: base-4.8.0.0 |
Defined in GHC.RTS.Flags Methods showsPrec :: Int -> DebugFlags -> ShowS # show :: DebugFlags -> String # showList :: [DebugFlags] -> ShowS # | |
Show DoCostCentres | Since: base-4.8.0.0 |
Defined in GHC.RTS.Flags Methods showsPrec :: Int -> DoCostCentres -> ShowS # show :: DoCostCentres -> String # showList :: [DoCostCentres] -> ShowS # | |
Show DoHeapProfile | Since: base-4.8.0.0 |
Defined in GHC.RTS.Flags Methods showsPrec :: Int -> DoHeapProfile -> ShowS # show :: DoHeapProfile -> String # showList :: [DoHeapProfile] -> ShowS # | |
Show DoTrace | Since: base-4.8.0.0 |
Show GCFlags | Since: base-4.8.0.0 |
Show GiveGCStats | Since: base-4.8.0.0 |
Defined in GHC.RTS.Flags Methods showsPrec :: Int -> GiveGCStats -> ShowS # show :: GiveGCStats -> String # showList :: [GiveGCStats] -> ShowS # | |
Show IoSubSystem | |
Defined in GHC.RTS.Flags Methods showsPrec :: Int -> IoSubSystem -> ShowS # show :: IoSubSystem -> String # showList :: [IoSubSystem] -> ShowS # | |
Show MiscFlags | Since: base-4.8.0.0 |
Show ParFlags | Since: base-4.8.0.0 |
Show ProfFlags | Since: base-4.8.0.0 |
Show RTSFlags | Since: base-4.8.0.0 |
Show TickyFlags | Since: base-4.8.0.0 |
Defined in GHC.RTS.Flags Methods showsPrec :: Int -> TickyFlags -> ShowS # show :: TickyFlags -> String # showList :: [TickyFlags] -> ShowS # | |
Show TraceFlags | Since: base-4.8.0.0 |
Defined in GHC.RTS.Flags Methods showsPrec :: Int -> TraceFlags -> ShowS # show :: TraceFlags -> String # showList :: [TraceFlags] -> ShowS # | |
Show FractionalExponentBase | |
Defined in GHC.Real Methods showsPrec :: Int -> FractionalExponentBase -> ShowS # show :: FractionalExponentBase -> String # showList :: [FractionalExponentBase] -> ShowS # | |
Show StackEntry | |
Defined in GHC.Stack.CloneStack Methods showsPrec :: Int -> StackEntry -> ShowS # show :: StackEntry -> String # showList :: [StackEntry] -> ShowS # | |
Show CallStack | Since: base-4.9.0.0 |
Show SrcLoc | Since: base-4.9.0.0 |
Show StaticPtrInfo | Since: base-4.8.0.0 |
Defined in GHC.StaticPtr Methods showsPrec :: Int -> StaticPtrInfo -> ShowS # show :: StaticPtrInfo -> String # showList :: [StaticPtrInfo] -> ShowS # | |
Show GCDetails | Since: base-4.10.0.0 |
Show RTSStats | Since: base-4.10.0.0 |
Show SomeChar | |
Show SomeSymbol | Since: base-4.7.0.0 |
Defined in GHC.TypeLits Methods showsPrec :: Int -> SomeSymbol -> ShowS # show :: SomeSymbol -> String # showList :: [SomeSymbol] -> ShowS # | |
Show SomeNat | Since: base-4.7.0.0 |
Show GeneralCategory | Since: base-2.1 |
Defined in GHC.Unicode Methods showsPrec :: Int -> GeneralCategory -> ShowS # show :: GeneralCategory -> String # showList :: [GeneralCategory] -> ShowS # | |
Show Word16 | Since: base-2.1 |
Show Word32 | Since: base-2.1 |
Show Word64 | Since: base-2.1 |
Show Word8 | Since: base-2.1 |
Show CBlkCnt | |
Show CBlkSize | |
Show CCc | |
Show CClockId | |
Show CDev | |
Show CFsBlkCnt | |
Show CFsFilCnt | |
Show CGid | |
Show CId | |
Show CIno | |
Show CKey | |
Show CMode | |
Show CNfds | |
Show CNlink | |
Show COff | |
Show CPid | |
Show CRLim | |
Show CSocklen | |
Show CSpeed | |
Show CSsize | |
Show CTcflag | |
Show CTimer | |
Show CUid | |
Show Fd | |
Show Timeout | Since: base-4.0 |
Show Lexeme | Since: base-2.1 |
Show Number | Since: base-4.6.0.0 |
Show FormatMode | |
Show ByteString | |
Defined in Data.ByteString.Internal.Type Methods showsPrec :: Int -> ByteString -> ShowS # show :: ByteString -> String # showList :: [ByteString] -> ShowS # | |
Show SizeOverflowException | |
Defined in Data.ByteString.Internal.Type Methods showsPrec :: Int -> SizeOverflowException -> ShowS # show :: SizeOverflowException -> String # showList :: [SizeOverflowException] -> ShowS # | |
Show ByteString | |
Defined in Data.ByteString.Lazy.Internal Methods showsPrec :: Int -> ByteString -> ShowS # show :: ByteString -> String # showList :: [ByteString] -> ShowS # | |
Show ShortByteString | |
Defined in Data.ByteString.Short.Internal Methods showsPrec :: Int -> ShortByteString -> ShowS # show :: ShortByteString -> String # showList :: [ShortByteString] -> ShowS # | |
Show IntSet | |
Show BitQueue | |
Show BitQueueB | |
Show KindRep | |
Show Module | Since: base-4.9.0.0 |
Show Ordering | Since: base-2.1 |
Show TrName | Since: base-4.9.0.0 |
Show TyCon | Since: base-2.1 |
Show TypeLitSort | Since: base-4.11.0.0 |
Defined in GHC.Show Methods showsPrec :: Int -> TypeLitSort -> ShowS # show :: TypeLitSort -> String # showList :: [TypeLitSort] -> ShowS # | |
Show AttrOpTag Source # | |
Show GType Source # | |
Show UnexpectedNullPointerReturn Source # | |
Defined in Data.GI.Base.BasicTypes Methods showsPrec :: Int -> UnexpectedNullPointerReturn -> ShowS # show :: UnexpectedNullPointerReturn -> String # showList :: [UnexpectedNullPointerReturn] -> ShowS # | |
Show GError Source # | |
Show GParamFlag Source # | |
Defined in Data.GI.Base.GParamSpec Methods showsPrec :: Int -> GParamFlag -> ShowS # show :: GParamFlag -> String # showList :: [GParamFlag] -> ShowS # | |
Show GVariantHandle Source # | |
Defined in Data.GI.Base.GVariant Methods showsPrec :: Int -> GVariantHandle -> ShowS # show :: GVariantHandle -> String # showList :: [GVariantHandle] -> ShowS # | |
Show GVariantObjectPath Source # | |
Defined in Data.GI.Base.GVariant Methods showsPrec :: Int -> GVariantObjectPath -> ShowS # show :: GVariantObjectPath -> String # showList :: [GVariantObjectPath] -> ShowS # | |
Show GVariantSignature Source # | |
Defined in Data.GI.Base.GVariant Methods showsPrec :: Int -> GVariantSignature -> ShowS # show :: GVariantSignature -> String # showList :: [GVariantSignature] -> ShowS # | |
Show ResolvedSymbolInfo Source # | |
Defined in Data.GI.Base.Overloading Methods showsPrec :: Int -> ResolvedSymbolInfo -> ShowS # show :: ResolvedSymbolInfo -> String # showList :: [ResolvedSymbolInfo] -> ShowS # | |
Show Mode | |
Show Style | |
Show TextDetails | |
Defined in Text.PrettyPrint.Annotated.HughesPJ Methods showsPrec :: Int -> TextDetails -> ShowS # show :: TextDetails -> String # showList :: [TextDetails] -> ShowS # | |
Show Doc | |
Show Decoding | |
Show UnicodeException | |
Defined in Data.Text.Encoding.Error Methods showsPrec :: Int -> UnicodeException -> ShowS # show :: UnicodeException -> String # showList :: [UnicodeException] -> ShowS # | |
Show I8 | |
Show Builder | |
Show PartialUtf8CodePoint | |
Show Utf8State | |
Show DecoderState | |
Defined in Data.Text.Internal.Encoding.Utf8 Methods showsPrec :: Int -> DecoderState -> ShowS # show :: DecoderState -> String # showList :: [DecoderState] -> ShowS # | |
Show Size | |
Show FPFormat | |
Show Iter | |
Show Integer | Since: base-2.1 |
Show Natural | Since: base-4.8.0.0 |
Show () | Since: base-2.1 |
Show Bool | Since: base-2.1 |
Show Char | Since: base-2.1 |
Show Int | Since: base-2.1 |
Show Levity | Since: base-4.15.0.0 |
Show RuntimeRep | Since: base-4.11.0.0 |
Defined in GHC.Show Methods showsPrec :: Int -> RuntimeRep -> ShowS # show :: RuntimeRep -> String # showList :: [RuntimeRep] -> ShowS # | |
Show VecCount | Since: base-4.11.0.0 |
Show VecElem | Since: base-4.11.0.0 |
Show Word | Since: base-2.1 |
Show a => Show (ZipList a) | Since: base-4.7.0.0 |
Show a => Show (And a) | Since: base-4.16 |
Show a => Show (Iff a) | Since: base-4.16 |
Show a => Show (Ior a) | Since: base-4.16 |
Show a => Show (Xor a) | Since: base-4.16 |
Show a => Show (Complex a) | Since: base-2.1 |
Show a => Show (Identity a) | This instance would be equivalent to the derived instances of the
Since: base-4.8.0.0 |
Show a => Show (First a) | Since: base-2.1 |
Show a => Show (Last a) | Since: base-2.1 |
Show a => Show (Down a) | This instance would be equivalent to the derived instances of the
Since: base-4.7.0.0 |
Show a => Show (First a) | Since: base-4.9.0.0 |
Show a => Show (Last a) | Since: base-4.9.0.0 |
Show a => Show (Max a) | Since: base-4.9.0.0 |
Show a => Show (Min a) | Since: base-4.9.0.0 |
Show m => Show (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods showsPrec :: Int -> WrappedMonoid m -> ShowS # show :: WrappedMonoid m -> String # showList :: [WrappedMonoid m] -> ShowS # | |
Show (ConstPtr a) | |
Show a => Show (NonEmpty a) | Since: base-4.11.0.0 |
Show (ForeignPtr a) | Since: base-2.1 |
Defined in GHC.ForeignPtr Methods showsPrec :: Int -> ForeignPtr a -> ShowS # show :: ForeignPtr a -> String # showList :: [ForeignPtr a] -> ShowS # | |
Show p => Show (Par1 p) | Since: base-4.7.0.0 |
Show (FunPtr a) | Since: base-2.1 |
Show (Ptr a) | Since: base-2.1 |
Show a => Show (Ratio a) | Since: base-2.0.1 |
Show (SChar c) | Since: base-4.18.0.0 |
Show (SSymbol s) | Since: base-4.18.0.0 |
Show (SNat n) | Since: base-4.18.0.0 |
Show vertex => Show (SCC vertex) | Since: containers-0.5.9 |
Show a => Show (IntMap a) | |
Show a => Show (Seq a) | |
Show a => Show (ViewL a) | |
Show a => Show (ViewR a) | |
Show a => Show (Intersection a) | |
Defined in Data.Set.Internal Methods showsPrec :: Int -> Intersection a -> ShowS # show :: Intersection a -> String # showList :: [Intersection a] -> ShowS # | |
Show a => Show (Set a) | |
Show a => Show (Tree a) | |
Show a => Show (GVariantSinglet a) Source # | |
Defined in Data.GI.Base.GVariant Methods showsPrec :: Int -> GVariantSinglet a -> ShowS # show :: GVariantSinglet a -> String # showList :: [GVariantSinglet a] -> ShowS # | |
Show a => Show (AnnotDetails a) | |
Defined in Text.PrettyPrint.Annotated.HughesPJ Methods showsPrec :: Int -> AnnotDetails a -> ShowS # show :: AnnotDetails a -> String # showList :: [AnnotDetails a] -> ShowS # | |
Show (Doc a) | |
Show a => Show (Span a) | |
Show a => Show (Maybe a) | Since: base-2.1 |
Show a => Show (Solo a) | Since: base-4.15 |
Show a => Show [a] | Since: base-2.1 |
(Show a, Show b) => Show (Either a b) | Since: base-3.0 |
HasResolution a => Show (Fixed a) | Since: base-2.1 |
Show (Proxy s) | Since: base-4.7.0.0 |
(Show a, Show b) => Show (Arg a b) | Since: base-4.9.0.0 |
Show (TypeRep a) | |
(Ix a, Show a, Show b) => Show (Array a b) | Since: base-2.1 |
Show (U1 p) | Since: base-4.9.0.0 |
Show (V1 p) | Since: base-4.9.0.0 |
Show (ST s a) | Since: base-2.1 |
(Show k, Show a) => Show (Map k a) | |
(Show key, Show value) => Show (GVariantDictEntry key value) Source # | |
Defined in Data.GI.Base.GVariant Methods showsPrec :: Int -> GVariantDictEntry key value -> ShowS # show :: GVariantDictEntry key value -> String # showList :: [GVariantDictEntry key value] -> ShowS # | |
(Show a, Show b) => Show (a, b) | Since: base-2.1 |
Show a => Show (Const a b) | This instance would be equivalent to the derived instances of the
Since: base-4.8.0.0 |
Show (f a) => Show (Ap f a) | Since: base-4.12.0.0 |
Show (Coercion a b) | Since: base-4.7.0.0 |
Show (a :~: b) | Since: base-4.7.0.0 |
Show (OrderingI a b) | |
Show (f p) => Show (Rec1 f p) | Since: base-4.7.0.0 |
Show (URec Char p) | Since: base-4.9.0.0 |
Show (URec Double p) | Since: base-4.9.0.0 |
Show (URec Float p) | |
Show (URec Int p) | Since: base-4.9.0.0 |
Show (URec Word p) | Since: base-4.9.0.0 |
(Show a, Show b, Show c) => Show (a, b, c) | Since: base-2.1 |
(Show (f a), Show (g a)) => Show (Product f g a) | Since: base-4.18.0.0 |
(Show (f a), Show (g a)) => Show (Sum f g a) | Since: base-4.18.0.0 |
Show (a :~~: b) | Since: base-4.10.0.0 |
(Show (f p), Show (g p)) => Show ((f :*: g) p) | Since: base-4.7.0.0 |
(Show (f p), Show (g p)) => Show ((f :+: g) p) | Since: base-4.7.0.0 |
Show c => Show (K1 i c p) | Since: base-4.7.0.0 |
(Show a, Show b, Show c, Show d) => Show (a, b, c, d) | Since: base-2.1 |
Show (f (g a)) => Show (Compose f g a) | Since: base-4.18.0.0 |
Show (f (g p)) => Show ((f :.: g) p) | Since: base-4.7.0.0 |
Show (f p) => Show (M1 i c f p) | Since: base-4.7.0.0 |
(Show a, Show b, Show c, Show d, Show e) => Show (a, b, c, d, e) | Since: base-2.1 |
(Show a, Show b, Show c, Show d, Show e, Show f) => Show (a, b, c, d, e, f) | Since: base-2.1 |
(Show a, Show b, Show c, Show d, Show e, Show f, Show g) => Show (a, b, c, d, e, f, g) | Since: base-2.1 |
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h) => Show (a, b, c, d, e, f, g, h) | Since: base-2.1 |
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i) => Show (a, b, c, d, e, f, g, h, i) | Since: base-2.1 |
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j) => Show (a, b, c, d, e, f, g, h, i, j) | Since: base-2.1 |
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k) => Show (a, b, c, d, e, f, g, h, i, j, k) | Since: base-2.1 |
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l) => Show (a, b, c, d, e, f, g, h, i, j, k, l) | Since: base-2.1 |
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m) | Since: base-2.1 |
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m, n) | Since: base-2.1 |
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) | Since: base-2.1 |
The Eq
class defines equality (==
) and inequality (/=
).
All the basic datatypes exported by the Prelude are instances of Eq
,
and Eq
may be derived for any datatype whose constituents are also
instances of Eq
.
The Haskell Report defines no laws for Eq
. However, instances are
encouraged to follow these properties:
Instances
Eq ByteArray | Since: base-4.17.0.0 |
Eq Constr | Equality of constructors Since: base-4.0.0.0 |
Eq ConstrRep | Since: base-4.0.0.0 |
Eq DataRep | Since: base-4.0.0.0 |
Eq Fixity | Since: base-4.0.0.0 |
Eq SomeTypeRep | |
Defined in Data.Typeable.Internal | |
Eq Unique | |
Eq Version | Since: base-2.1 |
Eq Errno | Since: base-2.1 |
Eq CBool | |
Eq CChar | |
Eq CClock | |
Eq CDouble | |
Eq CFloat | |
Eq CInt | |
Eq CIntMax | |
Eq CIntPtr | |
Eq CLLong | |
Eq CLong | |
Eq CPtrdiff | |
Eq CSChar | |
Eq CSUSeconds | |
Defined in Foreign.C.Types | |
Eq CShort | |
Eq CSigAtomic | |
Defined in Foreign.C.Types | |
Eq CSize | |
Eq CTime | |
Eq CUChar | |
Eq CUInt | |
Eq CUIntMax | |
Eq CUIntPtr | |
Eq CULLong | |
Eq CULong | |
Eq CUSeconds | |
Eq CUShort | |
Eq CWchar | |
Eq IntPtr | |
Eq WordPtr | |
Eq Void | Since: base-4.8.0.0 |
Eq ByteOrder | Since: base-4.11.0.0 |
Eq BlockReason | Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync | |
Eq ThreadId | Since: base-4.2.0.0 |
Eq ThreadStatus | Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync | |
Eq TimeoutKey | |
Defined in GHC.Event.TimeOut | |
Eq ErrorCall | Since: base-4.7.0.0 |
Eq ArithException | Since: base-3.0 |
Defined in GHC.Exception.Type Methods (==) :: ArithException -> ArithException -> Bool # (/=) :: ArithException -> ArithException -> Bool # | |
Eq SpecConstrAnnotation | Since: base-4.3.0.0 |
Defined in GHC.Exts Methods (==) :: SpecConstrAnnotation -> SpecConstrAnnotation -> Bool # (/=) :: SpecConstrAnnotation -> SpecConstrAnnotation -> Bool # | |
Eq Fingerprint | Since: base-4.4.0.0 |
Defined in GHC.Fingerprint.Type | |
Eq Associativity | Since: base-4.6.0.0 |
Defined in GHC.Generics Methods (==) :: Associativity -> Associativity -> Bool # (/=) :: Associativity -> Associativity -> Bool # | |
Eq DecidedStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods (==) :: DecidedStrictness -> DecidedStrictness -> Bool # (/=) :: DecidedStrictness -> DecidedStrictness -> Bool # | |
Eq Fixity | Since: base-4.6.0.0 |
Eq SourceStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods (==) :: SourceStrictness -> SourceStrictness -> Bool # (/=) :: SourceStrictness -> SourceStrictness -> Bool # | |
Eq SourceUnpackedness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods (==) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (/=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # | |
Eq MaskingState | Since: base-4.3.0.0 |
Defined in GHC.IO | |
Eq BufferState | Since: base-4.2.0.0 |
Defined in GHC.IO.Buffer | |
Eq IODeviceType | Since: base-4.2.0.0 |
Defined in GHC.IO.Device | |
Eq SeekMode | Since: base-4.2.0.0 |
Eq CodingProgress | Since: base-4.4.0.0 |
Defined in GHC.IO.Encoding.Types Methods (==) :: CodingProgress -> CodingProgress -> Bool # (/=) :: CodingProgress -> CodingProgress -> Bool # | |
Eq ArrayException | Since: base-4.2.0.0 |
Defined in GHC.IO.Exception Methods (==) :: ArrayException -> ArrayException -> Bool # (/=) :: ArrayException -> ArrayException -> Bool # | |
Eq AsyncException | Since: base-4.2.0.0 |
Defined in GHC.IO.Exception Methods (==) :: AsyncException -> AsyncException -> Bool # (/=) :: AsyncException -> AsyncException -> Bool # | |
Eq ExitCode | |
Eq IOErrorType | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception | |
Eq IOException | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception | |
Eq HandlePosn | Since: base-4.1.0.0 |
Defined in GHC.IO.Handle | |
Eq BufferMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types | |
Eq Handle | Since: base-4.1.0.0 |
Eq Newline | Since: base-4.2.0.0 |
Eq NewlineMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types | |
Eq IOMode | Since: base-4.2.0.0 |
Eq InfoProv | |
Eq Int16 | Since: base-2.1 |
Eq Int32 | Since: base-2.1 |
Eq Int64 | Since: base-2.1 |
Eq Int8 | Since: base-2.1 |
Eq IoSubSystem | |
Defined in GHC.RTS.Flags | |
Eq StackEntry | |
Defined in GHC.Stack.CloneStack | |
Eq SrcLoc | Since: base-4.9.0.0 |
Eq SomeChar | |
Eq SomeSymbol | Since: base-4.7.0.0 |
Defined in GHC.TypeLits | |
Eq SomeNat | Since: base-4.7.0.0 |
Eq GeneralCategory | Since: base-2.1 |
Defined in GHC.Unicode Methods (==) :: GeneralCategory -> GeneralCategory -> Bool # (/=) :: GeneralCategory -> GeneralCategory -> Bool # | |
Eq Word16 | Since: base-2.1 |
Eq Word32 | Since: base-2.1 |
Eq Word64 | Since: base-2.1 |
Eq Word8 | Since: base-2.1 |
Eq CBlkCnt | |
Eq CBlkSize | |
Eq CCc | |
Eq CClockId | |
Eq CDev | |
Eq CFsBlkCnt | |
Eq CFsFilCnt | |
Eq CGid | |
Eq CId | |
Eq CIno | |
Eq CKey | |
Eq CMode | |
Eq CNfds | |
Eq CNlink | |
Eq COff | |
Eq CPid | |
Eq CRLim | |
Eq CSocklen | |
Eq CSpeed | |
Eq CSsize | |
Eq CTcflag | |
Eq CTimer | |
Eq CUid | |
Eq Fd | |
Eq Timeout | |
Eq Lexeme | Since: base-2.1 |
Eq Number | Since: base-4.6.0.0 |
Eq ByteString | |
Defined in Data.ByteString.Internal.Type | |
Eq ByteString | |
Defined in Data.ByteString.Lazy.Internal | |
Eq ShortByteString | |
Defined in Data.ByteString.Short.Internal Methods (==) :: ShortByteString -> ShortByteString -> Bool # (/=) :: ShortByteString -> ShortByteString -> Bool # | |
Eq IntSet | |
Eq BigNat | |
Eq Module | |
Eq Ordering | |
Eq TrName | |
Eq TyCon | |
Eq AttrOpTag Source # | |
Eq GType Source # | |
Eq GParamFlag Source # | |
Defined in Data.GI.Base.GParamSpec | |
Eq GVariantHandle Source # | |
Defined in Data.GI.Base.GVariant Methods (==) :: GVariantHandle -> GVariantHandle -> Bool # (/=) :: GVariantHandle -> GVariantHandle -> Bool # | |
Eq GVariantObjectPath Source # | |
Defined in Data.GI.Base.GVariant Methods (==) :: GVariantObjectPath -> GVariantObjectPath -> Bool # (/=) :: GVariantObjectPath -> GVariantObjectPath -> Bool # | |
Eq GVariantSignature Source # | |
Defined in Data.GI.Base.GVariant Methods (==) :: GVariantSignature -> GVariantSignature -> Bool # (/=) :: GVariantSignature -> GVariantSignature -> Bool # | |
Eq Mode | |
Eq Style | |
Eq TextDetails | |
Defined in Text.PrettyPrint.Annotated.HughesPJ | |
Eq Doc | |
Eq UnicodeException | |
Defined in Data.Text.Encoding.Error Methods (==) :: UnicodeException -> UnicodeException -> Bool # (/=) :: UnicodeException -> UnicodeException -> Bool # | |
Eq I8 | |
Eq Builder | |
Eq PartialUtf8CodePoint | |
Eq Utf8State | |
Eq DecoderState | |
Defined in Data.Text.Internal.Encoding.Utf8 | |
Eq Size | |
Eq Integer | |
Eq Natural | |
Eq () | |
Eq Bool | |
Eq Char | |
Eq Double | Note that due to the presence of
Also note that
|
Eq Float | Note that due to the presence of
Also note that
|
Eq Int | |
Eq Word | |
Eq a => Eq (ZipList a) | Since: base-4.7.0.0 |
Eq (Chan a) | Since: base-4.4.0.0 |
Eq (MutableByteArray s) | Since: base-4.17.0.0 |
Defined in Data.Array.Byte Methods (==) :: MutableByteArray s -> MutableByteArray s -> Bool # (/=) :: MutableByteArray s -> MutableByteArray s -> Bool # | |
Eq a => Eq (And a) | Since: base-4.16 |
Eq a => Eq (Iff a) | Since: base-4.16 |
Eq a => Eq (Ior a) | Since: base-4.16 |
Eq a => Eq (Xor a) | Since: base-4.16 |
Eq a => Eq (Complex a) | Since: base-2.1 |
Eq a => Eq (Identity a) | Since: base-4.8.0.0 |
Eq a => Eq (First a) | Since: base-2.1 |
Eq a => Eq (Last a) | Since: base-2.1 |
Eq a => Eq (Down a) | Since: base-4.6.0.0 |
Eq a => Eq (First a) | Since: base-4.9.0.0 |
Eq a => Eq (Last a) | Since: base-4.9.0.0 |
Eq a => Eq (Max a) | Since: base-4.9.0.0 |
Eq a => Eq (Min a) | Since: base-4.9.0.0 |
Eq m => Eq (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods (==) :: WrappedMonoid m -> WrappedMonoid m -> Bool # (/=) :: WrappedMonoid m -> WrappedMonoid m -> Bool # | |
Eq (ConstPtr a) | |
Eq a => Eq (NonEmpty a) | Since: base-4.9.0.0 |
Eq (TVar a) | Since: base-4.8.0.0 |
Eq (ForeignPtr a) | Since: base-2.1 |
Defined in GHC.ForeignPtr | |
Eq p => Eq (Par1 p) | Since: base-4.7.0.0 |
Eq (IOPort a) | Since: base-4.1.0.0 |
Eq (IORef a) | Pointer equality. Since: base-4.0.0.0 |
Eq (MVar a) | Since: base-4.1.0.0 |
Eq (FunPtr a) | |
Eq (Ptr a) | Since: base-2.1 |
Eq a => Eq (Ratio a) | Since: base-2.1 |
Eq (StablePtr a) | Since: base-2.1 |
Eq (StableName a) | Since: base-2.1 |
Defined in GHC.StableName | |
Eq (SChar c) | Since: base-4.19.0.0 |
Eq (SSymbol s) | Since: base-4.19.0.0 |
Eq (SNat n) | Since: base-4.19.0.0 |
Eq vertex => Eq (SCC vertex) | Since: containers-0.5.9 |
Eq a => Eq (IntMap a) | |
Eq a => Eq (Seq a) | |
Eq a => Eq (ViewL a) | |
Eq a => Eq (ViewR a) | |
Eq a => Eq (Intersection a) | |
Defined in Data.Set.Internal Methods (==) :: Intersection a -> Intersection a -> Bool # (/=) :: Intersection a -> Intersection a -> Bool # | |
Eq a => Eq (Set a) | |
Eq a => Eq (Tree a) | |
Eq (ManagedPtr a) Source # | Two |
Defined in Data.GI.Base.BasicTypes | |
Eq a => Eq (GVariantSinglet a) Source # | |
Defined in Data.GI.Base.GVariant Methods (==) :: GVariantSinglet a -> GVariantSinglet a -> Bool # (/=) :: GVariantSinglet a -> GVariantSinglet a -> Bool # | |
Eq a => Eq (AnnotDetails a) | |
Defined in Text.PrettyPrint.Annotated.HughesPJ Methods (==) :: AnnotDetails a -> AnnotDetails a -> Bool # (/=) :: AnnotDetails a -> AnnotDetails a -> Bool # | |
Eq (Doc a) | |
Eq a => Eq (Span a) | |
Eq a => Eq (Stream a) | |
Eq a => Eq (Maybe a) | Since: base-2.1 |
Eq a => Eq (Solo a) | |
Eq a => Eq [a] | |
(Eq a, Eq b) => Eq (Either a b) | Since: base-2.1 |
Eq (Fixed a) | Since: base-2.1 |
Eq (Proxy s) | Since: base-4.7.0.0 |
Eq a => Eq (Arg a b) | Since: base-4.9.0.0 |
Eq (TypeRep a) | Since: base-2.1 |
(Ix i, Eq e) => Eq (Array i e) | Since: base-2.1 |
Eq (U1 p) | Since: base-4.9.0.0 |
Eq (V1 p) | Since: base-4.9.0.0 |
Eq (IOArray i e) | Since: base-4.1.0.0 |
Eq (STRef s a) | Pointer equality. Since: base-2.1 |
(Eq k, Eq a) => Eq (Map k a) | |
(Eq key, Eq value) => Eq (GVariantDictEntry key value) Source # | |
Defined in Data.GI.Base.GVariant Methods (==) :: GVariantDictEntry key value -> GVariantDictEntry key value -> Bool # (/=) :: GVariantDictEntry key value -> GVariantDictEntry key value -> Bool # | |
(Eq a, Eq b) => Eq (a, b) | |
Eq a => Eq (Const a b) | Since: base-4.9.0.0 |
Eq (f a) => Eq (Ap f a) | Since: base-4.12.0.0 |
Eq (Coercion a b) | Since: base-4.7.0.0 |
Eq (a :~: b) | Since: base-4.7.0.0 |
Eq (OrderingI a b) | |
Eq (STArray s i e) | Since: base-2.1 |
(Generic1 f, Eq (Rep1 f a)) => Eq (Generically1 f a) | Since: base-4.18.0.0 |
Defined in GHC.Generics Methods (==) :: Generically1 f a -> Generically1 f a -> Bool # (/=) :: Generically1 f a -> Generically1 f a -> Bool # | |
Eq (f p) => Eq (Rec1 f p) | Since: base-4.7.0.0 |
Eq (URec (Ptr ()) p) | Since: base-4.9.0.0 |
Eq (URec Char p) | Since: base-4.9.0.0 |
Eq (URec Double p) | Since: base-4.9.0.0 |
Eq (URec Float p) | |
Eq (URec Int p) | Since: base-4.9.0.0 |
Eq (URec Word p) | Since: base-4.9.0.0 |
(Eq a, Eq b, Eq c) => Eq (a, b, c) | |
(Eq (f a), Eq (g a)) => Eq (Product f g a) | Since: base-4.18.0.0 |
(Eq (f a), Eq (g a)) => Eq (Sum f g a) | Since: base-4.18.0.0 |
Eq (a :~~: b) | Since: base-4.10.0.0 |
(Eq (f p), Eq (g p)) => Eq ((f :*: g) p) | Since: base-4.7.0.0 |
(Eq (f p), Eq (g p)) => Eq ((f :+: g) p) | Since: base-4.7.0.0 |
Eq c => Eq (K1 i c p) | Since: base-4.7.0.0 |
(Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) | |
Eq (f (g a)) => Eq (Compose f g a) | Since: base-4.18.0.0 |
Eq (f (g p)) => Eq ((f :.: g) p) | Since: base-4.7.0.0 |
Eq (f p) => Eq (M1 i c f p) | Since: base-4.7.0.0 |
(Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (a, b, c, d, e, f, g) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => Eq (a, b, c, d, e, f, g, h) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i) => Eq (a, b, c, d, e, f, g, h, i) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j) => Eq (a, b, c, d, e, f, g, h, i, j) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k) => Eq (a, b, c, d, e, f, g, h, i, j, k) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l) => Eq (a, b, c, d, e, f, g, h, i, j, k, l) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) | |
A value of type
is a computation which, when performed,
does some I/O before returning a value of type IO
aa
.
There is really only one way to "perform" an I/O action: bind it to
Main.main
in your program. When your program is run, the I/O will
be performed. It isn't possible to perform I/O from an arbitrary
function, unless that function is itself in the IO
monad and called
at some point, directly or indirectly, from Main.main
.
IO
is a monad, so IO
actions can be combined using either the do-notation
or the >>
and >>=
operations from the Monad
class.
Instances
MonadFail IO | Since: base-4.9.0.0 |
Defined in Control.Monad.Fail | |
MonadFix IO | Since: base-2.1 |
Defined in Control.Monad.Fix | |
MonadIO IO | Since: base-4.9.0.0 |
Defined in Control.Monad.IO.Class | |
Alternative IO | Takes the first non-throwing Since: base-4.9.0.0 |
Applicative IO | Since: base-2.1 |
Functor IO | Since: base-2.1 |
Monad IO | Since: base-2.1 |
MonadPlus IO | Takes the first non-throwing Since: base-4.9.0.0 |
GHCiSandboxIO IO | Since: base-4.4.0.0 |
Defined in GHC.GHCi Methods ghciStepIO :: IO a -> IO a # | |
Monoid a => Monoid (IO a) | Since: base-4.9.0.0 |
Semigroup a => Semigroup (IO a) | Since: base-4.10.0.0 |
a ~ () => HPrintfType (IO a) | Since: base-4.7.0.0 |
Defined in Text.Printf | |
a ~ () => PrintfType (IO a) | Since: base-4.7.0.0 |
Defined in Text.Printf |
class Applicative m => Monad (m :: Type -> Type) where #
The Monad
class defines the basic operations over a monad,
a concept from a branch of mathematics known as category theory.
From the perspective of a Haskell programmer, however, it is best to
think of a monad as an abstract datatype of actions.
Haskell's do
expressions provide a convenient syntax for writing
monadic expressions.
Instances of Monad
should satisfy the following:
- Left identity
return
a>>=
k = k a- Right identity
m
>>=
return
= m- Associativity
m
>>=
(\x -> k x>>=
h) = (m>>=
k)>>=
h
Furthermore, the Monad
and Applicative
operations should relate as follows:
The above laws imply:
and that pure
and (<*>
) satisfy the applicative functor laws.
The instances of Monad
for lists, Maybe
and IO
defined in the Prelude satisfy these laws.
Minimal complete definition
Methods
(>>=) :: m a -> (a -> m b) -> m b infixl 1 #
Sequentially compose two actions, passing any value produced by the first as an argument to the second.
'as
' can be understood as the >>=
bsdo
expression
do a <- as bs a
(>>) :: m a -> m b -> m b infixl 1 #
Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in imperative languages.
'as
' can be understood as the >>
bsdo
expression
do as bs
Inject a value into the monadic type.
Instances
Monad Complex | Since: base-4.9.0.0 |
Monad Identity | Since: base-4.8.0.0 |
Monad First | Since: base-4.8.0.0 |
Monad Last | Since: base-4.8.0.0 |
Monad Down | Since: base-4.11.0.0 |
Monad First | Since: base-4.9.0.0 |
Monad Last | Since: base-4.9.0.0 |
Monad Max | Since: base-4.9.0.0 |
Monad Min | Since: base-4.9.0.0 |
Monad NonEmpty | Since: base-4.9.0.0 |
Monad STM | Since: base-4.3.0.0 |
Monad NoIO | Since: base-4.4.0.0 |
Monad Par1 | Since: base-4.9.0.0 |
Monad P | Since: base-2.1 |
Monad ReadP | Since: base-2.1 |
Monad ReadPrec | Since: base-2.1 |
Monad Put | |
Monad Seq | |
Monad Tree | |
Monad IO | Since: base-2.1 |
Monad Maybe | Since: base-2.1 |
Monad Solo | Since: base-4.15 |
Monad [] | Since: base-2.1 |
Monad m => Monad (WrappedMonad m) | Since: base-4.7.0.0 |
Defined in Control.Applicative Methods (>>=) :: WrappedMonad m a -> (a -> WrappedMonad m b) -> WrappedMonad m b # (>>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b # return :: a -> WrappedMonad m a # | |
ArrowApply a => Monad (ArrowMonad a) | Since: base-2.1 |
Defined in Control.Arrow Methods (>>=) :: ArrowMonad a a0 -> (a0 -> ArrowMonad a b) -> ArrowMonad a b # (>>) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a b # return :: a0 -> ArrowMonad a a0 # | |
Monad (Either e) | Since: base-4.4.0.0 |
Monad (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Monad (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Monad (ST s) | Since: base-2.1 |
Monad (SetM s) | |
Monad (IParser t) | |
Monoid a => Monad ((,) a) | Since: base-4.9.0.0 |
Monad m => Monad (Kleisli m a) | Since: base-4.14.0.0 |
Monad f => Monad (Ap f) | Since: base-4.12.0.0 |
Monad f => Monad (Rec1 f) | Since: base-4.9.0.0 |
(Applicative f, Monad f) => Monad (WhenMissing f x) | Equivalent to Since: containers-0.5.9 |
Defined in Data.IntMap.Internal Methods (>>=) :: WhenMissing f x a -> (a -> WhenMissing f x b) -> WhenMissing f x b # (>>) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x b # return :: a -> WhenMissing f x a # | |
(Monoid a, Monoid b) => Monad ((,,) a b) | Since: base-4.14.0.0 |
(Monad f, Monad g) => Monad (Product f g) | Since: base-4.9.0.0 |
(Monad f, Monad g) => Monad (f :*: g) | Since: base-4.9.0.0 |
(Monad f, Applicative f) => Monad (WhenMatched f x y) | Equivalent to Since: containers-0.5.9 |
Defined in Data.IntMap.Internal Methods (>>=) :: WhenMatched f x y a -> (a -> WhenMatched f x y b) -> WhenMatched f x y b # (>>) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y b # return :: a -> WhenMatched f x y a # | |
(Applicative f, Monad f) => Monad (WhenMissing f k x) | Equivalent to Since: containers-0.5.9 |
Defined in Data.Map.Internal Methods (>>=) :: WhenMissing f k x a -> (a -> WhenMissing f k x b) -> WhenMissing f k x b # (>>) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x b # return :: a -> WhenMissing f k x a # | |
(Monoid a, Monoid b, Monoid c) => Monad ((,,,) a b c) | Since: base-4.14.0.0 |
Monad ((->) r) | Since: base-2.1 |
Monad f => Monad (M1 i c f) | Since: base-4.9.0.0 |
(Monad f, Applicative f) => Monad (WhenMatched f k x y) | Equivalent to Since: containers-0.5.9 |
Defined in Data.Map.Internal Methods (>>=) :: WhenMatched f k x y a -> (a -> WhenMatched f k x y b) -> WhenMatched f k x y b # (>>) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y b # return :: a -> WhenMatched f k x y a # |
The Maybe
type encapsulates an optional value. A value of type
either contains a value of type Maybe
aa
(represented as
),
or it is empty (represented as Just
aNothing
). Using Maybe
is a good way to
deal with errors or exceptional cases without resorting to drastic
measures such as error
.
The Maybe
type is also a monad. It is a simple kind of error
monad, where all errors are represented by Nothing
. A richer
error monad can be built using the Either
type.
Instances
MonadFail Maybe | Since: base-4.9.0.0 | ||||
Defined in Control.Monad.Fail | |||||
MonadFix Maybe | Since: base-2.1 | ||||
Defined in Control.Monad.Fix | |||||
MonadZip Maybe | Since: base-4.8.0.0 | ||||
Foldable Maybe | Since: base-2.1 | ||||
Defined in Data.Foldable Methods fold :: Monoid m => Maybe m -> m # foldMap :: Monoid m => (a -> m) -> Maybe a -> m # foldMap' :: Monoid m => (a -> m) -> Maybe a -> m # foldr :: (a -> b -> b) -> b -> Maybe a -> b # foldr' :: (a -> b -> b) -> b -> Maybe a -> b # foldl :: (b -> a -> b) -> b -> Maybe a -> b # foldl' :: (b -> a -> b) -> b -> Maybe a -> b # foldr1 :: (a -> a -> a) -> Maybe a -> a # foldl1 :: (a -> a -> a) -> Maybe a -> a # elem :: Eq a => a -> Maybe a -> Bool # maximum :: Ord a => Maybe a -> a # minimum :: Ord a => Maybe a -> a # | |||||
Eq1 Maybe | Since: base-4.9.0.0 | ||||
Ord1 Maybe | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes | |||||
Read1 Maybe | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes | |||||
Show1 Maybe | Since: base-4.9.0.0 | ||||
Traversable Maybe | Since: base-2.1 | ||||
Alternative Maybe | Picks the leftmost Since: base-2.1 | ||||
Applicative Maybe | Since: base-2.1 | ||||
Functor Maybe | Since: base-2.1 | ||||
Monad Maybe | Since: base-2.1 | ||||
MonadPlus Maybe | Picks the leftmost Since: base-2.1 | ||||
Generic1 Maybe | |||||
Defined in GHC.Generics | |||||
Data a => Data (Maybe a) | Since: base-4.0.0.0 | ||||
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Maybe a -> c (Maybe a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Maybe a) # toConstr :: Maybe a -> Constr # dataTypeOf :: Maybe a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Maybe a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Maybe a)) # gmapT :: (forall b. Data b => b -> b) -> Maybe a -> Maybe a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Maybe a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Maybe a -> r # gmapQ :: (forall d. Data d => d -> u) -> Maybe a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Maybe a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a) # | |||||
Semigroup a => Monoid (Maybe a) | Lift a semigroup into Since 4.11.0: constraint on inner Since: base-2.1 | ||||
Semigroup a => Semigroup (Maybe a) | Since: base-4.9.0.0 | ||||
Generic (Maybe a) | |||||
Defined in GHC.Generics Associated Types
| |||||
SingKind a => SingKind (Maybe a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics Associated Types
| |||||
Read a => Read (Maybe a) | Since: base-2.1 | ||||
Show a => Show (Maybe a) | Since: base-2.1 | ||||
Eq a => Eq (Maybe a) | Since: base-2.1 | ||||
Ord a => Ord (Maybe a) | Since: base-2.1 | ||||
IsGValue (Maybe GParamSpec) Source # | |||||
Defined in Data.GI.Base.GValue Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe GParamSpec -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe GParamSpec) Source # | |||||
IsGValue (Maybe Text) Source # | |||||
IsGValue (Maybe String) Source # | |||||
IsGVariant a => IsGVariant (Maybe a) Source # | |||||
Defined in Data.GI.Base.GVariant | |||||
SingI ('Nothing :: Maybe a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
SingI a2 => SingI ('Just a2 :: Maybe a1) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
type Rep1 Maybe | Since: base-4.6.0.0 | ||||
type DemoteRep (Maybe a) | |||||
Defined in GHC.Generics | |||||
type Rep (Maybe a) | Since: base-4.6.0.0 | ||||
Defined in GHC.Generics | |||||
data Sing (b :: Maybe a) | |||||
(.) :: (b -> c) -> (a -> b) -> a -> c infixr 9 #
Right to left function composition.
(f . g) x = f (g x)
f . id = f = id . f
Examples
>>>
map ((*2) . length) [[], [0, 1, 2], [0]]
[0,6,2]
>>>
foldr (.) id [(+1), (*3), (^3)] 2
25
>>>
let (...) = (.).(.) in ((*2)...(+)) 5 10
30
($) :: (a -> b) -> a -> b infixr 0 #
is the function application operator.($)
Applying
to a function ($)
f
and an argument x
gives the same result as applying f
to x
directly. The definition is akin to this:
($) :: (a -> b) -> a -> b ($) f x = f x
This is
specialized from id
a -> a
to (a -> b) -> (a -> b)
which by the associativity of (->)
is the same as (a -> b) -> a -> b
.
On the face of it, this may appear pointless! But it's actually one of the most useful and important operators in Haskell.
The order of operations is very different between ($)
and normal function application. Normal function application has precedence 10 - higher than any operator - and associates to the left. So these two definitions are equivalent:
expr = min 5 1 + 5 expr = ((min 5) 1) + 5
($)
has precedence 0 (the lowest) and associates to the right, so these are equivalent:
expr = min 5 $ 1 + 5 expr = (min 5) (1 + 5)
Examples
A common use cases of ($)
is to avoid parentheses in complex expressions.
For example, instead of using nested parentheses in the following Haskell function:
-- | Sum numbers in a string: strSum "100 5 -7" == 98 strSum ::String
->Int
strSum s =sum
(mapMaybe
readMaybe
(words
s))
we can deploy the function application operator:
-- | Sum numbers in a string: strSum "100 5 -7" == 98 strSum ::String
->Int
strSum s =sum
$
mapMaybe
readMaybe
$
words
s
($)
is also used as a section (a partially applied operator), in order to indicate that we wish to apply some yet-unspecified function to a given value. For example, to apply the argument 5
to a list of functions:
applyFive :: [Int] applyFive = map ($ 5) [(+1), (2^)] >>> [6, 32]
Technical Remark (Representation Polymorphism)
($)
is fully representation-polymorphic. This allows it to also be used with arguments of unlifted and even unboxed kinds, such as unboxed integers:
fastMod :: Int -> Int -> Int fastMod (I# x) (I# m) = I# $ remInt# x m
(++) :: [a] -> [a] -> [a] infixr 5 #
(++)
appends two lists, i.e.,
[x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn] [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
If the first list is not finite, the result is the first list.
Performance considerations
This function takes linear time in the number of elements of the
first list. Thus it is better to associate repeated
applications of (++)
to the right (which is the default behaviour):
xs ++ (ys ++ zs)
or simply xs ++ ys ++ zs
, but not (xs ++ ys) ++ zs
.
For the same reason concat
=
foldr
(++)
[]
has linear performance, while foldl
(++)
[]
is prone
to quadratic slowdown
Examples
>>>
[1, 2, 3] ++ [4, 5, 6]
[1,2,3,4,5,6]
>>>
[] ++ [1, 2, 3]
[1,2,3]
>>>
[3, 2, 1] ++ []
[3,2,1]
(=<<) :: Monad m => (a -> m b) -> m a -> m b infixr 1 #
Same as >>=
, but with the arguments interchanged.
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c infixr 1 #
Left-to-right composition of Kleisli arrows.
'(bs
' can be understood as the >=>
cs) ado
expression
do b <- bs a cs b
Instances
Data Bool | Since: base-4.0.0.0 | ||||
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Bool -> c Bool # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Bool # dataTypeOf :: Bool -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Bool) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Bool) # gmapT :: (forall b. Data b => b -> b) -> Bool -> Bool # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Bool -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Bool -> r # gmapQ :: (forall d. Data d => d -> u) -> Bool -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Bool -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Bool -> m Bool # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Bool -> m Bool # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Bool -> m Bool # | |||||
Storable Bool | Since: base-2.1 | ||||
Defined in Foreign.Storable | |||||
Bits Bool | Interpret Since: base-4.7.0.0 | ||||
Defined in GHC.Bits Methods (.&.) :: Bool -> Bool -> Bool # (.|.) :: Bool -> Bool -> Bool # complement :: Bool -> Bool # shift :: Bool -> Int -> Bool # rotate :: Bool -> Int -> Bool # setBit :: Bool -> Int -> Bool # clearBit :: Bool -> Int -> Bool # complementBit :: Bool -> Int -> Bool # testBit :: Bool -> Int -> Bool # bitSizeMaybe :: Bool -> Maybe Int # shiftL :: Bool -> Int -> Bool # unsafeShiftL :: Bool -> Int -> Bool # shiftR :: Bool -> Int -> Bool # unsafeShiftR :: Bool -> Int -> Bool # rotateL :: Bool -> Int -> Bool # | |||||
FiniteBits Bool | Since: base-4.7.0.0 | ||||
Defined in GHC.Bits Methods finiteBitSize :: Bool -> Int # countLeadingZeros :: Bool -> Int # countTrailingZeros :: Bool -> Int # | |||||
Bounded Bool | Since: base-2.1 | ||||
Enum Bool | Since: base-2.1 | ||||
Generic Bool | |||||
Defined in GHC.Generics | |||||
SingKind Bool | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics Associated Types
| |||||
Ix Bool | Since: base-2.1 | ||||
Read Bool | Since: base-2.1 | ||||
Show Bool | Since: base-2.1 | ||||
Eq Bool | |||||
Ord Bool | |||||
IsGValue Bool Source # | |||||
Defined in Data.GI.Base.GValue | |||||
IsGVariant Bool Source # | |||||
Defined in Data.GI.Base.GVariant | |||||
IsGVariantBasicType Bool Source # | |||||
Defined in Data.GI.Base.GVariant | |||||
SingI 'False | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
SingI 'True | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
type DemoteRep Bool | |||||
Defined in GHC.Generics | |||||
type Rep Bool | Since: base-4.6.0.0 | ||||
data Sing (a :: Bool) | |||||
Single-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE single-precision type.
Instances
Data Float | Since: base-4.0.0.0 | ||||
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Float -> c Float # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Float # dataTypeOf :: Float -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Float) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Float) # gmapT :: (forall b. Data b => b -> b) -> Float -> Float # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Float -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Float -> r # gmapQ :: (forall d. Data d => d -> u) -> Float -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Float -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Float -> m Float # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Float -> m Float # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Float -> m Float # | |||||
Storable Float | Since: base-2.1 | ||||
Floating Float | Since: base-2.1 | ||||
RealFloat Float | Since: base-2.1 | ||||
Defined in GHC.Float Methods floatRadix :: Float -> Integer # floatDigits :: Float -> Int # floatRange :: Float -> (Int, Int) # decodeFloat :: Float -> (Integer, Int) # encodeFloat :: Integer -> Int -> Float # significand :: Float -> Float # scaleFloat :: Int -> Float -> Float # isInfinite :: Float -> Bool # isDenormalized :: Float -> Bool # isNegativeZero :: Float -> Bool # | |||||
Read Float | Since: base-2.1 | ||||
PrintfArg Float | Since: base-2.1 | ||||
Defined in Text.Printf | |||||
Eq Float | Note that due to the presence of
Also note that
| ||||
Ord Float | See | ||||
IsGValue Float Source # | |||||
Defined in Data.GI.Base.GValue | |||||
Generic1 (URec Float :: k -> Type) | |||||
Defined in GHC.Generics Associated Types
| |||||
Foldable (UFloat :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in Data.Foldable Methods fold :: Monoid m => UFloat m -> m # foldMap :: Monoid m => (a -> m) -> UFloat a -> m # foldMap' :: Monoid m => (a -> m) -> UFloat a -> m # foldr :: (a -> b -> b) -> b -> UFloat a -> b # foldr' :: (a -> b -> b) -> b -> UFloat a -> b # foldl :: (b -> a -> b) -> b -> UFloat a -> b # foldl' :: (b -> a -> b) -> b -> UFloat a -> b # foldr1 :: (a -> a -> a) -> UFloat a -> a # foldl1 :: (a -> a -> a) -> UFloat a -> a # elem :: Eq a => a -> UFloat a -> Bool # maximum :: Ord a => UFloat a -> a # minimum :: Ord a => UFloat a -> a # | |||||
Traversable (UFloat :: Type -> Type) | Since: base-4.9.0.0 | ||||
Functor (URec Float :: Type -> Type) | Since: base-4.9.0.0 | ||||
Generic (URec Float p) | |||||
Defined in GHC.Generics Associated Types
| |||||
Show (URec Float p) | |||||
Eq (URec Float p) | |||||
Ord (URec Float p) | |||||
Defined in GHC.Generics | |||||
data URec Float (p :: k) | Used for marking occurrences of Since: base-4.9.0.0 | ||||
type Rep1 (URec Float :: k -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
type Rep (URec Float p) | |||||
Defined in GHC.Generics |
Double-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE double-precision type.
Instances
Data Double | Since: base-4.0.0.0 | ||||
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Double -> c Double # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Double # toConstr :: Double -> Constr # dataTypeOf :: Double -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Double) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Double) # gmapT :: (forall b. Data b => b -> b) -> Double -> Double # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Double -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Double -> r # gmapQ :: (forall d. Data d => d -> u) -> Double -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Double -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Double -> m Double # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Double -> m Double # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Double -> m Double # | |||||
Storable Double | Since: base-2.1 | ||||
Floating Double | Since: base-2.1 | ||||
RealFloat Double | Since: base-2.1 | ||||
Defined in GHC.Float Methods floatRadix :: Double -> Integer # floatDigits :: Double -> Int # floatRange :: Double -> (Int, Int) # decodeFloat :: Double -> (Integer, Int) # encodeFloat :: Integer -> Int -> Double # significand :: Double -> Double # scaleFloat :: Int -> Double -> Double # isInfinite :: Double -> Bool # isDenormalized :: Double -> Bool # isNegativeZero :: Double -> Bool # | |||||
Read Double | Since: base-2.1 | ||||
PrintfArg Double | Since: base-2.1 | ||||
Defined in Text.Printf | |||||
Eq Double | Note that due to the presence of
Also note that
| ||||
Ord Double | IEEE 754 IEEE 754-2008, section 5.11 requires that if at least one of arguments of
IEEE 754-2008, section 5.10 defines Thus, users must be extremely cautious when using Moving further, the behaviour of IEEE 754-2008 compliant | ||||
IsGValue Double Source # | |||||
Defined in Data.GI.Base.GValue | |||||
IsGVariant Double Source # | |||||
Defined in Data.GI.Base.GVariant | |||||
IsGVariantBasicType Double Source # | |||||
Defined in Data.GI.Base.GVariant | |||||
Generic1 (URec Double :: k -> Type) | |||||
Defined in GHC.Generics Associated Types
| |||||
Foldable (UDouble :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in Data.Foldable Methods fold :: Monoid m => UDouble m -> m # foldMap :: Monoid m => (a -> m) -> UDouble a -> m # foldMap' :: Monoid m => (a -> m) -> UDouble a -> m # foldr :: (a -> b -> b) -> b -> UDouble a -> b # foldr' :: (a -> b -> b) -> b -> UDouble a -> b # foldl :: (b -> a -> b) -> b -> UDouble a -> b # foldl' :: (b -> a -> b) -> b -> UDouble a -> b # foldr1 :: (a -> a -> a) -> UDouble a -> a # foldl1 :: (a -> a -> a) -> UDouble a -> a # elem :: Eq a => a -> UDouble a -> Bool # maximum :: Ord a => UDouble a -> a # minimum :: Ord a => UDouble a -> a # | |||||
Traversable (UDouble :: Type -> Type) | Since: base-4.9.0.0 | ||||
Functor (URec Double :: Type -> Type) | Since: base-4.9.0.0 | ||||
Generic (URec Double p) | |||||
Defined in GHC.Generics Associated Types
| |||||
Show (URec Double p) | Since: base-4.9.0.0 | ||||
Eq (URec Double p) | Since: base-4.9.0.0 | ||||
Ord (URec Double p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics Methods compare :: URec Double p -> URec Double p -> Ordering # (<) :: URec Double p -> URec Double p -> Bool # (<=) :: URec Double p -> URec Double p -> Bool # (>) :: URec Double p -> URec Double p -> Bool # (>=) :: URec Double p -> URec Double p -> Bool # | |||||
data URec Double (p :: k) | Used for marking occurrences of Since: base-4.9.0.0 | ||||
type Rep1 (URec Double :: k -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
type Rep (URec Double p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics |
undefined :: HasCallStack => a #
error :: HasCallStack => [Char] -> a #
error
stops execution and displays an error message.
map :: (a -> b) -> [a] -> [b] #
\(\mathcal{O}(n)\). map
f xs
is the list obtained by applying f
to
each element of xs
, i.e.,
map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] map f [x1, x2, ...] == [f x1, f x2, ...]
this means that map id == id
Examples
>>>
map (+1) [1, 2, 3]
[2,3,4]
>>>
map id [1, 2, 3]
[1,2,3]
>>>
map (\n -> 3 * n + 1) [1, 2, 3]
[4,7,10]
length :: Foldable t => t a -> Int #
Returns the size/length of a finite structure as an Int
. The
default implementation just counts elements starting with the leftmost.
Instances for structures that can compute the element count faster
than via element-by-element counting, should provide a specialised
implementation.
Examples
Basic usage:
>>>
length []
0
>>>
length ['a', 'b', 'c']
3>>>
length [1..]
* Hangs forever *
Since: base-4.8.0.0
mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) #
Map each element of a structure to a monadic action, evaluate
these actions from left to right, and collect the results. For
a version that ignores the results see mapM_
.
Examples
when :: Applicative f => Bool -> f () -> f () #
Conditional execution of Applicative
expressions. For example,
when debug (putStrLn "Debugging")
will output the string Debugging
if the Boolean value debug
is True
, and otherwise do nothing.
fromIntegral :: (Integral a, Num b) => a -> b #
General coercion from Integral
types.
WARNING: This function performs silent truncation if the result type is not at least as big as the argument's type.
realToFrac :: (Real a, Fractional b) => a -> b #
General coercion to Fractional
types.
WARNING: This function goes through the Rational
type, which does not have values for NaN
for example.
This means it does not round-trip.
For Double
it also behaves differently with or without -O0:
Prelude> realToFrac nan -- With -O0 -Infinity Prelude> realToFrac nan NaN