| 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 CUIntPtr = CUIntPtr Word64
- newtype CIntPtr = CIntPtr Int64
- newtype CDouble = CDouble Double
- newtype CFloat = CFloat Float
- newtype CULong = CULong Word64
- newtype CLong = CLong Int64
- newtype CUInt = CUInt Word32
- newtype CInt = CInt Int32
- type CString = Ptr CChar
- data Ptr a
- data FunPtr a
- nullPtr :: Ptr 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
- (:!<~) :: forall obj info (attr :: Symbol) (tag1 :: AttrOpTag) b model (tag :: AttrOpTag). (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag1 info obj, AttrSetTypeConstraint info b, ?_haskell_gi_modelProxy :: ModelProxy model) => AttrLabelProxy attr -> DynVal model b -> AttrOp obj tag
- (:<~) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b model. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrSetTypeConstraint info b, AttrOpAllowed 'AttrGet info obj, EqMaybe b (AttrGetType info), ?_haskell_gi_modelProxy :: ModelProxy model) => AttrLabelProxy attr -> DynVal model b -> AttrOp obj tag
- Bind :: forall obj info (propName :: Symbol) (tag :: AttrOpTag) model outType (components :: [Symbol]) (fieldName :: Symbol). (HasAttributeList obj, GObject obj, info ~ ResolveAttribute propName obj, AttrInfo info, KnownSymbol (AttrLabel info), AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrOpAllowed 'AttrPut info obj, ?_haskell_gi_modelProxy :: ModelProxy model, outType ~ AttrGetType info, AttrSetTypeConstraint info outType, components ~ Components fieldName, PathFieldAccess components model outType, KnownSymbol fieldName, Eq outType) => AttrLabelProxy propName -> AttrLabelProxy fieldName -> 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)
- attrPut :: AttrBaseTypeConstraint info o => o -> AttrGetType info -> IO ()
- 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
- bindPropToField :: forall o info (prop :: Symbol) (field :: Symbol) model outType (tag :: AttrOpTag) (components :: [Symbol]). (HasAttributeList o, GObject o, info ~ ResolveAttribute prop o, AttrInfo info, KnownSymbol (AttrLabel info), AttrBaseTypeConstraint info o, AttrOpAllowed tag info o, AttrOpAllowed 'AttrPut info o, ?_haskell_gi_modelProxy :: ModelProxy model, outType ~ AttrGetType info, AttrSetTypeConstraint info outType, components ~ Components field, PathFieldAccess components model outType, KnownSymbol field, Eq outType) => Proxy tag -> o -> AttrLabelProxy prop -> AttrLabelProxy field -> IO ()
- class EqMaybe a b where
- type family AttrLabel info :: Symbol
- type family AttrGetType info
- type family AttrBaseTypeConstraint info :: Type -> Constraint
- type family AttrAllowedOps info :: [AttrOpTag]
- 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
- class a ~# b => (a :: k) ~ (b :: k)
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
| IsChar Char | Since: base-2.1 | ||||
| PrintfArg Char | Since: base-2.1 | ||||
Defined in Text.Printf | |||||
| Bounded Char | Since: base-2.1 | ||||
| Enum Char | Since: base-2.1 | ||||
| Storable Char | Since: base-2.1 | ||||
Defined in GHC.Internal.Foreign.Storable Methods sizeOf :: Char -> Int Source # alignment :: Char -> Int Source # peekElemOff :: Ptr Char -> Int -> IO Char Source # pokeElemOff :: Ptr Char -> Int -> Char -> IO () Source # peekByteOff :: Ptr b -> Int -> IO Char Source # pokeByteOff :: Ptr b -> Int -> Char -> IO () Source # | |||||
| Show Char | Since: base-2.1 | ||||
| Eq Char | |||||
| Ord Char | |||||
| TestCoercion SChar | Since: base-4.18.0.0 | ||||
Defined in GHC.Internal.TypeLits | |||||
| TestEquality SChar | Since: base-4.18.0.0 | ||||
Defined in GHC.Internal.TypeLits | |||||
| Generic1 (URec Char :: k -> Type) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Foldable (UChar :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => UChar m -> m Source # foldMap :: Monoid m => (a -> m) -> UChar a -> m Source # foldMap' :: Monoid m => (a -> m) -> UChar a -> m Source # foldr :: (a -> b -> b) -> b -> UChar a -> b Source # foldr' :: (a -> b -> b) -> b -> UChar a -> b Source # foldl :: (b -> a -> b) -> b -> UChar a -> b Source # foldl' :: (b -> a -> b) -> b -> UChar a -> b Source # foldr1 :: (a -> a -> a) -> UChar a -> a Source # foldl1 :: (a -> a -> a) -> UChar a -> a Source # toList :: UChar a -> [a] Source # null :: UChar a -> Bool Source # length :: UChar a -> Int Source # elem :: Eq a => a -> UChar a -> Bool Source # maximum :: Ord a => UChar a -> a Source # minimum :: Ord a => UChar a -> a Source # | |||||
| Traversable (UChar :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Traversable | |||||
| IsGValue (Maybe String) Source # | |||||
| Functor (URec Char :: Type -> Type) | Since: base-4.9.0.0 | ||||
| Generic (URec Char p) | |||||
Defined in GHC.Internal.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.Internal.Generics Methods compare :: URec Char p -> URec Char p -> Ordering Source # (<) :: URec Char p -> URec Char p -> Bool Source # (<=) :: URec Char p -> URec Char p -> Bool Source # (>) :: URec Char p -> URec Char p -> Bool Source # (>=) :: URec Char p -> URec Char p -> Bool Source # | |||||
| data URec Char (p :: k) | Used for marking occurrences of Since: base-4.9.0.0 | ||||
| type Rep1 (URec Char :: k -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| type Rep (URec Char p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
module Data.Int
8-bit unsigned integer type
Instances
64-bit unsigned integer type
Instances
32-bit unsigned integer type
Instances
16-bit unsigned integer type
Instances
data ByteString Source #
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
Instances
| Bits CUIntPtr | |
Defined in GHC.Internal.Foreign.C.Types Methods (.&.) :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # (.|.) :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # xor :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # complement :: CUIntPtr -> CUIntPtr Source # shift :: CUIntPtr -> Int -> CUIntPtr Source # rotate :: CUIntPtr -> Int -> CUIntPtr Source # bit :: Int -> CUIntPtr Source # setBit :: CUIntPtr -> Int -> CUIntPtr Source # clearBit :: CUIntPtr -> Int -> CUIntPtr Source # complementBit :: CUIntPtr -> Int -> CUIntPtr Source # testBit :: CUIntPtr -> Int -> Bool Source # bitSizeMaybe :: CUIntPtr -> Maybe Int Source # bitSize :: CUIntPtr -> Int Source # isSigned :: CUIntPtr -> Bool Source # shiftL :: CUIntPtr -> Int -> CUIntPtr Source # unsafeShiftL :: CUIntPtr -> Int -> CUIntPtr Source # shiftR :: CUIntPtr -> Int -> CUIntPtr Source # unsafeShiftR :: CUIntPtr -> Int -> CUIntPtr Source # rotateL :: CUIntPtr -> Int -> CUIntPtr Source # | |
| FiniteBits CUIntPtr | |
Defined in GHC.Internal.Foreign.C.Types Methods finiteBitSize :: CUIntPtr -> Int Source # countLeadingZeros :: CUIntPtr -> Int Source # countTrailingZeros :: CUIntPtr -> Int Source # | |
| Bounded CUIntPtr | |
| Enum CUIntPtr | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CUIntPtr -> CUIntPtr Source # pred :: CUIntPtr -> CUIntPtr Source # toEnum :: Int -> CUIntPtr Source # fromEnum :: CUIntPtr -> Int Source # enumFrom :: CUIntPtr -> [CUIntPtr] Source # enumFromThen :: CUIntPtr -> CUIntPtr -> [CUIntPtr] Source # enumFromTo :: CUIntPtr -> CUIntPtr -> [CUIntPtr] Source # enumFromThenTo :: CUIntPtr -> CUIntPtr -> CUIntPtr -> [CUIntPtr] Source # | |
| Storable CUIntPtr | |
Defined in GHC.Internal.Foreign.C.Types Methods sizeOf :: CUIntPtr -> Int Source # alignment :: CUIntPtr -> Int Source # peekElemOff :: Ptr CUIntPtr -> Int -> IO CUIntPtr Source # pokeElemOff :: Ptr CUIntPtr -> Int -> CUIntPtr -> IO () Source # peekByteOff :: Ptr b -> Int -> IO CUIntPtr Source # pokeByteOff :: Ptr b -> Int -> CUIntPtr -> IO () Source # | |
| Ix CUIntPtr | |
Defined in GHC.Internal.Foreign.C.Types | |
| Num CUIntPtr | |
Defined in GHC.Internal.Foreign.C.Types Methods (+) :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # (-) :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # (*) :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # negate :: CUIntPtr -> CUIntPtr Source # abs :: CUIntPtr -> CUIntPtr Source # signum :: CUIntPtr -> CUIntPtr Source # fromInteger :: Integer -> CUIntPtr Source # | |
| Read CUIntPtr | |
| Integral CUIntPtr | |
Defined in GHC.Internal.Foreign.C.Types Methods quot :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # rem :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # div :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # mod :: CUIntPtr -> CUIntPtr -> CUIntPtr Source # quotRem :: CUIntPtr -> CUIntPtr -> (CUIntPtr, CUIntPtr) Source # divMod :: CUIntPtr -> CUIntPtr -> (CUIntPtr, CUIntPtr) Source # | |
| Real CUIntPtr | |
Defined in GHC.Internal.Foreign.C.Types Methods toRational :: CUIntPtr -> Rational Source # | |
| Show CUIntPtr | |
| Eq CUIntPtr | |
| Ord CUIntPtr | |
Defined in GHC.Internal.Foreign.C.Types | |
Instances
| Bits CIntPtr | |
Defined in GHC.Internal.Foreign.C.Types Methods (.&.) :: CIntPtr -> CIntPtr -> CIntPtr Source # (.|.) :: CIntPtr -> CIntPtr -> CIntPtr Source # xor :: CIntPtr -> CIntPtr -> CIntPtr Source # complement :: CIntPtr -> CIntPtr Source # shift :: CIntPtr -> Int -> CIntPtr Source # rotate :: CIntPtr -> Int -> CIntPtr Source # bit :: Int -> CIntPtr Source # setBit :: CIntPtr -> Int -> CIntPtr Source # clearBit :: CIntPtr -> Int -> CIntPtr Source # complementBit :: CIntPtr -> Int -> CIntPtr Source # testBit :: CIntPtr -> Int -> Bool Source # bitSizeMaybe :: CIntPtr -> Maybe Int Source # bitSize :: CIntPtr -> Int Source # isSigned :: CIntPtr -> Bool Source # shiftL :: CIntPtr -> Int -> CIntPtr Source # unsafeShiftL :: CIntPtr -> Int -> CIntPtr Source # shiftR :: CIntPtr -> Int -> CIntPtr Source # unsafeShiftR :: CIntPtr -> Int -> CIntPtr Source # rotateL :: CIntPtr -> Int -> CIntPtr Source # | |
| FiniteBits CIntPtr | |
Defined in GHC.Internal.Foreign.C.Types Methods finiteBitSize :: CIntPtr -> Int Source # countLeadingZeros :: CIntPtr -> Int Source # countTrailingZeros :: CIntPtr -> Int Source # | |
| Bounded CIntPtr | |
| Enum CIntPtr | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CIntPtr -> CIntPtr Source # pred :: CIntPtr -> CIntPtr Source # toEnum :: Int -> CIntPtr Source # fromEnum :: CIntPtr -> Int Source # enumFrom :: CIntPtr -> [CIntPtr] Source # enumFromThen :: CIntPtr -> CIntPtr -> [CIntPtr] Source # enumFromTo :: CIntPtr -> CIntPtr -> [CIntPtr] Source # enumFromThenTo :: CIntPtr -> CIntPtr -> CIntPtr -> [CIntPtr] Source # | |
| Storable CIntPtr | |
Defined in GHC.Internal.Foreign.C.Types Methods sizeOf :: CIntPtr -> Int Source # alignment :: CIntPtr -> Int Source # peekElemOff :: Ptr CIntPtr -> Int -> IO CIntPtr Source # pokeElemOff :: Ptr CIntPtr -> Int -> CIntPtr -> IO () Source # peekByteOff :: Ptr b -> Int -> IO CIntPtr Source # pokeByteOff :: Ptr b -> Int -> CIntPtr -> IO () Source # | |
| Ix CIntPtr | |
Defined in GHC.Internal.Foreign.C.Types | |
| Num CIntPtr | |
Defined in GHC.Internal.Foreign.C.Types | |
| Read CIntPtr | |
| Integral CIntPtr | |
Defined in GHC.Internal.Foreign.C.Types Methods quot :: CIntPtr -> CIntPtr -> CIntPtr Source # rem :: CIntPtr -> CIntPtr -> CIntPtr Source # div :: CIntPtr -> CIntPtr -> CIntPtr Source # mod :: CIntPtr -> CIntPtr -> CIntPtr Source # quotRem :: CIntPtr -> CIntPtr -> (CIntPtr, CIntPtr) Source # | |
| Real CIntPtr | |
Defined in GHC.Internal.Foreign.C.Types Methods toRational :: CIntPtr -> Rational Source # | |
| Show CIntPtr | |
| Eq CIntPtr | |
| Ord CIntPtr | |
Defined in GHC.Internal.Foreign.C.Types | |
Haskell type representing the C double type.
(The concrete types of Foreign.C.Types are platform-specific.)
Instances
| Enum CDouble | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CDouble -> CDouble Source # pred :: CDouble -> CDouble Source # toEnum :: Int -> CDouble Source # fromEnum :: CDouble -> Int Source # enumFrom :: CDouble -> [CDouble] Source # enumFromThen :: CDouble -> CDouble -> [CDouble] Source # enumFromTo :: CDouble -> CDouble -> [CDouble] Source # enumFromThenTo :: CDouble -> CDouble -> CDouble -> [CDouble] Source # | |
| Floating CDouble | |
Defined in GHC.Internal.Foreign.C.Types Methods exp :: CDouble -> CDouble Source # log :: CDouble -> CDouble Source # sqrt :: CDouble -> CDouble Source # (**) :: CDouble -> CDouble -> CDouble Source # logBase :: CDouble -> CDouble -> CDouble Source # sin :: CDouble -> CDouble Source # cos :: CDouble -> CDouble Source # tan :: CDouble -> CDouble Source # asin :: CDouble -> CDouble Source # acos :: CDouble -> CDouble Source # atan :: CDouble -> CDouble Source # sinh :: CDouble -> CDouble Source # cosh :: CDouble -> CDouble Source # tanh :: CDouble -> CDouble Source # asinh :: CDouble -> CDouble Source # acosh :: CDouble -> CDouble Source # atanh :: CDouble -> CDouble Source # log1p :: CDouble -> CDouble Source # expm1 :: CDouble -> CDouble Source # | |
| RealFloat CDouble | |
Defined in GHC.Internal.Foreign.C.Types Methods floatRadix :: CDouble -> Integer Source # floatDigits :: CDouble -> Int Source # floatRange :: CDouble -> (Int, Int) Source # decodeFloat :: CDouble -> (Integer, Int) Source # encodeFloat :: Integer -> Int -> CDouble Source # exponent :: CDouble -> Int Source # significand :: CDouble -> CDouble Source # scaleFloat :: Int -> CDouble -> CDouble Source # isNaN :: CDouble -> Bool Source # isInfinite :: CDouble -> Bool Source # isDenormalized :: CDouble -> Bool Source # isNegativeZero :: CDouble -> Bool Source # | |
| Storable CDouble | |
Defined in GHC.Internal.Foreign.C.Types Methods sizeOf :: CDouble -> Int Source # alignment :: CDouble -> Int Source # peekElemOff :: Ptr CDouble -> Int -> IO CDouble Source # pokeElemOff :: Ptr CDouble -> Int -> CDouble -> IO () Source # peekByteOff :: Ptr b -> Int -> IO CDouble Source # pokeByteOff :: Ptr b -> Int -> CDouble -> IO () Source # | |
| Num CDouble | |
Defined in GHC.Internal.Foreign.C.Types | |
| Read CDouble | |
| Fractional CDouble | |
| Real CDouble | |
Defined in GHC.Internal.Foreign.C.Types Methods toRational :: CDouble -> Rational Source # | |
| RealFrac CDouble | |
| Show CDouble | |
| Eq CDouble | |
| Ord CDouble | |
Defined in GHC.Internal.Foreign.C.Types | |
Haskell type representing the C float type.
(The concrete types of Foreign.C.Types are platform-specific.)
Instances
| Enum CFloat | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CFloat -> CFloat Source # pred :: CFloat -> CFloat Source # toEnum :: Int -> CFloat Source # fromEnum :: CFloat -> Int Source # enumFrom :: CFloat -> [CFloat] Source # enumFromThen :: CFloat -> CFloat -> [CFloat] Source # enumFromTo :: CFloat -> CFloat -> [CFloat] Source # enumFromThenTo :: CFloat -> CFloat -> CFloat -> [CFloat] Source # | |
| Floating CFloat | |
Defined in GHC.Internal.Foreign.C.Types Methods exp :: CFloat -> CFloat Source # log :: CFloat -> CFloat Source # sqrt :: CFloat -> CFloat Source # (**) :: CFloat -> CFloat -> CFloat Source # logBase :: CFloat -> CFloat -> CFloat Source # sin :: CFloat -> CFloat Source # cos :: CFloat -> CFloat Source # tan :: CFloat -> CFloat Source # asin :: CFloat -> CFloat Source # acos :: CFloat -> CFloat Source # atan :: CFloat -> CFloat Source # sinh :: CFloat -> CFloat Source # cosh :: CFloat -> CFloat Source # tanh :: CFloat -> CFloat Source # asinh :: CFloat -> CFloat Source # acosh :: CFloat -> CFloat Source # atanh :: CFloat -> CFloat Source # log1p :: CFloat -> CFloat Source # expm1 :: CFloat -> CFloat Source # | |
| RealFloat CFloat | |
Defined in GHC.Internal.Foreign.C.Types Methods floatRadix :: CFloat -> Integer Source # floatDigits :: CFloat -> Int Source # floatRange :: CFloat -> (Int, Int) Source # decodeFloat :: CFloat -> (Integer, Int) Source # encodeFloat :: Integer -> Int -> CFloat Source # exponent :: CFloat -> Int Source # significand :: CFloat -> CFloat Source # scaleFloat :: Int -> CFloat -> CFloat Source # isNaN :: CFloat -> Bool Source # isInfinite :: CFloat -> Bool Source # isDenormalized :: CFloat -> Bool Source # isNegativeZero :: CFloat -> Bool Source # | |
| Storable CFloat | |
Defined in GHC.Internal.Foreign.C.Types Methods sizeOf :: CFloat -> Int Source # alignment :: CFloat -> Int Source # peekElemOff :: Ptr CFloat -> Int -> IO CFloat Source # pokeElemOff :: Ptr CFloat -> Int -> CFloat -> IO () Source # peekByteOff :: Ptr b -> Int -> IO CFloat Source # pokeByteOff :: Ptr b -> Int -> CFloat -> IO () Source # | |
| Num CFloat | |
Defined in GHC.Internal.Foreign.C.Types | |
| Read CFloat | |
| Fractional CFloat | |
| Real CFloat | |
Defined in GHC.Internal.Foreign.C.Types Methods toRational :: CFloat -> Rational Source # | |
| RealFrac CFloat | |
| Show CFloat | |
| Eq CFloat | |
| Ord CFloat | |
Haskell type representing the C unsigned long type.
(The concrete types of Foreign.C.Types are platform-specific.)
Instances
| Bits CULong | |
Defined in GHC.Internal.Foreign.C.Types Methods (.&.) :: CULong -> CULong -> CULong Source # (.|.) :: CULong -> CULong -> CULong Source # xor :: CULong -> CULong -> CULong Source # complement :: CULong -> CULong Source # shift :: CULong -> Int -> CULong Source # rotate :: CULong -> Int -> CULong Source # setBit :: CULong -> Int -> CULong Source # clearBit :: CULong -> Int -> CULong Source # complementBit :: CULong -> Int -> CULong Source # testBit :: CULong -> Int -> Bool Source # bitSizeMaybe :: CULong -> Maybe Int Source # bitSize :: CULong -> Int Source # isSigned :: CULong -> Bool Source # shiftL :: CULong -> Int -> CULong Source # unsafeShiftL :: CULong -> Int -> CULong Source # shiftR :: CULong -> Int -> CULong Source # unsafeShiftR :: CULong -> Int -> CULong Source # rotateL :: CULong -> Int -> CULong Source # | |
| FiniteBits CULong | |
Defined in GHC.Internal.Foreign.C.Types Methods finiteBitSize :: CULong -> Int Source # countLeadingZeros :: CULong -> Int Source # countTrailingZeros :: CULong -> Int Source # | |
| Bounded CULong | |
| Enum CULong | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CULong -> CULong Source # pred :: CULong -> CULong Source # toEnum :: Int -> CULong Source # fromEnum :: CULong -> Int Source # enumFrom :: CULong -> [CULong] Source # enumFromThen :: CULong -> CULong -> [CULong] Source # enumFromTo :: CULong -> CULong -> [CULong] Source # enumFromThenTo :: CULong -> CULong -> CULong -> [CULong] Source # | |
| Storable CULong | |
Defined in GHC.Internal.Foreign.C.Types Methods sizeOf :: CULong -> Int Source # alignment :: CULong -> Int Source # peekElemOff :: Ptr CULong -> Int -> IO CULong Source # pokeElemOff :: Ptr CULong -> Int -> CULong -> IO () Source # peekByteOff :: Ptr b -> Int -> IO CULong Source # pokeByteOff :: Ptr b -> Int -> CULong -> IO () Source # | |
| Ix CULong | |
Defined in GHC.Internal.Foreign.C.Types | |
| Num CULong | |
Defined in GHC.Internal.Foreign.C.Types | |
| Read CULong | |
| Integral CULong | |
Defined in GHC.Internal.Foreign.C.Types | |
| Real CULong | |
Defined in GHC.Internal.Foreign.C.Types Methods toRational :: CULong -> Rational Source # | |
| 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
| Bits CLong | |
Defined in GHC.Internal.Foreign.C.Types Methods (.&.) :: CLong -> CLong -> CLong Source # (.|.) :: CLong -> CLong -> CLong Source # xor :: CLong -> CLong -> CLong Source # complement :: CLong -> CLong Source # shift :: CLong -> Int -> CLong Source # rotate :: CLong -> Int -> CLong Source # setBit :: CLong -> Int -> CLong Source # clearBit :: CLong -> Int -> CLong Source # complementBit :: CLong -> Int -> CLong Source # testBit :: CLong -> Int -> Bool Source # bitSizeMaybe :: CLong -> Maybe Int Source # bitSize :: CLong -> Int Source # isSigned :: CLong -> Bool Source # shiftL :: CLong -> Int -> CLong Source # unsafeShiftL :: CLong -> Int -> CLong Source # shiftR :: CLong -> Int -> CLong Source # unsafeShiftR :: CLong -> Int -> CLong Source # rotateL :: CLong -> Int -> CLong Source # | |
| FiniteBits CLong | |
Defined in GHC.Internal.Foreign.C.Types Methods finiteBitSize :: CLong -> Int Source # countLeadingZeros :: CLong -> Int Source # countTrailingZeros :: CLong -> Int Source # | |
| Bounded CLong | |
| Enum CLong | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CLong -> CLong Source # pred :: CLong -> CLong Source # toEnum :: Int -> CLong Source # fromEnum :: CLong -> Int Source # enumFrom :: CLong -> [CLong] Source # enumFromThen :: CLong -> CLong -> [CLong] Source # enumFromTo :: CLong -> CLong -> [CLong] Source # enumFromThenTo :: CLong -> CLong -> CLong -> [CLong] Source # | |
| Storable CLong | |
Defined in GHC.Internal.Foreign.C.Types Methods sizeOf :: CLong -> Int Source # alignment :: CLong -> Int Source # peekElemOff :: Ptr CLong -> Int -> IO CLong Source # pokeElemOff :: Ptr CLong -> Int -> CLong -> IO () Source # peekByteOff :: Ptr b -> Int -> IO CLong Source # pokeByteOff :: Ptr b -> Int -> CLong -> IO () Source # | |
| Ix CLong | |
Defined in GHC.Internal.Foreign.C.Types | |
| Num CLong | |
Defined in GHC.Internal.Foreign.C.Types | |
| Read CLong | |
| Integral CLong | |
Defined in GHC.Internal.Foreign.C.Types | |
| Real CLong | |
Defined in GHC.Internal.Foreign.C.Types Methods toRational :: CLong -> Rational Source # | |
| Show CLong | |
| Eq CLong | |
| Ord CLong | |
Defined in GHC.Internal.Foreign.C.Types | |
| 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
| Bits CUInt | |
Defined in GHC.Internal.Foreign.C.Types Methods (.&.) :: CUInt -> CUInt -> CUInt Source # (.|.) :: CUInt -> CUInt -> CUInt Source # xor :: CUInt -> CUInt -> CUInt Source # complement :: CUInt -> CUInt Source # shift :: CUInt -> Int -> CUInt Source # rotate :: CUInt -> Int -> CUInt Source # setBit :: CUInt -> Int -> CUInt Source # clearBit :: CUInt -> Int -> CUInt Source # complementBit :: CUInt -> Int -> CUInt Source # testBit :: CUInt -> Int -> Bool Source # bitSizeMaybe :: CUInt -> Maybe Int Source # bitSize :: CUInt -> Int Source # isSigned :: CUInt -> Bool Source # shiftL :: CUInt -> Int -> CUInt Source # unsafeShiftL :: CUInt -> Int -> CUInt Source # shiftR :: CUInt -> Int -> CUInt Source # unsafeShiftR :: CUInt -> Int -> CUInt Source # rotateL :: CUInt -> Int -> CUInt Source # | |
| FiniteBits CUInt | |
Defined in GHC.Internal.Foreign.C.Types Methods finiteBitSize :: CUInt -> Int Source # countLeadingZeros :: CUInt -> Int Source # countTrailingZeros :: CUInt -> Int Source # | |
| Bounded CUInt | |
| Enum CUInt | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CUInt -> CUInt Source # pred :: CUInt -> CUInt Source # toEnum :: Int -> CUInt Source # fromEnum :: CUInt -> Int Source # enumFrom :: CUInt -> [CUInt] Source # enumFromThen :: CUInt -> CUInt -> [CUInt] Source # enumFromTo :: CUInt -> CUInt -> [CUInt] Source # enumFromThenTo :: CUInt -> CUInt -> CUInt -> [CUInt] Source # | |
| Storable CUInt | |
Defined in GHC.Internal.Foreign.C.Types Methods sizeOf :: CUInt -> Int Source # alignment :: CUInt -> Int Source # peekElemOff :: Ptr CUInt -> Int -> IO CUInt Source # pokeElemOff :: Ptr CUInt -> Int -> CUInt -> IO () Source # peekByteOff :: Ptr b -> Int -> IO CUInt Source # pokeByteOff :: Ptr b -> Int -> CUInt -> IO () Source # | |
| Ix CUInt | |
Defined in GHC.Internal.Foreign.C.Types | |
| Num CUInt | |
Defined in GHC.Internal.Foreign.C.Types | |
| Read CUInt | |
| Integral CUInt | |
Defined in GHC.Internal.Foreign.C.Types | |
| Real CUInt | |
Defined in GHC.Internal.Foreign.C.Types Methods toRational :: CUInt -> Rational Source # | |
| Show CUInt | |
| Eq CUInt | |
| Ord CUInt | |
Defined in GHC.Internal.Foreign.C.Types | |
| 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
| Bits CInt | |
Defined in GHC.Internal.Foreign.C.Types Methods (.&.) :: CInt -> CInt -> CInt Source # (.|.) :: CInt -> CInt -> CInt Source # xor :: CInt -> CInt -> CInt Source # complement :: CInt -> CInt Source # shift :: CInt -> Int -> CInt Source # rotate :: CInt -> Int -> CInt Source # setBit :: CInt -> Int -> CInt Source # clearBit :: CInt -> Int -> CInt Source # complementBit :: CInt -> Int -> CInt Source # testBit :: CInt -> Int -> Bool Source # bitSizeMaybe :: CInt -> Maybe Int Source # bitSize :: CInt -> Int Source # isSigned :: CInt -> Bool Source # shiftL :: CInt -> Int -> CInt Source # unsafeShiftL :: CInt -> Int -> CInt Source # shiftR :: CInt -> Int -> CInt Source # unsafeShiftR :: CInt -> Int -> CInt Source # rotateL :: CInt -> Int -> CInt Source # | |
| FiniteBits CInt | |
Defined in GHC.Internal.Foreign.C.Types Methods finiteBitSize :: CInt -> Int Source # countLeadingZeros :: CInt -> Int Source # countTrailingZeros :: CInt -> Int Source # | |
| Bounded CInt | |
| Enum CInt | |
| Storable CInt | |
Defined in GHC.Internal.Foreign.C.Types Methods sizeOf :: CInt -> Int Source # alignment :: CInt -> Int Source # peekElemOff :: Ptr CInt -> Int -> IO CInt Source # pokeElemOff :: Ptr CInt -> Int -> CInt -> IO () Source # peekByteOff :: Ptr b -> Int -> IO CInt Source # pokeByteOff :: Ptr b -> Int -> CInt -> IO () Source # | |
| Ix CInt | |
Defined in GHC.Internal.Foreign.C.Types | |
| Num CInt | |
| Read CInt | |
| Integral CInt | |
Defined in GHC.Internal.Foreign.C.Types | |
| Real CInt | |
Defined in GHC.Internal.Foreign.C.Types Methods toRational :: CInt -> Rational Source # | |
| Show CInt | |
| Eq CInt | |
| Ord CInt | |
Defined in GHC.Internal.Foreign.C.Types | |
| IsGValue CInt Source # | |
Defined in Data.GI.Base.GValue | |
type CString = Ptr CChar Source #
A C string is a reference to an array of C characters terminated by NUL.
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.Internal.Generics Associated Types
| |||||
| Foldable (UAddr :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => UAddr m -> m Source # foldMap :: Monoid m => (a -> m) -> UAddr a -> m Source # foldMap' :: Monoid m => (a -> m) -> UAddr a -> m Source # foldr :: (a -> b -> b) -> b -> UAddr a -> b Source # foldr' :: (a -> b -> b) -> b -> UAddr a -> b Source # foldl :: (b -> a -> b) -> b -> UAddr a -> b Source # foldl' :: (b -> a -> b) -> b -> UAddr a -> b Source # foldr1 :: (a -> a -> a) -> UAddr a -> a Source # foldl1 :: (a -> a -> a) -> UAddr a -> a Source # toList :: UAddr a -> [a] Source # null :: UAddr a -> Bool Source # length :: UAddr a -> Int Source # elem :: Eq a => a -> UAddr a -> Bool Source # maximum :: Ord a => UAddr a -> a Source # minimum :: Ord a => UAddr a -> a Source # | |||||
| Traversable (UAddr :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Traversable | |||||
| Storable (Ptr a) | Since: base-2.1 | ||||
Defined in GHC.Internal.Foreign.Storable Methods sizeOf :: Ptr a -> Int Source # alignment :: Ptr a -> Int Source # peekElemOff :: Ptr (Ptr a) -> Int -> IO (Ptr a) Source # pokeElemOff :: Ptr (Ptr a) -> Int -> Ptr a -> IO () Source # peekByteOff :: Ptr b -> Int -> IO (Ptr a) Source # pokeByteOff :: Ptr b -> Int -> Ptr a -> IO () Source # | |||||
| Show (Ptr a) | Since: base-2.1 | ||||
| Eq (Ptr a) | Since: base-2.1 | ||||
| Ord (Ptr a) | Since: base-2.1 | ||||
Defined in GHC.Internal.Ptr | |||||
| 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.Internal.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.Internal.Generics Methods compare :: URec (Ptr ()) p -> URec (Ptr ()) p -> Ordering Source # (<) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool Source # (<=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool Source # (>) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool Source # (>=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool Source # max :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p Source # min :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p Source # | |||||
| 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.Internal.Generics | |||||
| type Rep (URec (Ptr ()) p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.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,,Ptra,FunPtraor a renaming of any of these usingStablePtranewtype. - the return type is either a marshallable foreign type or has the form
whereIOttis 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 GHC.Internal.Foreign.Storable Methods sizeOf :: FunPtr a -> Int Source # alignment :: FunPtr a -> Int Source # peekElemOff :: Ptr (FunPtr a) -> Int -> IO (FunPtr a) Source # pokeElemOff :: Ptr (FunPtr a) -> Int -> FunPtr a -> IO () Source # peekByteOff :: Ptr b -> Int -> IO (FunPtr a) Source # pokeByteOff :: Ptr b -> Int -> FunPtr a -> IO () Source # | |
| Show (FunPtr a) | Since: base-2.1 |
| Eq (FunPtr a) | |
| Ord (FunPtr a) | |
Defined in GHC.Internal.Ptr | |
castFunPtrToPtr :: FunPtr a -> Ptr b Source #
castPtrToFunPtr :: Ptr a -> FunPtr b Source #
data ForeignPtr a Source #
The type ForeignPtr represents references to objects that are
maintained in a foreign language, i.e., that are not part of the
data structures usually managed by the Haskell storage manager.
The essential difference between ForeignPtrs and vanilla memory
references of type Ptr a is that the former may be associated
with finalizers. A finalizer is a routine that is invoked when
the Haskell storage manager detects that - within the Haskell heap
and stack - there are no more references left that are pointing to
the ForeignPtr. Typically, the finalizer will, then, invoke
routines in the foreign language that free the resources bound by
the foreign object.
The ForeignPtr is parameterised in the same way as Ptr. The
type argument of ForeignPtr should normally be an instance of
class Storable.
Instances
| Show (ForeignPtr a) | Since: base-2.1 |
Defined in GHC.Internal.ForeignPtr | |
| Eq (ForeignPtr a) | Since: base-2.1 |
Defined in GHC.Internal.ForeignPtr Methods (==) :: ForeignPtr a -> ForeignPtr a -> Bool Source # (/=) :: ForeignPtr a -> ForeignPtr a -> Bool Source # | |
| Ord (ForeignPtr a) | Since: base-2.1 |
Defined in GHC.Internal.ForeignPtr Methods compare :: ForeignPtr a -> ForeignPtr a -> Ordering Source # (<) :: ForeignPtr a -> ForeignPtr a -> Bool Source # (<=) :: ForeignPtr a -> ForeignPtr a -> Bool Source # (>) :: ForeignPtr a -> ForeignPtr a -> Bool Source # (>=) :: ForeignPtr a -> ForeignPtr a -> Bool Source # max :: ForeignPtr a -> ForeignPtr a -> ForeignPtr a Source # min :: ForeignPtr a -> ForeignPtr a -> ForeignPtr a Source # | |
module Foreign.ForeignPtr.Unsafe
sizeOf :: Storable a => a -> Int Source #
Computes the storage requirements (in bytes) of the argument. The value of the argument is not used.
peek :: Storable a => Ptr a -> IO a Source #
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 () Source #
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 Source #
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
Stringshow:
>>>show <$> NothingNothing
>>>show <$> Just 3Just "3"
Convert from an to an
Either Int IntEither IntString using show:
>>>show <$> Left 17Left 17
>>>show <$> Right 17Right "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 Source #
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 |
| (:!<~) :: forall obj info (attr :: Symbol) (tag1 :: AttrOpTag) b model (tag :: AttrOpTag). (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag1 info obj, AttrSetTypeConstraint info b, ?_haskell_gi_modelProxy :: ModelProxy model) => AttrLabelProxy attr -> DynVal model b -> AttrOp obj tag infixr 0 | Bind a property to the given |
| (:<~) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b model. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrSetTypeConstraint info b, AttrOpAllowed 'AttrGet info obj, EqMaybe b (AttrGetType info), ?_haskell_gi_modelProxy :: ModelProxy model) => AttrLabelProxy attr -> DynVal model b -> AttrOp obj tag infixr 0 | Bind a property to the given |
| Bind :: forall obj info (propName :: Symbol) (tag :: AttrOpTag) model outType (components :: [Symbol]) (fieldName :: Symbol). (HasAttributeList obj, GObject obj, info ~ ResolveAttribute propName obj, AttrInfo info, KnownSymbol (AttrLabel info), AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrOpAllowed 'AttrPut info obj, ?_haskell_gi_modelProxy :: ModelProxy model, outType ~ AttrGetType info, AttrSetTypeConstraint info outType, components ~ Components fieldName, PathFieldAccess components model outType, KnownSymbol fieldName, Eq outType) => AttrLabelProxy propName -> AttrLabelProxy fieldName -> AttrOp obj tag | Given an AttrLabelProxy, bind the given attribute to the corresponding field in the model proxy (if there's one), so that changes in the attribute are reflected back into changes of the model. |
| 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 #
attrPut :: AttrBaseTypeConstraint info o => o -> AttrGetType info -> IO () Source #
Like attrSet, but it uses the same type as the getter. This
is useful for some nullable types, for which the getter returns
Maybe a, while the setter takes an a. attrPut will
instead accept an Maybe a.
default attrPut :: CheckNotElem 'AttrPut (AttrAllowedOps info) (PutNotProvidedError info) => o -> AttrGetType info -> IO () 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 |
| AttrPut | It is possible to set a value of the same type as
the one returned by |
Instances
| Bounded AttrOpTag Source # | |
| Enum AttrOpTag Source # | |
Defined in Data.GI.Base.Attributes Methods succ :: AttrOpTag -> AttrOpTag Source # pred :: AttrOpTag -> AttrOpTag Source # toEnum :: Int -> AttrOpTag Source # fromEnum :: AttrOpTag -> Int Source # enumFrom :: AttrOpTag -> [AttrOpTag] Source # enumFromThen :: AttrOpTag -> AttrOpTag -> [AttrOpTag] Source # enumFromTo :: AttrOpTag -> AttrOpTag -> [AttrOpTag] Source # enumFromThenTo :: AttrOpTag -> AttrOpTag -> AttrOpTag -> [AttrOpTag] Source # | |
| Show AttrOpTag Source # | |
| Eq AttrOpTag Source # | |
| Ord AttrOpTag Source # | |
Defined in Data.GI.Base.Attributes | |
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 Source # | |
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
bindPropToField :: forall o info (prop :: Symbol) (field :: Symbol) model outType (tag :: AttrOpTag) (components :: [Symbol]). (HasAttributeList o, GObject o, info ~ ResolveAttribute prop o, AttrInfo info, KnownSymbol (AttrLabel info), AttrBaseTypeConstraint info o, AttrOpAllowed tag info o, AttrOpAllowed 'AttrPut info o, ?_haskell_gi_modelProxy :: ModelProxy model, outType ~ AttrGetType info, AttrSetTypeConstraint info outType, components ~ Components field, PathFieldAccess components model outType, KnownSymbol field, Eq outType) => Proxy tag -> o -> AttrLabelProxy prop -> AttrLabelProxy field -> IO () Source #
Create a binding between the given property of an object and a field in the model.
type family AttrGetType info Source #
Type returned by attrGet.
type family AttrBaseTypeConstraint info :: Type -> Constraint Source #
Constraint on the type for which we are allowed to create/set/get the attribute.
type family AttrAllowedOps info :: [AttrOpTag] Source #
The operations that are allowed on the attribute.
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.Internal.Generics Associated Types
| |||||
| TestCoercion SSymbol | Since: base-4.18.0.0 | ||||
Defined in GHC.Internal.TypeLits | |||||
| TestEquality SSymbol | Since: base-4.18.0.0 | ||||
Defined in GHC.Internal.TypeLits | |||||
| KnownSymbol a => SingI (a :: Symbol) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics Methods sing :: Sing a | |||||
| (GConstructorImpl repDefined name s t a b, _name ~ AppendSymbol "_" name) => GenericOptic repDefined (_name :: Symbol) A_Prism s t a b | |||||
Defined in Optics.Label Methods genericOptic :: Optic A_Prism NoIx s t a b | |||||
| GFieldImpl name s t a b => GenericOptic repDefined (name :: Symbol) A_Lens s t a b | |||||
Defined in Optics.Label Methods genericOptic :: Optic A_Lens NoIx s t a b | |||||
| (HasField fieldName field a, KnownSymbol fieldName) => HasField (fieldName :: Symbol) (DynVal model field) (DynVal model a) Source # | |||||
| (path ~ GSetFieldPath con epath, When (IsLeft epath) (HideReps g h), GSetFieldProd path g h b) => GSetFieldSum ('PathLeaf epath) (M1 C ('MetaCons con fix hs) g) (M1 C ('MetaCons con fix hs) h) b | |||||
Defined in Optics.Internal.Generic | |||||
| GAffineFieldMaybe epath g h a b => GAffineFieldSum ('PathLeaf epath) (M1 C m g) (M1 C m h) a b | |||||
Defined in Optics.Internal.Generic Methods gafieldSum :: AffineTraversalVL (M1 C m g x) (M1 C m h x) a b Source # | |||||
| (GFieldImpl fieldName model model val val, NonEmpty fieldName ('Text "Field names cannot be empty"), KnownSymbol fieldName) => PathFieldAccess '[fieldName] model val Source # | |||||
Defined in Data.GI.Base.Internal.PathFieldAccess | |||||
| (GFieldImpl fieldName model model val val, KnownSymbol fieldName, PathFieldAccess rest val inner) => PathFieldAccess (fieldName ': rest) model inner Source # | |||||
Defined in Data.GI.Base.Internal.PathFieldAccess | |||||
| g ~ h => GAffineFieldMaybe ('Left name :: Either Symbol [Path]) g h a b | |||||
Defined in Optics.Internal.Generic Methods gafieldMaybe :: AffineTraversalVL (g x) (h x) a b | |||||
| GFieldProd prodPath g h a b => GAffineFieldMaybe ('Right prodPath :: Either Symbol [Path]) g h a b | |||||
Defined in Optics.Internal.Generic Methods gafieldMaybe :: AffineTraversalVL (g x) (h x) a b | |||||
| (GSetFieldSum path1 g1 h1 b, GSetFieldSum path2 g2 h2 b) => GSetFieldSum ('PathTree path1 path2) (g1 :+: g2) (h1 :+: h2) b | |||||
Defined in Optics.Internal.Generic Methods gsetFieldSum :: (g1 :+: g2) x -> b -> (h1 :+: h2) x Source # | |||||
| (GAffineFieldSum path1 g1 h1 a b, GAffineFieldSum path2 g2 h2 a b) => GAffineFieldSum ('PathTree path1 path2) (g1 :+: g2) (h1 :+: h2) a b | |||||
Defined in Optics.Internal.Generic Methods gafieldSum :: AffineTraversalVL ((g1 :+: g2) x) ((h1 :+: h2) x) a b Source # | |||||
| type DemoteRep Symbol | |||||
Defined in GHC.Internal.Generics | |||||
| data Sing (s :: Symbol) | |||||
Defined in GHC.Internal.Generics | |||||
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
andsuccmaxBoundshould result in a runtime error.predminBound fromEnumandtoEnumshould give a runtime error if the result value is not representable in the result type. For example,is an error.toEnum7 ::BoolenumFromandenumFromThenshould 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 = minBoundMethods
Convert from an Int.
Instances
| Enum ByteOrder | Since: base-4.11.0.0 |
Defined in GHC.Internal.ByteOrder Methods succ :: ByteOrder -> ByteOrder Source # pred :: ByteOrder -> ByteOrder Source # toEnum :: Int -> ByteOrder Source # fromEnum :: ByteOrder -> Int Source # enumFrom :: ByteOrder -> [ByteOrder] Source # enumFromThen :: ByteOrder -> ByteOrder -> [ByteOrder] Source # enumFromTo :: ByteOrder -> ByteOrder -> [ByteOrder] Source # enumFromThenTo :: ByteOrder -> ByteOrder -> ByteOrder -> [ByteOrder] Source # | |
| Enum CBool | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CBool -> CBool Source # pred :: CBool -> CBool Source # toEnum :: Int -> CBool Source # fromEnum :: CBool -> Int Source # enumFrom :: CBool -> [CBool] Source # enumFromThen :: CBool -> CBool -> [CBool] Source # enumFromTo :: CBool -> CBool -> [CBool] Source # enumFromThenTo :: CBool -> CBool -> CBool -> [CBool] Source # | |
| Enum CChar | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CChar -> CChar Source # pred :: CChar -> CChar Source # toEnum :: Int -> CChar Source # fromEnum :: CChar -> Int Source # enumFrom :: CChar -> [CChar] Source # enumFromThen :: CChar -> CChar -> [CChar] Source # enumFromTo :: CChar -> CChar -> [CChar] Source # enumFromThenTo :: CChar -> CChar -> CChar -> [CChar] Source # | |
| Enum CClock | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CClock -> CClock Source # pred :: CClock -> CClock Source # toEnum :: Int -> CClock Source # fromEnum :: CClock -> Int Source # enumFrom :: CClock -> [CClock] Source # enumFromThen :: CClock -> CClock -> [CClock] Source # enumFromTo :: CClock -> CClock -> [CClock] Source # enumFromThenTo :: CClock -> CClock -> CClock -> [CClock] Source # | |
| Enum CDouble | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CDouble -> CDouble Source # pred :: CDouble -> CDouble Source # toEnum :: Int -> CDouble Source # fromEnum :: CDouble -> Int Source # enumFrom :: CDouble -> [CDouble] Source # enumFromThen :: CDouble -> CDouble -> [CDouble] Source # enumFromTo :: CDouble -> CDouble -> [CDouble] Source # enumFromThenTo :: CDouble -> CDouble -> CDouble -> [CDouble] Source # | |
| Enum CFloat | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CFloat -> CFloat Source # pred :: CFloat -> CFloat Source # toEnum :: Int -> CFloat Source # fromEnum :: CFloat -> Int Source # enumFrom :: CFloat -> [CFloat] Source # enumFromThen :: CFloat -> CFloat -> [CFloat] Source # enumFromTo :: CFloat -> CFloat -> [CFloat] Source # enumFromThenTo :: CFloat -> CFloat -> CFloat -> [CFloat] Source # | |
| Enum CInt | |
| Enum CIntMax | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CIntMax -> CIntMax Source # pred :: CIntMax -> CIntMax Source # toEnum :: Int -> CIntMax Source # fromEnum :: CIntMax -> Int Source # enumFrom :: CIntMax -> [CIntMax] Source # enumFromThen :: CIntMax -> CIntMax -> [CIntMax] Source # enumFromTo :: CIntMax -> CIntMax -> [CIntMax] Source # enumFromThenTo :: CIntMax -> CIntMax -> CIntMax -> [CIntMax] Source # | |
| Enum CIntPtr | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CIntPtr -> CIntPtr Source # pred :: CIntPtr -> CIntPtr Source # toEnum :: Int -> CIntPtr Source # fromEnum :: CIntPtr -> Int Source # enumFrom :: CIntPtr -> [CIntPtr] Source # enumFromThen :: CIntPtr -> CIntPtr -> [CIntPtr] Source # enumFromTo :: CIntPtr -> CIntPtr -> [CIntPtr] Source # enumFromThenTo :: CIntPtr -> CIntPtr -> CIntPtr -> [CIntPtr] Source # | |
| Enum CLLong | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CLLong -> CLLong Source # pred :: CLLong -> CLLong Source # toEnum :: Int -> CLLong Source # fromEnum :: CLLong -> Int Source # enumFrom :: CLLong -> [CLLong] Source # enumFromThen :: CLLong -> CLLong -> [CLLong] Source # enumFromTo :: CLLong -> CLLong -> [CLLong] Source # enumFromThenTo :: CLLong -> CLLong -> CLLong -> [CLLong] Source # | |
| Enum CLong | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CLong -> CLong Source # pred :: CLong -> CLong Source # toEnum :: Int -> CLong Source # fromEnum :: CLong -> Int Source # enumFrom :: CLong -> [CLong] Source # enumFromThen :: CLong -> CLong -> [CLong] Source # enumFromTo :: CLong -> CLong -> [CLong] Source # enumFromThenTo :: CLong -> CLong -> CLong -> [CLong] Source # | |
| Enum CPtrdiff | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CPtrdiff -> CPtrdiff Source # pred :: CPtrdiff -> CPtrdiff Source # toEnum :: Int -> CPtrdiff Source # fromEnum :: CPtrdiff -> Int Source # enumFrom :: CPtrdiff -> [CPtrdiff] Source # enumFromThen :: CPtrdiff -> CPtrdiff -> [CPtrdiff] Source # enumFromTo :: CPtrdiff -> CPtrdiff -> [CPtrdiff] Source # enumFromThenTo :: CPtrdiff -> CPtrdiff -> CPtrdiff -> [CPtrdiff] Source # | |
| Enum CSChar | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CSChar -> CSChar Source # pred :: CSChar -> CSChar Source # toEnum :: Int -> CSChar Source # fromEnum :: CSChar -> Int Source # enumFrom :: CSChar -> [CSChar] Source # enumFromThen :: CSChar -> CSChar -> [CSChar] Source # enumFromTo :: CSChar -> CSChar -> [CSChar] Source # enumFromThenTo :: CSChar -> CSChar -> CSChar -> [CSChar] Source # | |
| Enum CSUSeconds | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CSUSeconds -> CSUSeconds Source # pred :: CSUSeconds -> CSUSeconds Source # toEnum :: Int -> CSUSeconds Source # fromEnum :: CSUSeconds -> Int Source # enumFrom :: CSUSeconds -> [CSUSeconds] Source # enumFromThen :: CSUSeconds -> CSUSeconds -> [CSUSeconds] Source # enumFromTo :: CSUSeconds -> CSUSeconds -> [CSUSeconds] Source # enumFromThenTo :: CSUSeconds -> CSUSeconds -> CSUSeconds -> [CSUSeconds] Source # | |
| Enum CShort | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CShort -> CShort Source # pred :: CShort -> CShort Source # toEnum :: Int -> CShort Source # fromEnum :: CShort -> Int Source # enumFrom :: CShort -> [CShort] Source # enumFromThen :: CShort -> CShort -> [CShort] Source # enumFromTo :: CShort -> CShort -> [CShort] Source # enumFromThenTo :: CShort -> CShort -> CShort -> [CShort] Source # | |
| Enum CSigAtomic | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CSigAtomic -> CSigAtomic Source # pred :: CSigAtomic -> CSigAtomic Source # toEnum :: Int -> CSigAtomic Source # fromEnum :: CSigAtomic -> Int Source # enumFrom :: CSigAtomic -> [CSigAtomic] Source # enumFromThen :: CSigAtomic -> CSigAtomic -> [CSigAtomic] Source # enumFromTo :: CSigAtomic -> CSigAtomic -> [CSigAtomic] Source # enumFromThenTo :: CSigAtomic -> CSigAtomic -> CSigAtomic -> [CSigAtomic] Source # | |
| Enum CSize | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CSize -> CSize Source # pred :: CSize -> CSize Source # toEnum :: Int -> CSize Source # fromEnum :: CSize -> Int Source # enumFrom :: CSize -> [CSize] Source # enumFromThen :: CSize -> CSize -> [CSize] Source # enumFromTo :: CSize -> CSize -> [CSize] Source # enumFromThenTo :: CSize -> CSize -> CSize -> [CSize] Source # | |
| Enum CTime | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CTime -> CTime Source # pred :: CTime -> CTime Source # toEnum :: Int -> CTime Source # fromEnum :: CTime -> Int Source # enumFrom :: CTime -> [CTime] Source # enumFromThen :: CTime -> CTime -> [CTime] Source # enumFromTo :: CTime -> CTime -> [CTime] Source # enumFromThenTo :: CTime -> CTime -> CTime -> [CTime] Source # | |
| Enum CUChar | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CUChar -> CUChar Source # pred :: CUChar -> CUChar Source # toEnum :: Int -> CUChar Source # fromEnum :: CUChar -> Int Source # enumFrom :: CUChar -> [CUChar] Source # enumFromThen :: CUChar -> CUChar -> [CUChar] Source # enumFromTo :: CUChar -> CUChar -> [CUChar] Source # enumFromThenTo :: CUChar -> CUChar -> CUChar -> [CUChar] Source # | |
| Enum CUInt | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CUInt -> CUInt Source # pred :: CUInt -> CUInt Source # toEnum :: Int -> CUInt Source # fromEnum :: CUInt -> Int Source # enumFrom :: CUInt -> [CUInt] Source # enumFromThen :: CUInt -> CUInt -> [CUInt] Source # enumFromTo :: CUInt -> CUInt -> [CUInt] Source # enumFromThenTo :: CUInt -> CUInt -> CUInt -> [CUInt] Source # | |
| Enum CUIntMax | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CUIntMax -> CUIntMax Source # pred :: CUIntMax -> CUIntMax Source # toEnum :: Int -> CUIntMax Source # fromEnum :: CUIntMax -> Int Source # enumFrom :: CUIntMax -> [CUIntMax] Source # enumFromThen :: CUIntMax -> CUIntMax -> [CUIntMax] Source # enumFromTo :: CUIntMax -> CUIntMax -> [CUIntMax] Source # enumFromThenTo :: CUIntMax -> CUIntMax -> CUIntMax -> [CUIntMax] Source # | |
| Enum CUIntPtr | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CUIntPtr -> CUIntPtr Source # pred :: CUIntPtr -> CUIntPtr Source # toEnum :: Int -> CUIntPtr Source # fromEnum :: CUIntPtr -> Int Source # enumFrom :: CUIntPtr -> [CUIntPtr] Source # enumFromThen :: CUIntPtr -> CUIntPtr -> [CUIntPtr] Source # enumFromTo :: CUIntPtr -> CUIntPtr -> [CUIntPtr] Source # enumFromThenTo :: CUIntPtr -> CUIntPtr -> CUIntPtr -> [CUIntPtr] Source # | |
| Enum CULLong | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CULLong -> CULLong Source # pred :: CULLong -> CULLong Source # toEnum :: Int -> CULLong Source # fromEnum :: CULLong -> Int Source # enumFrom :: CULLong -> [CULLong] Source # enumFromThen :: CULLong -> CULLong -> [CULLong] Source # enumFromTo :: CULLong -> CULLong -> [CULLong] Source # enumFromThenTo :: CULLong -> CULLong -> CULLong -> [CULLong] Source # | |
| Enum CULong | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CULong -> CULong Source # pred :: CULong -> CULong Source # toEnum :: Int -> CULong Source # fromEnum :: CULong -> Int Source # enumFrom :: CULong -> [CULong] Source # enumFromThen :: CULong -> CULong -> [CULong] Source # enumFromTo :: CULong -> CULong -> [CULong] Source # enumFromThenTo :: CULong -> CULong -> CULong -> [CULong] Source # | |
| Enum CUSeconds | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CUSeconds -> CUSeconds Source # pred :: CUSeconds -> CUSeconds Source # toEnum :: Int -> CUSeconds Source # fromEnum :: CUSeconds -> Int Source # enumFrom :: CUSeconds -> [CUSeconds] Source # enumFromThen :: CUSeconds -> CUSeconds -> [CUSeconds] Source # enumFromTo :: CUSeconds -> CUSeconds -> [CUSeconds] Source # enumFromThenTo :: CUSeconds -> CUSeconds -> CUSeconds -> [CUSeconds] Source # | |
| Enum CUShort | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CUShort -> CUShort Source # pred :: CUShort -> CUShort Source # toEnum :: Int -> CUShort Source # fromEnum :: CUShort -> Int Source # enumFrom :: CUShort -> [CUShort] Source # enumFromThen :: CUShort -> CUShort -> [CUShort] Source # enumFromTo :: CUShort -> CUShort -> [CUShort] Source # enumFromThenTo :: CUShort -> CUShort -> CUShort -> [CUShort] Source # | |
| Enum CWchar | |
Defined in GHC.Internal.Foreign.C.Types Methods succ :: CWchar -> CWchar Source # pred :: CWchar -> CWchar Source # toEnum :: Int -> CWchar Source # fromEnum :: CWchar -> Int Source # enumFrom :: CWchar -> [CWchar] Source # enumFromThen :: CWchar -> CWchar -> [CWchar] Source # enumFromTo :: CWchar -> CWchar -> [CWchar] Source # enumFromThenTo :: CWchar -> CWchar -> CWchar -> [CWchar] Source # | |
| Enum IntPtr | |
Defined in GHC.Internal.Foreign.Ptr Methods succ :: IntPtr -> IntPtr Source # pred :: IntPtr -> IntPtr Source # toEnum :: Int -> IntPtr Source # fromEnum :: IntPtr -> Int Source # enumFrom :: IntPtr -> [IntPtr] Source # enumFromThen :: IntPtr -> IntPtr -> [IntPtr] Source # enumFromTo :: IntPtr -> IntPtr -> [IntPtr] Source # enumFromThenTo :: IntPtr -> IntPtr -> IntPtr -> [IntPtr] Source # | |
| Enum WordPtr | |
Defined in GHC.Internal.Foreign.Ptr Methods succ :: WordPtr -> WordPtr Source # pred :: WordPtr -> WordPtr Source # toEnum :: Int -> WordPtr Source # fromEnum :: WordPtr -> Int Source # enumFrom :: WordPtr -> [WordPtr] Source # enumFromThen :: WordPtr -> WordPtr -> [WordPtr] Source # enumFromTo :: WordPtr -> WordPtr -> [WordPtr] Source # enumFromThenTo :: WordPtr -> WordPtr -> WordPtr -> [WordPtr] Source # | |
| Enum Associativity | Since: base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods succ :: Associativity -> Associativity Source # pred :: Associativity -> Associativity Source # toEnum :: Int -> Associativity Source # fromEnum :: Associativity -> Int Source # enumFrom :: Associativity -> [Associativity] Source # enumFromThen :: Associativity -> Associativity -> [Associativity] Source # enumFromTo :: Associativity -> Associativity -> [Associativity] Source # enumFromThenTo :: Associativity -> Associativity -> Associativity -> [Associativity] Source # | |
| Enum DecidedStrictness | Since: base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods succ :: DecidedStrictness -> DecidedStrictness Source # pred :: DecidedStrictness -> DecidedStrictness Source # toEnum :: Int -> DecidedStrictness Source # fromEnum :: DecidedStrictness -> Int Source # enumFrom :: DecidedStrictness -> [DecidedStrictness] Source # enumFromThen :: DecidedStrictness -> DecidedStrictness -> [DecidedStrictness] Source # enumFromTo :: DecidedStrictness -> DecidedStrictness -> [DecidedStrictness] Source # enumFromThenTo :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness -> [DecidedStrictness] Source # | |
| Enum SourceStrictness | Since: base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods succ :: SourceStrictness -> SourceStrictness Source # pred :: SourceStrictness -> SourceStrictness Source # toEnum :: Int -> SourceStrictness Source # fromEnum :: SourceStrictness -> Int Source # enumFrom :: SourceStrictness -> [SourceStrictness] Source # enumFromThen :: SourceStrictness -> SourceStrictness -> [SourceStrictness] Source # enumFromTo :: SourceStrictness -> SourceStrictness -> [SourceStrictness] Source # enumFromThenTo :: SourceStrictness -> SourceStrictness -> SourceStrictness -> [SourceStrictness] Source # | |
| Enum SourceUnpackedness | Since: base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods succ :: SourceUnpackedness -> SourceUnpackedness Source # pred :: SourceUnpackedness -> SourceUnpackedness Source # toEnum :: Int -> SourceUnpackedness Source # fromEnum :: SourceUnpackedness -> Int Source # enumFrom :: SourceUnpackedness -> [SourceUnpackedness] Source # enumFromThen :: SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness] Source # enumFromTo :: SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness] Source # enumFromThenTo :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness] Source # | |
| Enum Int16 | Since: base-2.1 |
Defined in GHC.Internal.Int Methods succ :: Int16 -> Int16 Source # pred :: Int16 -> Int16 Source # toEnum :: Int -> Int16 Source # fromEnum :: Int16 -> Int Source # enumFrom :: Int16 -> [Int16] Source # enumFromThen :: Int16 -> Int16 -> [Int16] Source # enumFromTo :: Int16 -> Int16 -> [Int16] Source # enumFromThenTo :: Int16 -> Int16 -> Int16 -> [Int16] Source # | |
| Enum Int32 | Since: base-2.1 |
Defined in GHC.Internal.Int Methods succ :: Int32 -> Int32 Source # pred :: Int32 -> Int32 Source # toEnum :: Int -> Int32 Source # fromEnum :: Int32 -> Int Source # enumFrom :: Int32 -> [Int32] Source # enumFromThen :: Int32 -> Int32 -> [Int32] Source # enumFromTo :: Int32 -> Int32 -> [Int32] Source # enumFromThenTo :: Int32 -> Int32 -> Int32 -> [Int32] Source # | |
| Enum Int64 | Since: base-2.1 |
Defined in GHC.Internal.Int Methods succ :: Int64 -> Int64 Source # pred :: Int64 -> Int64 Source # toEnum :: Int -> Int64 Source # fromEnum :: Int64 -> Int Source # enumFrom :: Int64 -> [Int64] Source # enumFromThen :: Int64 -> Int64 -> [Int64] Source # enumFromTo :: Int64 -> Int64 -> [Int64] Source # enumFromThenTo :: Int64 -> Int64 -> Int64 -> [Int64] Source # | |
| Enum Int8 | Since: base-2.1 |
| Enum Word16 | Since: base-2.1 |
Defined in GHC.Internal.Word Methods succ :: Word16 -> Word16 Source # pred :: Word16 -> Word16 Source # toEnum :: Int -> Word16 Source # fromEnum :: Word16 -> Int Source # enumFrom :: Word16 -> [Word16] Source # enumFromThen :: Word16 -> Word16 -> [Word16] Source # enumFromTo :: Word16 -> Word16 -> [Word16] Source # enumFromThenTo :: Word16 -> Word16 -> Word16 -> [Word16] Source # | |
| Enum Word32 | Since: base-2.1 |
Defined in GHC.Internal.Word Methods succ :: Word32 -> Word32 Source # pred :: Word32 -> Word32 Source # toEnum :: Int -> Word32 Source # fromEnum :: Word32 -> Int Source # enumFrom :: Word32 -> [Word32] Source # enumFromThen :: Word32 -> Word32 -> [Word32] Source # enumFromTo :: Word32 -> Word32 -> [Word32] Source # enumFromThenTo :: Word32 -> Word32 -> Word32 -> [Word32] Source # | |
| Enum Word64 | Since: base-2.1 |
Defined in GHC.Internal.Word Methods succ :: Word64 -> Word64 Source # pred :: Word64 -> Word64 Source # toEnum :: Int -> Word64 Source # fromEnum :: Word64 -> Int Source # enumFrom :: Word64 -> [Word64] Source # enumFromThen :: Word64 -> Word64 -> [Word64] Source # enumFromTo :: Word64 -> Word64 -> [Word64] Source # enumFromThenTo :: Word64 -> Word64 -> Word64 -> [Word64] Source # | |
| Enum Word8 | Since: base-2.1 |
Defined in GHC.Internal.Word Methods succ :: Word8 -> Word8 Source # pred :: Word8 -> Word8 Source # toEnum :: Int -> Word8 Source # fromEnum :: Word8 -> Int Source # enumFrom :: Word8 -> [Word8] Source # enumFromThen :: Word8 -> Word8 -> [Word8] Source # enumFromTo :: Word8 -> Word8 -> [Word8] Source # enumFromThenTo :: Word8 -> Word8 -> Word8 -> [Word8] Source # | |
| Enum Ordering | Since: base-2.1 |
Defined in GHC.Internal.Enum Methods succ :: Ordering -> Ordering Source # pred :: Ordering -> Ordering Source # toEnum :: Int -> Ordering Source # fromEnum :: Ordering -> Int Source # enumFrom :: Ordering -> [Ordering] Source # enumFromThen :: Ordering -> Ordering -> [Ordering] Source # enumFromTo :: Ordering -> Ordering -> [Ordering] Source # enumFromThenTo :: Ordering -> Ordering -> Ordering -> [Ordering] Source # | |
| Enum AttrOpTag Source # | |
Defined in Data.GI.Base.Attributes Methods succ :: AttrOpTag -> AttrOpTag Source # pred :: AttrOpTag -> AttrOpTag Source # toEnum :: Int -> AttrOpTag Source # fromEnum :: AttrOpTag -> Int Source # enumFrom :: AttrOpTag -> [AttrOpTag] Source # enumFromThen :: AttrOpTag -> AttrOpTag -> [AttrOpTag] Source # enumFromTo :: AttrOpTag -> AttrOpTag -> [AttrOpTag] Source # enumFromThenTo :: AttrOpTag -> AttrOpTag -> AttrOpTag -> [AttrOpTag] Source # | |
| Enum GParamFlag Source # | |
Defined in Data.GI.Base.GParamSpec Methods succ :: GParamFlag -> GParamFlag Source # pred :: GParamFlag -> GParamFlag Source # toEnum :: Int -> GParamFlag Source # fromEnum :: GParamFlag -> Int Source # enumFrom :: GParamFlag -> [GParamFlag] Source # enumFromThen :: GParamFlag -> GParamFlag -> [GParamFlag] Source # enumFromTo :: GParamFlag -> GParamFlag -> [GParamFlag] Source # enumFromThenTo :: GParamFlag -> GParamFlag -> GParamFlag -> [GParamFlag] Source # | |
| Enum I8 | |
Defined in Data.Text.Foreign | |
| Enum FPFormat | |
Defined in Data.Text.Lazy.Builder.RealFloat Methods succ :: FPFormat -> FPFormat Source # pred :: FPFormat -> FPFormat Source # toEnum :: Int -> FPFormat Source # fromEnum :: FPFormat -> Int Source # enumFrom :: FPFormat -> [FPFormat] Source # enumFromThen :: FPFormat -> FPFormat -> [FPFormat] Source # enumFromTo :: FPFormat -> FPFormat -> [FPFormat] Source # enumFromThenTo :: FPFormat -> FPFormat -> FPFormat -> [FPFormat] Source # | |
| Enum Integer | Since: base-2.1 |
Defined in GHC.Internal.Enum Methods succ :: Integer -> Integer Source # pred :: Integer -> Integer Source # toEnum :: Int -> Integer Source # fromEnum :: Integer -> Int Source # enumFrom :: Integer -> [Integer] Source # enumFromThen :: Integer -> Integer -> [Integer] Source # enumFromTo :: Integer -> Integer -> [Integer] Source # enumFromThenTo :: Integer -> Integer -> Integer -> [Integer] Source # | |
| Enum Natural | Since: base-4.8.0.0 |
Defined in GHC.Internal.Enum Methods succ :: Natural -> Natural Source # pred :: Natural -> Natural Source # toEnum :: Int -> Natural Source # fromEnum :: Natural -> Int Source # enumFrom :: Natural -> [Natural] Source # enumFromThen :: Natural -> Natural -> [Natural] Source # enumFromTo :: Natural -> Natural -> [Natural] Source # enumFromThenTo :: Natural -> Natural -> Natural -> [Natural] Source # | |
| Enum () | Since: base-2.1 |
Defined in GHC.Internal.Enum | |
| Enum Bool | Since: base-2.1 |
| Enum Char | Since: base-2.1 |
| Enum Double |
List generators have extremely peculiar behavior, mandated by Haskell Report 2010:
Since: base-2.1 |
Defined in GHC.Internal.Float Methods succ :: Double -> Double Source # pred :: Double -> Double Source # toEnum :: Int -> Double Source # fromEnum :: Double -> Int Source # enumFrom :: Double -> [Double] Source # enumFromThen :: Double -> Double -> [Double] Source # enumFromTo :: Double -> Double -> [Double] Source # enumFromThenTo :: Double -> Double -> Double -> [Double] Source # | |
| Enum Float |
List generators have extremely peculiar behavior, mandated by Haskell Report 2010:
Since: base-2.1 |
Defined in GHC.Internal.Float Methods succ :: Float -> Float Source # pred :: Float -> Float Source # toEnum :: Int -> Float Source # fromEnum :: Float -> Int Source # enumFrom :: Float -> [Float] Source # enumFromThen :: Float -> Float -> [Float] Source # enumFromTo :: Float -> Float -> [Float] Source # enumFromThenTo :: Float -> Float -> Float -> [Float] Source # | |
| Enum Int | Since: base-2.1 |
Defined in GHC.Internal.Enum | |
| Enum Levity | Since: base-4.16.0.0 |
Defined in GHC.Internal.Enum Methods succ :: Levity -> Levity Source # pred :: Levity -> Levity Source # toEnum :: Int -> Levity Source # fromEnum :: Levity -> Int Source # enumFrom :: Levity -> [Levity] Source # enumFromThen :: Levity -> Levity -> [Levity] Source # enumFromTo :: Levity -> Levity -> [Levity] Source # enumFromThenTo :: Levity -> Levity -> Levity -> [Levity] Source # | |
| Enum VecCount | Since: base-4.10.0.0 |
Defined in GHC.Internal.Enum Methods succ :: VecCount -> VecCount Source # pred :: VecCount -> VecCount Source # toEnum :: Int -> VecCount Source # fromEnum :: VecCount -> Int Source # enumFrom :: VecCount -> [VecCount] Source # enumFromThen :: VecCount -> VecCount -> [VecCount] Source # enumFromTo :: VecCount -> VecCount -> [VecCount] Source # enumFromThenTo :: VecCount -> VecCount -> VecCount -> [VecCount] Source # | |
| Enum VecElem | Since: base-4.10.0.0 |
Defined in GHC.Internal.Enum Methods succ :: VecElem -> VecElem Source # pred :: VecElem -> VecElem Source # toEnum :: Int -> VecElem Source # fromEnum :: VecElem -> Int Source # enumFrom :: VecElem -> [VecElem] Source # enumFromThen :: VecElem -> VecElem -> [VecElem] Source # enumFromTo :: VecElem -> VecElem -> [VecElem] Source # enumFromThenTo :: VecElem -> VecElem -> VecElem -> [VecElem] Source # | |
| Enum Word | Since: base-2.1 |
| Enum a => Enum (First a) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods succ :: First a -> First a Source # pred :: First a -> First a Source # toEnum :: Int -> First a Source # fromEnum :: First a -> Int Source # enumFrom :: First a -> [First a] Source # enumFromThen :: First a -> First a -> [First a] Source # enumFromTo :: First a -> First a -> [First a] Source # enumFromThenTo :: First a -> First a -> First a -> [First a] Source # | |
| Enum a => Enum (Last a) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods succ :: Last a -> Last a Source # pred :: Last a -> Last a Source # toEnum :: Int -> Last a Source # fromEnum :: Last a -> Int Source # enumFrom :: Last a -> [Last a] Source # enumFromThen :: Last a -> Last a -> [Last a] Source # enumFromTo :: Last a -> Last a -> [Last a] Source # enumFromThenTo :: Last a -> Last a -> Last a -> [Last a] Source # | |
| Enum a => Enum (Max a) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods succ :: Max a -> Max a Source # pred :: Max a -> Max a Source # toEnum :: Int -> Max a Source # fromEnum :: Max a -> Int Source # enumFrom :: Max a -> [Max a] Source # enumFromThen :: Max a -> Max a -> [Max a] Source # enumFromTo :: Max a -> Max a -> [Max a] Source # enumFromThenTo :: Max a -> Max a -> Max a -> [Max a] Source # | |
| Enum a => Enum (Min a) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods succ :: Min a -> Min a Source # pred :: Min a -> Min a Source # toEnum :: Int -> Min a Source # fromEnum :: Min a -> Int Source # enumFrom :: Min a -> [Min a] Source # enumFromThen :: Min a -> Min a -> [Min a] Source # enumFromTo :: Min a -> Min a -> [Min a] Source # enumFromThenTo :: Min a -> Min a -> Min a -> [Min a] Source # | |
| Enum a => Enum (WrappedMonoid a) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods succ :: WrappedMonoid a -> WrappedMonoid a Source # pred :: WrappedMonoid a -> WrappedMonoid a Source # toEnum :: Int -> WrappedMonoid a Source # fromEnum :: WrappedMonoid a -> Int Source # enumFrom :: WrappedMonoid a -> [WrappedMonoid a] Source # enumFromThen :: WrappedMonoid a -> WrappedMonoid a -> [WrappedMonoid a] Source # enumFromTo :: WrappedMonoid a -> WrappedMonoid a -> [WrappedMonoid a] Source # enumFromThenTo :: WrappedMonoid a -> WrappedMonoid a -> WrappedMonoid a -> [WrappedMonoid a] Source # | |
| Integral a => Enum (Ratio a) | Since: base-2.0.1 |
Defined in GHC.Internal.Real Methods succ :: Ratio a -> Ratio a Source # pred :: Ratio a -> Ratio a Source # toEnum :: Int -> Ratio a Source # fromEnum :: Ratio a -> Int Source # enumFrom :: Ratio a -> [Ratio a] Source # enumFromThen :: Ratio a -> Ratio a -> [Ratio a] Source # enumFromTo :: Ratio a -> Ratio a -> [Ratio a] Source # enumFromThenTo :: Ratio a -> Ratio a -> Ratio a -> [Ratio a] Source # | |
| Enum a => Enum (Solo a) | |
Defined in GHC.Internal.Enum Methods succ :: Solo a -> Solo a Source # pred :: Solo a -> Solo a Source # toEnum :: Int -> Solo a Source # fromEnum :: Solo a -> Int Source # enumFrom :: Solo a -> [Solo a] Source # enumFromThen :: Solo a -> Solo a -> [Solo a] Source # enumFromTo :: Solo a -> Solo a -> [Solo a] Source # enumFromThenTo :: Solo a -> Solo a -> Solo a -> [Solo a] Source # | |
| Enum (Fixed a) | Recall that, for numeric types,
and likewise
In other words,
and similarly
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 |
Defined in Data.Fixed Methods succ :: Fixed a -> Fixed a Source # pred :: Fixed a -> Fixed a Source # toEnum :: Int -> Fixed a Source # fromEnum :: Fixed a -> Int Source # enumFrom :: Fixed a -> [Fixed a] Source # enumFromThen :: Fixed a -> Fixed a -> [Fixed a] Source # enumFromTo :: Fixed a -> Fixed a -> [Fixed a] Source # enumFromThenTo :: Fixed a -> Fixed a -> Fixed a -> [Fixed a] Source # | |
| Enum (Proxy s) | Since: base-4.7.0.0 |
Defined in GHC.Internal.Data.Proxy Methods succ :: Proxy s -> Proxy s Source # pred :: Proxy s -> Proxy s Source # toEnum :: Int -> Proxy s Source # fromEnum :: Proxy s -> Int Source # enumFrom :: Proxy s -> [Proxy s] Source # enumFromThen :: Proxy s -> Proxy s -> [Proxy s] Source # enumFromTo :: Proxy s -> Proxy s -> [Proxy s] Source # enumFromThenTo :: Proxy s -> Proxy s -> Proxy s -> [Proxy s] Source # | |
| 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 Source # pred :: Compose f g a -> Compose f g a Source # toEnum :: Int -> Compose f g a Source # fromEnum :: Compose f g a -> Int Source # enumFrom :: Compose f g a -> [Compose f g a] Source # enumFromThen :: Compose f g a -> Compose f g a -> [Compose f g a] Source # enumFromTo :: Compose f g a -> Compose f g a -> [Compose f g a] Source # enumFromThenTo :: Compose f g a -> Compose f g a -> Compose f g a -> [Compose f g a] Source # | |
Conversion of values to readable Strings.
Derived instances of Show have the following properties, which
are compatible with derived instances of Read:
- The result of
showis 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
showsPrecwill produce infix applications of the constructor. - the representation will be enclosed in parentheses if the
precedence of the top-level constructor in
xis less thand(associativity is ignored). Thus, ifdis0then the result is never surrounded in parentheses; ifdis11it is always surrounded in parentheses, unless it is an atomic expression. - If the constructor is defined using record syntax, then
showwill 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 = 5Note 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 ByteArray | Since: base-4.17.0.0 |
| Show Timeout | Since: base-4.0 |
| Show Builder | Since: bytestring-0.11.1.0 |
| Show FormatMode | |
| Show ByteString | |
Defined in Data.ByteString.Internal.Type | |
| Show SizeOverflowException | |
Defined in Data.ByteString.Internal.Type | |
| Show ByteString | |
Defined in Data.ByteString.Lazy.Internal | |
| Show ShortByteString | |
Defined in Data.ByteString.Short.Internal | |
| Show IntSet | |
| Show BitQueue | |
| Show BitQueueB | |
| Show Void | Since: base-4.8.0.0 |
| Show ByteOrder | Since: base-4.11.0.0 |
| Show NestedAtomically | Since: base-4.0 |
Defined in GHC.Internal.Control.Exception.Base | |
| Show NoMatchingContinuationPrompt | Since: base-4.18 |
Defined in GHC.Internal.Control.Exception.Base | |
| Show NoMethodError | Since: base-4.0 |
Defined in GHC.Internal.Control.Exception.Base | |
| Show NonTermination | Since: base-4.0 |
Defined in GHC.Internal.Control.Exception.Base | |
| Show PatternMatchFail | Since: base-4.0 |
Defined in GHC.Internal.Control.Exception.Base | |
| Show RecConError | Since: base-4.0 |
Defined in GHC.Internal.Control.Exception.Base | |
| Show RecSelError | Since: base-4.0 |
Defined in GHC.Internal.Control.Exception.Base | |
| Show RecUpdError | Since: base-4.0 |
Defined in GHC.Internal.Control.Exception.Base | |
| Show TypeError | Since: base-4.9.0.0 |
| Show Dynamic | Since: base-2.1 |
| Show SomeTypeRep | Since: base-4.10.0.0 |
Defined in GHC.Internal.Data.Typeable.Internal | |
| Show ErrorCall | Since: base-4.0.0.0 |
| Show ArithException | Since: base-4.0.0.0 |
Defined in GHC.Internal.Exception.Type | |
| Show SomeException | Since: ghc-internal-3.0 |
Defined in GHC.Internal.Exception.Type | |
| 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 GHC.Internal.Foreign.C.Types | |
| Show CShort | |
| Show CSigAtomic | |
Defined in GHC.Internal.Foreign.C.Types | |
| 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 Associativity | Since: base-4.6.0.0 |
Defined in GHC.Internal.Generics | |
| Show DecidedStrictness | Since: base-4.9.0.0 |
Defined in GHC.Internal.Generics | |
| Show Fixity | Since: base-4.6.0.0 |
| Show SourceStrictness | Since: base-4.9.0.0 |
Defined in GHC.Internal.Generics | |
| Show SourceUnpackedness | Since: base-4.9.0.0 |
Defined in GHC.Internal.Generics | |
| Show MaskingState | Since: base-4.3.0.0 |
Defined in GHC.Internal.IO | |
| Show BufferMode | Since: base-4.2.0.0 |
Defined in GHC.Internal.IO.Handle.Types | |
| Show Handle | Since: base-4.1.0.0 |
| Show HandleType | Since: base-4.1.0.0 |
Defined in GHC.Internal.IO.Handle.Types | |
| Show Newline | Since: base-4.3.0.0 |
| Show NewlineMode | Since: base-4.3.0.0 |
Defined in GHC.Internal.IO.Handle.Types | |
| 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 FractionalExponentBase | |
Defined in GHC.Internal.Real | |
| Show CallStack | Since: base-4.9.0.0 |
| Show SrcLoc | Since: base-4.9.0.0 |
| Show SomeChar | |
| Show SomeSymbol | Since: base-4.7.0.0 |
Defined in GHC.Internal.TypeLits | |
| 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 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.Internal.Show | |
| Show AttrOpTag Source # | |
| Show GType Source # | |
| Show UnexpectedNullPointerReturn Source # | |
Defined in Data.GI.Base.BasicTypes | |
| Show DVKey Source # | |
| Show GError Source # | |
| Show GParamFlag Source # | |
Defined in Data.GI.Base.GParamSpec | |
| Show GVariantHandle Source # | |
Defined in Data.GI.Base.GVariant | |
| Show GVariantObjectPath Source # | |
Defined in Data.GI.Base.GVariant | |
| Show GVariantSignature Source # | |
Defined in Data.GI.Base.GVariant | |
| Show ResolvedSymbolInfo Source # | |
Defined in Data.GI.Base.Overloading | |
| Show Decoding | |
| Show UnicodeException | |
Defined in Data.Text.Encoding.Error | |
| Show I8 | |
| Show Text | |
| Show Builder | |
| Show PartialUtf8CodePoint | |
| Show Utf8State | |
| Show DecoderState | |
Defined in Data.Text.Internal.Encoding.Utf8 | |
| 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 Double | Since: base-2.1 |
| Show Float | 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.Internal.Show | |
| 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 (Complex a) | Since: base-2.1 |
| 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 | |
| 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 | |
| Show a => Show (Set a) | |
| Show a => Show (Tree a) | |
| Show a => Show (NonEmpty a) | Since: base-4.11.0.0 |
| Show a => Show (ExceptionWithContext a) | |
Defined in GHC.Internal.Exception.Type | |
| Show e => Show (NoBacktrace e) | |
Defined in GHC.Internal.Exception.Type | |
| Show (ForeignPtr a) | Since: base-2.1 |
Defined in GHC.Internal.ForeignPtr | |
| 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 a => Show (HValue a) Source # | |
| Show a => Show (GVariantSinglet a) Source # | |
Defined in Data.GI.Base.GVariant | |
| 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 |
| HasResolution a => Show (Fixed a) | Since: base-2.1 |
| (Show a, Show b) => Show (Arg a b) | Since: base-4.9.0.0 |
| (Show k, Show a) => Show (Map k a) | |
| Show (Proxy s) | Since: base-4.7.0.0 |
| Show (TypeRep a) | |
| Show (U1 p) | Since: base-4.9.0.0 |
| Show (V1 p) | Since: base-4.9.0.0 |
| (Show key, Show value) => Show (GVariantDictEntry key value) Source # | |
Defined in Data.GI.Base.GVariant | |
| (Show a, Show b) => Show (a, b) | Since: base-2.1 |
| 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 |
| (Show1 f, Show a) => Show (Backwards f a) | |
| (Show1 f, Show a) => Show (IdentityT f a) | |
| Show a => Show (Constant a b) | |
| (Show1 f, Show a) => Show (Reverse f a) | |
| (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 (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 Timeout | |
| Eq ByteString | |
Defined in Data.ByteString.Internal.Type Methods (==) :: ByteString -> ByteString -> Bool Source # (/=) :: ByteString -> ByteString -> Bool Source # | |
| Eq ByteString | |
Defined in Data.ByteString.Lazy.Internal Methods (==) :: ByteString -> ByteString -> Bool Source # (/=) :: ByteString -> ByteString -> Bool Source # | |
| Eq ShortByteString | |
Defined in Data.ByteString.Short.Internal Methods (==) :: ShortByteString -> ShortByteString -> Bool Source # (/=) :: ShortByteString -> ShortByteString -> Bool Source # | |
| Eq IntSet | |
| Eq BigNat | |
| Eq Void | Since: base-4.8.0.0 |
| Eq ByteOrder | Since: base-4.11.0.0 |
| Eq SomeTypeRep | |
Defined in GHC.Internal.Data.Typeable.Internal Methods (==) :: SomeTypeRep -> SomeTypeRep -> Bool Source # (/=) :: SomeTypeRep -> SomeTypeRep -> Bool Source # | |
| Eq ErrorCall | Since: base-4.7.0.0 |
| Eq ArithException | Since: base-3.0 |
Defined in GHC.Internal.Exception.Type Methods (==) :: ArithException -> ArithException -> Bool Source # (/=) :: ArithException -> ArithException -> Bool Source # | |
| 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 GHC.Internal.Foreign.C.Types Methods (==) :: CSUSeconds -> CSUSeconds -> Bool Source # (/=) :: CSUSeconds -> CSUSeconds -> Bool Source # | |
| Eq CShort | |
| Eq CSigAtomic | |
Defined in GHC.Internal.Foreign.C.Types Methods (==) :: CSigAtomic -> CSigAtomic -> Bool Source # (/=) :: CSigAtomic -> CSigAtomic -> Bool Source # | |
| 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 Associativity | Since: base-4.6.0.0 |
Defined in GHC.Internal.Generics Methods (==) :: Associativity -> Associativity -> Bool Source # (/=) :: Associativity -> Associativity -> Bool Source # | |
| Eq DecidedStrictness | Since: base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods (==) :: DecidedStrictness -> DecidedStrictness -> Bool Source # (/=) :: DecidedStrictness -> DecidedStrictness -> Bool Source # | |
| Eq Fixity | Since: base-4.6.0.0 |
| Eq SourceStrictness | Since: base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods (==) :: SourceStrictness -> SourceStrictness -> Bool Source # (/=) :: SourceStrictness -> SourceStrictness -> Bool Source # | |
| Eq SourceUnpackedness | Since: base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods (==) :: SourceUnpackedness -> SourceUnpackedness -> Bool Source # (/=) :: SourceUnpackedness -> SourceUnpackedness -> Bool Source # | |
| Eq MaskingState | Since: base-4.3.0.0 |
Defined in GHC.Internal.IO Methods (==) :: MaskingState -> MaskingState -> Bool Source # (/=) :: MaskingState -> MaskingState -> Bool Source # | |
| Eq BufferMode | Since: base-4.2.0.0 |
Defined in GHC.Internal.IO.Handle.Types Methods (==) :: BufferMode -> BufferMode -> Bool Source # (/=) :: BufferMode -> BufferMode -> Bool Source # | |
| 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.Internal.IO.Handle.Types Methods (==) :: NewlineMode -> NewlineMode -> Bool Source # (/=) :: NewlineMode -> NewlineMode -> Bool Source # | |
| 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 SrcLoc | Since: base-4.9.0.0 |
| Eq SomeChar | |
| Eq SomeSymbol | Since: base-4.7.0.0 |
Defined in GHC.Internal.TypeLits Methods (==) :: SomeSymbol -> SomeSymbol -> Bool Source # (/=) :: SomeSymbol -> SomeSymbol -> Bool Source # | |
| 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 Module | |
| Eq Ordering | |
| Eq TrName | |
| Eq TyCon | |
| Eq AttrOpTag Source # | |
| Eq GType Source # | |
| Eq DVKey Source # | |
| Eq GParamFlag Source # | |
Defined in Data.GI.Base.GParamSpec Methods (==) :: GParamFlag -> GParamFlag -> Bool Source # (/=) :: GParamFlag -> GParamFlag -> Bool Source # | |
| Eq GVariantHandle Source # | |
Defined in Data.GI.Base.GVariant Methods (==) :: GVariantHandle -> GVariantHandle -> Bool Source # (/=) :: GVariantHandle -> GVariantHandle -> Bool Source # | |
| Eq GVariantObjectPath Source # | |
Defined in Data.GI.Base.GVariant Methods (==) :: GVariantObjectPath -> GVariantObjectPath -> Bool Source # (/=) :: GVariantObjectPath -> GVariantObjectPath -> Bool Source # | |
| Eq GVariantSignature Source # | |
Defined in Data.GI.Base.GVariant Methods (==) :: GVariantSignature -> GVariantSignature -> Bool Source # (/=) :: GVariantSignature -> GVariantSignature -> Bool Source # | |
| Eq UnicodeException | |
Defined in Data.Text.Encoding.Error Methods (==) :: UnicodeException -> UnicodeException -> Bool Source # (/=) :: UnicodeException -> UnicodeException -> Bool Source # | |
| Eq I8 | |
| Eq Text | |
| Eq Builder | |
| Eq PartialUtf8CodePoint | |
| Eq Utf8State | |
| Eq DecoderState | |
Defined in Data.Text.Internal.Encoding.Utf8 Methods (==) :: DecoderState -> DecoderState -> Bool Source # (/=) :: DecoderState -> DecoderState -> Bool Source # | |
| 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 (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 Source # (/=) :: MutableByteArray s -> MutableByteArray s -> Bool Source # | |
| Eq a => Eq (Complex a) | Since: base-2.1 |
| 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 Source # (/=) :: WrappedMonoid m -> WrappedMonoid m -> Bool Source # | |
| 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 Source # (/=) :: Intersection a -> Intersection a -> Bool Source # | |
| Eq a => Eq (Set a) | |
| Eq a => Eq (Tree a) | |
| Eq a => Eq (NonEmpty a) | Since: base-4.9.0.0 |
| Eq (ForeignPtr a) | Since: base-2.1 |
Defined in GHC.Internal.ForeignPtr Methods (==) :: ForeignPtr a -> ForeignPtr a -> Bool Source # (/=) :: ForeignPtr a -> ForeignPtr a -> Bool Source # | |
| Eq p => Eq (Par1 p) | Since: base-4.7.0.0 |
| Eq (IORef a) | Pointer equality. Since: base-4.0.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 (SChar c) | Since: base-4.19.0.0 |
| Eq (SSymbol s) | Since: base-4.19.0.0 |
| Eq (ManagedPtr a) Source # | Two |
Defined in Data.GI.Base.BasicTypes Methods (==) :: ManagedPtr a -> ManagedPtr a -> Bool Source # (/=) :: ManagedPtr a -> ManagedPtr a -> Bool Source # | |
| Eq a => Eq (HValue a) Source # | |
| Eq a => Eq (GVariantSinglet a) Source # | |
Defined in Data.GI.Base.GVariant Methods (==) :: GVariantSinglet a -> GVariantSinglet a -> Bool Source # (/=) :: GVariantSinglet a -> GVariantSinglet a -> Bool Source # | |
| Eq a => Eq (Stream a) | |
| Eq a => Eq (Maybe a) | Since: base-2.1 |
| Eq a => Eq (Solo a) | |
| Eq a => Eq [a] | |
| Eq (Fixed a) | Since: base-2.1 |
| Eq a => Eq (Arg a b) | Since: base-4.9.0.0 |
| (Eq k, Eq a) => Eq (Map k a) | |
| Eq (Proxy s) | Since: base-4.7.0.0 |
| Eq (TypeRep a) | Since: base-2.1 |
| Eq (U1 p) | Since: base-4.9.0.0 |
| Eq (V1 p) | Since: base-4.9.0.0 |
| (Eq key, Eq value) => Eq (GVariantDictEntry key value) Source # | |
Defined in Data.GI.Base.GVariant Methods (==) :: GVariantDictEntry key value -> GVariantDictEntry key value -> Bool Source # (/=) :: GVariantDictEntry key value -> GVariantDictEntry key value -> Bool Source # | |
| (Eq a, Eq b) => Eq (a, b) | |
| (Generic1 f, Eq (Rep1 f a)) => Eq (Generically1 f a) | Since: base-4.18.0.0 |
Defined in GHC.Internal.Generics Methods (==) :: Generically1 f a -> Generically1 f a -> Bool Source # (/=) :: Generically1 f a -> Generically1 f a -> Bool Source # | |
| 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 |
| (Eq1 f, Eq a) => Eq (Backwards f a) | |
| (Eq1 f, Eq a) => Eq (IdentityT f a) | |
| Eq a => Eq (Constant a b) | |
| (Eq1 f, Eq a) => Eq (Reverse f a) | |
| (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 (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
| MonadIO IO | Since: base-4.9.0.0 |
| 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 |
| MonadFail IO | Since: base-4.9.0.0 |
| MonadFix IO | Since: base-2.1 |
| 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 | |
| Monoid a => Monoid (IO a) | Since: base-4.9.0.0 |
| Semigroup a => Semigroup (IO a) | Since: base-4.10.0.0 |
class Applicative m => Monad (m :: Type -> Type) where Source #
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
returna>>=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 List, Maybe and IO
defined in the Prelude satisfy these laws.
Minimal complete definition
Methods
(>>=) :: m a -> (a -> m b) -> m b infixl 1 Source #
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
An alternative name for this function is 'bind', but some people may refer to it as 'flatMap', which results from it being equivialent to
\x f ->join(fmapf x) :: Monad m => m a -> (a -> m b) -> m b
which can be seen as mapping a value with
Monad m => m a -> m (m b) and then 'flattening' m (m b) to m b using join.
(>>) :: m a -> m b -> m b infixl 1 Source #
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
or in terms of as(>>=)
as >>= const bs
Inject a value into the monadic type.
This function should not be different from its default implementation
as pure. The justification for the existence of this function is
merely historic.
Instances
| Monad Complex | Since: base-4.9.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 Put | |
| Monad Seq | |
| Monad Tree | |
| Monad NonEmpty | Since: base-4.9.0.0 |
| Monad Par1 | Since: base-4.9.0.0 |
| 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 Source # (>>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b Source # return :: a -> WrappedMonad m a Source # | |
| Monad (SetM s) | |
| Monad (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
| Monad (U1 :: Type -> Type) | Since: base-4.9.0.0 |
| Monad (IParser t) | |
| Monoid a => Monad ((,) a) | 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 Source # (>>) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x b Source # return :: a -> WhenMissing f x a Source # | |
| Monad f => Monad (Rec1 f) | Since: base-4.9.0.0 |
| Monad m => Monad (IdentityT m) | |
| Monad m => Monad (ReaderT r m) | |
| Monad m => Monad (StateT s m) | |
| Monad m => Monad (Reverse m) | Derived instance. |
| (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, 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 Source # (>>) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y b Source # return :: a -> WhenMatched f x y a Source # | |
| (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 Source # (>>) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x b Source # return :: a -> WhenMissing f k x a Source # | |
| (Monad f, Monad g) => Monad (f :*: g) | Since: base-4.9.0.0 |
| (Monoid a, Monoid b, Monoid c) => Monad ((,,,) a b c) | Since: base-4.14.0.0 |
| Monad ((->) r) | Since: base-2.1 |
| (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 Source # (>>) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y b Source # return :: a -> WhenMatched f k x y a Source # | |
| Monad f => Monad (M1 i c f) | Since: base-4.9.0.0 |
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
| MonadZip Maybe | Since: base-4.8.0.0 | ||||
| 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 Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Maybe a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Maybe a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Maybe a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Maybe a] Source # | |||||
| Show1 Maybe | Since: base-4.9.0.0 | ||||
| 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 | ||||
| MonadFail Maybe | Since: base-4.9.0.0 | ||||
| MonadFix Maybe | Since: base-2.1 | ||||
| Foldable Maybe | Since: base-2.1 | ||||
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Maybe m -> m Source # foldMap :: Monoid m => (a -> m) -> Maybe a -> m Source # foldMap' :: Monoid m => (a -> m) -> Maybe a -> m Source # foldr :: (a -> b -> b) -> b -> Maybe a -> b Source # foldr' :: (a -> b -> b) -> b -> Maybe a -> b Source # foldl :: (b -> a -> b) -> b -> Maybe a -> b Source # foldl' :: (b -> a -> b) -> b -> Maybe a -> b Source # foldr1 :: (a -> a -> a) -> Maybe a -> a Source # foldl1 :: (a -> a -> a) -> Maybe a -> a Source # toList :: Maybe a -> [a] Source # null :: Maybe a -> Bool Source # length :: Maybe a -> Int Source # elem :: Eq a => a -> Maybe a -> Bool Source # maximum :: Ord a => Maybe a -> a Source # minimum :: Ord a => Maybe a -> a Source # | |||||
| Traversable Maybe | Since: base-2.1 | ||||
Defined in GHC.Internal.Data.Traversable | |||||
| Generic1 Maybe | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Eq a => EqMaybe a (Maybe a) Source # | |||||
| Each () (Maybe a) (Maybe b) a b |
| ||||
Defined in Optics.Each.Core | |||||
| 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.Internal.Generics Associated Types
| |||||
| SingKind a => SingKind (Maybe a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| 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 | ||||
Defined in GHC.Internal.Maybe | |||||
| 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 | |||||
| At (Maybe a) | |||||
| Ixed (Maybe a) | |||||
| AsEmpty (Maybe a) | |||||
| SingI ('Nothing :: Maybe a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| SingI a2 => SingI ('Just a2 :: Maybe a1) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| type Rep1 Maybe | Since: base-4.6.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| type DemoteRep (Maybe a) | |||||
Defined in GHC.Internal.Generics | |||||
| type Rep (Maybe a) | Since: base-4.6.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| data Sing (b :: Maybe a) | |||||
| type Index (Maybe a) | |||||
Defined in Optics.At.Core | |||||
| type IxKind (Maybe a) | |||||
Defined in Optics.At.Core | |||||
| type IxValue (Maybe a) | |||||
Defined in Optics.At.Core | |||||
(.) :: (b -> c) -> (a -> b) -> a -> c infixr 9 Source #
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)] 225
>>>let (...) = (.).(.) in ((*2)...(+)) 5 1030
($) :: (a -> b) -> a -> b infixr 0 Source #
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 ida -> 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->IntstrSum s =sum(mapMaybereadMaybe(wordss))
we can deploy the function application operator:
-- | Sum numbers in a string: strSum "100 5 -7" == 98 strSum ::String->IntstrSum s =sum$mapMaybereadMaybe$wordss
($) 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 Source #
(++) 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 Source #
Same as >>=, but with the arguments interchanged.
as >>= f == f =<< as
Instances
| Bits Bool | Interpret Since: base-4.7.0.0 | ||||
Defined in GHC.Internal.Bits Methods (.&.) :: Bool -> Bool -> Bool Source # (.|.) :: Bool -> Bool -> Bool Source # xor :: Bool -> Bool -> Bool Source # complement :: Bool -> Bool Source # shift :: Bool -> Int -> Bool Source # rotate :: Bool -> Int -> Bool Source # setBit :: Bool -> Int -> Bool Source # clearBit :: Bool -> Int -> Bool Source # complementBit :: Bool -> Int -> Bool Source # testBit :: Bool -> Int -> Bool Source # bitSizeMaybe :: Bool -> Maybe Int Source # bitSize :: Bool -> Int Source # isSigned :: Bool -> Bool Source # shiftL :: Bool -> Int -> Bool Source # unsafeShiftL :: Bool -> Int -> Bool Source # shiftR :: Bool -> Int -> Bool Source # unsafeShiftR :: Bool -> Int -> Bool Source # rotateL :: Bool -> Int -> Bool Source # | |||||
| FiniteBits Bool | Since: base-4.7.0.0 | ||||
Defined in GHC.Internal.Bits Methods finiteBitSize :: Bool -> Int Source # countLeadingZeros :: Bool -> Int Source # countTrailingZeros :: Bool -> Int Source # | |||||
| Bounded Bool | Since: base-2.1 | ||||
| Enum Bool | Since: base-2.1 | ||||
| Storable Bool | Since: base-2.1 | ||||
Defined in GHC.Internal.Foreign.Storable Methods sizeOf :: Bool -> Int Source # alignment :: Bool -> Int Source # peekElemOff :: Ptr Bool -> Int -> IO Bool Source # pokeElemOff :: Ptr Bool -> Int -> Bool -> IO () Source # peekByteOff :: Ptr b -> Int -> IO Bool Source # pokeByteOff :: Ptr b -> Int -> Bool -> IO () Source # | |||||
| Generic Bool | |||||
Defined in GHC.Internal.Generics | |||||
| SingKind Bool | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| 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.Internal.Generics | |||||
| SingI 'True | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| type DemoteRep Bool | |||||
Defined in GHC.Internal.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
| PrintfArg Float | Since: base-2.1 | ||||
Defined in Text.Printf | |||||
| Enum Float |
List generators have extremely peculiar behavior, mandated by Haskell Report 2010:
Since: base-2.1 | ||||
Defined in GHC.Internal.Float Methods succ :: Float -> Float Source # pred :: Float -> Float Source # toEnum :: Int -> Float Source # fromEnum :: Float -> Int Source # enumFrom :: Float -> [Float] Source # enumFromThen :: Float -> Float -> [Float] Source # enumFromTo :: Float -> Float -> [Float] Source # enumFromThenTo :: Float -> Float -> Float -> [Float] Source # | |||||
| Floating Float | Since: base-2.1 | ||||
Defined in GHC.Internal.Float Methods exp :: Float -> Float Source # log :: Float -> Float Source # sqrt :: Float -> Float Source # (**) :: Float -> Float -> Float Source # logBase :: Float -> Float -> Float Source # sin :: Float -> Float Source # cos :: Float -> Float Source # tan :: Float -> Float Source # asin :: Float -> Float Source # acos :: Float -> Float Source # atan :: Float -> Float Source # sinh :: Float -> Float Source # cosh :: Float -> Float Source # tanh :: Float -> Float Source # asinh :: Float -> Float Source # acosh :: Float -> Float Source # atanh :: Float -> Float Source # log1p :: Float -> Float Source # expm1 :: Float -> Float Source # | |||||
| RealFloat Float | Since: base-2.1 | ||||
Defined in GHC.Internal.Float Methods floatRadix :: Float -> Integer Source # floatDigits :: Float -> Int Source # floatRange :: Float -> (Int, Int) Source # decodeFloat :: Float -> (Integer, Int) Source # encodeFloat :: Integer -> Int -> Float Source # exponent :: Float -> Int Source # significand :: Float -> Float Source # scaleFloat :: Int -> Float -> Float Source # isNaN :: Float -> Bool Source # isInfinite :: Float -> Bool Source # isDenormalized :: Float -> Bool Source # isNegativeZero :: Float -> Bool Source # | |||||
| Storable Float | Since: base-2.1 | ||||
Defined in GHC.Internal.Foreign.Storable Methods sizeOf :: Float -> Int Source # alignment :: Float -> Int Source # peekElemOff :: Ptr Float -> Int -> IO Float Source # pokeElemOff :: Ptr Float -> Int -> Float -> IO () Source # peekByteOff :: Ptr b -> Int -> IO Float Source # pokeByteOff :: Ptr b -> Int -> Float -> IO () Source # | |||||
| Num Float | This instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero. Neither addition nor multiplication are associative or distributive:
Since: base-2.1 | ||||
| Fractional Float | This instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero.
Since: base-2.1 | ||||
| Real Float | Beware that
Since: base-2.1 | ||||
Defined in GHC.Internal.Float Methods toRational :: Float -> Rational Source # | |||||
| RealFrac Float | Beware that results for non-finite arguments are garbage:
and get even more non-sensical if you ask for Since: base-2.1 | ||||
| Show Float | Since: base-2.1 | ||||
| Eq Float | Note that due to the presence of
Also note that
| ||||
| Ord Float | See | ||||
Defined in GHC.Classes | |||||
| IsGValue Float Source # | |||||
Defined in Data.GI.Base.GValue | |||||
| Generic1 (URec Float :: k -> Type) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Foldable (UFloat :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => UFloat m -> m Source # foldMap :: Monoid m => (a -> m) -> UFloat a -> m Source # foldMap' :: Monoid m => (a -> m) -> UFloat a -> m Source # foldr :: (a -> b -> b) -> b -> UFloat a -> b Source # foldr' :: (a -> b -> b) -> b -> UFloat a -> b Source # foldl :: (b -> a -> b) -> b -> UFloat a -> b Source # foldl' :: (b -> a -> b) -> b -> UFloat a -> b Source # foldr1 :: (a -> a -> a) -> UFloat a -> a Source # foldl1 :: (a -> a -> a) -> UFloat a -> a Source # toList :: UFloat a -> [a] Source # null :: UFloat a -> Bool Source # length :: UFloat a -> Int Source # elem :: Eq a => a -> UFloat a -> Bool Source # maximum :: Ord a => UFloat a -> a Source # minimum :: Ord a => UFloat a -> a Source # | |||||
| Traversable (UFloat :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Traversable | |||||
| Functor (URec Float :: Type -> Type) | Since: base-4.9.0.0 | ||||
| Generic (URec Float p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Show (URec Float p) | |||||
| Eq (URec Float p) | |||||
| Ord (URec Float p) | |||||
Defined in GHC.Internal.Generics Methods compare :: URec Float p -> URec Float p -> Ordering Source # (<) :: URec Float p -> URec Float p -> Bool Source # (<=) :: URec Float p -> URec Float p -> Bool Source # (>) :: URec Float p -> URec Float p -> Bool Source # (>=) :: URec Float p -> URec Float p -> Bool Source # max :: URec Float p -> URec Float p -> URec Float p Source # min :: URec Float p -> URec Float p -> URec Float p Source # | |||||
| 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.Internal.Generics | |||||
| type Rep (URec Float p) | |||||
Defined in GHC.Internal.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
| PrintfArg Double | Since: base-2.1 | ||||
Defined in Text.Printf Methods formatArg :: Double -> FieldFormatter Source # parseFormat :: Double -> ModifierParser Source # | |||||
| Enum Double |
List generators have extremely peculiar behavior, mandated by Haskell Report 2010:
Since: base-2.1 | ||||
Defined in GHC.Internal.Float Methods succ :: Double -> Double Source # pred :: Double -> Double Source # toEnum :: Int -> Double Source # fromEnum :: Double -> Int Source # enumFrom :: Double -> [Double] Source # enumFromThen :: Double -> Double -> [Double] Source # enumFromTo :: Double -> Double -> [Double] Source # enumFromThenTo :: Double -> Double -> Double -> [Double] Source # | |||||
| Floating Double | Since: base-2.1 | ||||
Defined in GHC.Internal.Float Methods exp :: Double -> Double Source # log :: Double -> Double Source # sqrt :: Double -> Double Source # (**) :: Double -> Double -> Double Source # logBase :: Double -> Double -> Double Source # sin :: Double -> Double Source # cos :: Double -> Double Source # tan :: Double -> Double Source # asin :: Double -> Double Source # acos :: Double -> Double Source # atan :: Double -> Double Source # sinh :: Double -> Double Source # cosh :: Double -> Double Source # tanh :: Double -> Double Source # asinh :: Double -> Double Source # acosh :: Double -> Double Source # atanh :: Double -> Double Source # log1p :: Double -> Double Source # expm1 :: Double -> Double Source # | |||||
| RealFloat Double | Since: base-2.1 | ||||
Defined in GHC.Internal.Float Methods floatRadix :: Double -> Integer Source # floatDigits :: Double -> Int Source # floatRange :: Double -> (Int, Int) Source # decodeFloat :: Double -> (Integer, Int) Source # encodeFloat :: Integer -> Int -> Double Source # exponent :: Double -> Int Source # significand :: Double -> Double Source # scaleFloat :: Int -> Double -> Double Source # isNaN :: Double -> Bool Source # isInfinite :: Double -> Bool Source # isDenormalized :: Double -> Bool Source # isNegativeZero :: Double -> Bool Source # | |||||
| Storable Double | Since: base-2.1 | ||||
Defined in GHC.Internal.Foreign.Storable Methods sizeOf :: Double -> Int Source # alignment :: Double -> Int Source # peekElemOff :: Ptr Double -> Int -> IO Double Source # pokeElemOff :: Ptr Double -> Int -> Double -> IO () Source # peekByteOff :: Ptr b -> Int -> IO Double Source # pokeByteOff :: Ptr b -> Int -> Double -> IO () Source # | |||||
| Num Double | This instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero. Neither addition nor multiplication are associative or distributive:
Since: base-2.1 | ||||
Defined in GHC.Internal.Float | |||||
| Fractional Double | This instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero.
Since: base-2.1 | ||||
| Real Double | Beware that
Since: base-2.1 | ||||
Defined in GHC.Internal.Float Methods toRational :: Double -> Rational Source # | |||||
| RealFrac Double | Beware that results for non-finite arguments are garbage:
and get even more non-sensical if you ask for Since: base-2.1 | ||||
| Show Double | Since: base-2.1 | ||||
| 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.Internal.Generics Associated Types
| |||||
| Foldable (UDouble :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => UDouble m -> m Source # foldMap :: Monoid m => (a -> m) -> UDouble a -> m Source # foldMap' :: Monoid m => (a -> m) -> UDouble a -> m Source # foldr :: (a -> b -> b) -> b -> UDouble a -> b Source # foldr' :: (a -> b -> b) -> b -> UDouble a -> b Source # foldl :: (b -> a -> b) -> b -> UDouble a -> b Source # foldl' :: (b -> a -> b) -> b -> UDouble a -> b Source # foldr1 :: (a -> a -> a) -> UDouble a -> a Source # foldl1 :: (a -> a -> a) -> UDouble a -> a Source # toList :: UDouble a -> [a] Source # null :: UDouble a -> Bool Source # length :: UDouble a -> Int Source # elem :: Eq a => a -> UDouble a -> Bool Source # maximum :: Ord a => UDouble a -> a Source # minimum :: Ord a => UDouble a -> a Source # | |||||
| Traversable (UDouble :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Traversable | |||||
| Functor (URec Double :: Type -> Type) | Since: base-4.9.0.0 | ||||
| Generic (URec Double p) | |||||
Defined in GHC.Internal.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.Internal.Generics Methods compare :: URec Double p -> URec Double p -> Ordering Source # (<) :: URec Double p -> URec Double p -> Bool Source # (<=) :: URec Double p -> URec Double p -> Bool Source # (>) :: URec Double p -> URec Double p -> Bool Source # (>=) :: URec Double p -> URec Double p -> Bool Source # max :: URec Double p -> URec Double p -> URec Double p Source # min :: URec Double p -> URec Double p -> URec Double p Source # | |||||
| 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.Internal.Generics | |||||
| type Rep (URec Double p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
undefined :: HasCallStack => a Source #
map :: (a -> b) -> [a] -> [b] Source #
\(\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 Source #
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) Source #
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 () Source #
Conditional execution of Applicative expressions. For example,
Examples
when debug (putStrLn "Debugging")
will output the string Debugging if the Boolean value debug
is True, and otherwise do nothing.
>>>putStr "pi:" >> when False (print 3.14159)pi:
fromIntegral :: (Integral a, Num b) => a -> b Source #
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 Source #
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