| Safe Haskell | Unsafe |
|---|---|
| Language | Haskell2010 |
Protolude.Base
Synopsis
- module GHC.OverloadedLabels
- module GHC.Records
- data Int
- data Float = F# Float#
- data Char
- data IO a
- data Bool
- data Double = D# Double#
- data Word
- data Ordering
- class a ~R# b => Coercible (a :: k) (b :: k)
- data Symbol
- data Integer
- type Type = TYPE LiftedRep
- type Constraint = CONSTRAINT LiftedRep
- callStack :: HasCallStack => CallStack
- class Show a where
- even :: Integral a => a -> Bool
- class Enum a where
- succ :: a -> a
- pred :: a -> a
- toEnum :: Int -> a
- fromEnum :: a -> Int
- enumFrom :: a -> [a]
- enumFromThen :: a -> a -> [a]
- enumFromTo :: a -> a -> [a]
- enumFromThenTo :: a -> a -> a -> [a]
- class (Real a, Enum a) => Integral a where
- type Rational = Ratio Integer
- data Ptr a
- ord :: Char -> Int
- putStrLn :: String -> IO ()
- (++) :: [a] -> [a] -> [a]
- seq :: a -> b -> b
- print :: Show a => a -> IO ()
- class Num a where
- class Num a => Fractional a where
- (/) :: a -> a -> a
- recip :: a -> a
- fromRational :: Rational -> a
- fromIntegral :: (Integral a, Num b) => a -> b
- realToFrac :: (Real a, Fractional b) => a -> b
- class (Num a, Ord a) => Real a where
- toRational :: a -> Rational
- class Bounded a where
- class Fractional a => Floating a where
- pi :: a
- exp :: a -> a
- log :: a -> a
- sqrt :: a -> a
- (**) :: a -> a -> a
- logBase :: a -> a -> a
- sin :: a -> a
- cos :: a -> a
- tan :: a -> a
- asin :: a -> a
- acos :: a -> a
- atan :: a -> a
- sinh :: a -> a
- cosh :: a -> a
- tanh :: a -> a
- asinh :: a -> a
- acosh :: a -> a
- atanh :: a -> a
- log1p :: a -> a
- expm1 :: a -> a
- log1pexp :: a -> a
- log1mexp :: a -> a
- class (RealFrac a, Floating a) => RealFloat a where
- floatRadix :: a -> Integer
- floatDigits :: a -> Int
- floatRange :: a -> (Int, Int)
- decodeFloat :: a -> (Integer, Int)
- encodeFloat :: Integer -> Int -> a
- exponent :: a -> Int
- significand :: a -> a
- scaleFloat :: Int -> a -> a
- isNaN :: a -> Bool
- isInfinite :: a -> Bool
- isDenormalized :: a -> Bool
- isNegativeZero :: a -> Bool
- isIEEE :: a -> Bool
- atan2 :: a -> a -> a
- class (Real a, Fractional a) => RealFrac a where
- class KnownNat (n :: Nat)
- class KnownSymbol (n :: Symbol)
- data Ratio a
- data FunPtr a
- data StaticPtr a
- data CallStack
- (^) :: (Num a, Integral b) => a -> b -> a
- type family CmpNat (a :: Natural) (b :: Natural) :: Ordering where ...
- data SrcLoc = SrcLoc String Int Int
- type HasCallStack = ?callStack :: CallStack
- getCallStack :: CallStack -> [([Char], SrcLoc)]
- minInt :: Int
- maxInt :: Int
- until :: (a -> Bool) -> (a -> a) -> a -> a
- asTypeOf :: a -> a -> a
- currentCallStack :: IO [String]
- subtract :: Num a => a -> a -> a
- boundedEnumFrom :: (Enum a, Bounded a) => a -> [a]
- boundedEnumFromThen :: (Enum a, Bounded a) => a -> a -> [a]
- divZeroError :: a
- ratioZeroDenominatorError :: a
- overflowError :: a
- underflowError :: a
- ratioPrec :: Int
- ratioPrec1 :: Int
- infinity :: Rational
- notANumber :: Rational
- reduce :: Integral a => a -> a -> Ratio a
- (%) :: Integral a => a -> a -> Ratio a
- numerator :: Ratio a -> a
- denominator :: Ratio a -> a
- numericEnumFrom :: Fractional a => a -> [a]
- numericEnumFromThen :: Fractional a => a -> a -> [a]
- numericEnumFromTo :: (Ord a, Fractional a) => a -> a -> [a]
- numericEnumFromThenTo :: (Ord a, Fractional a) => a -> a -> a -> [a]
- showSigned :: Real a => (a -> ShowS) -> Int -> a -> ShowS
- odd :: Integral a => a -> Bool
- (^^) :: (Fractional a, Integral b) => a -> b -> a
- (^%^) :: Integral a => Rational -> a -> Rational
- (^^%^^) :: Integral a => Rational -> a -> Rational
- gcd :: Integral a => a -> a -> a
- lcm :: Integral a => a -> a -> a
- integralEnumFrom :: (Integral a, Bounded a) => a -> [a]
- integralEnumFromThen :: (Integral a, Bounded a) => a -> a -> [a]
- integralEnumFromTo :: Integral a => a -> a -> [a]
- integralEnumFromThenTo :: Integral a => a -> a -> a -> [a]
- showFloat :: RealFloat a => a -> ShowS
- showSignedFloat :: RealFloat a => (a -> ShowS) -> Int -> a -> ShowS
- data SomeNat = KnownNat n => SomeNat (Proxy n)
- type Nat = Natural
- natVal :: forall (n :: Nat) proxy. KnownNat n => proxy n -> Integer
- someNatVal :: Integer -> Maybe SomeNat
- data SomeSymbol = KnownSymbol n => SomeSymbol (Proxy n)
- symbolVal :: forall (n :: Symbol) proxy. KnownSymbol n => proxy n -> String
- someSymbolVal :: String -> SomeSymbol
- prettySrcLoc :: SrcLoc -> String
- prettyCallStack :: CallStack -> String
- putStr :: String -> IO ()
- withFrozenCallStack :: HasCallStack => (HasCallStack => a) -> a
- data Location = Location {
- objectName :: String
- functionName :: String
- srcLoc :: Maybe SrcLoc
- getStackTrace :: IO (Maybe [Location])
- showStackTrace :: IO (Maybe String)
- ($!) :: (a -> b) -> a -> b
Documentation
module GHC.OverloadedLabels
module GHC.Records
A fixed-precision integer type with at least the range [-2^29 .. 2^29-1].
The exact range for a given implementation can be determined by using
minBound and maxBound from the Bounded class.
Instances
| Data Int | Since: base-4.0.0.0 | ||||
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Int -> c Int # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Int # dataTypeOf :: Int -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Int) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Int) # gmapT :: (forall b. Data b => b -> b) -> Int -> Int # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Int -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Int -> r # gmapQ :: (forall d. Data d => d -> u) -> Int -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Int -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Int -> m Int # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Int -> m Int # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Int -> m Int # | |||||
| Storable Int | Since: base-2.1 | ||||
Defined in Foreign.Storable | |||||
| Bits Int | Since: base-2.1 | ||||
Defined in GHC.Bits | |||||
| FiniteBits Int | Since: base-4.6.0.0 | ||||
Defined in GHC.Bits Methods finiteBitSize :: Int -> Int # countLeadingZeros :: Int -> Int # countTrailingZeros :: Int -> Int # | |||||
| Bounded Int | Since: base-2.1 | ||||
| Enum Int | Since: base-2.1 | ||||
| Ix Int | Since: base-2.1 | ||||
| Num Int | Since: base-2.1 | ||||
| Read Int | Since: base-2.1 | ||||
| Integral Int | Since: base-2.0.1 | ||||
| Real Int | Since: base-2.0.1 | ||||
Defined in GHC.Real Methods toRational :: Int -> Rational # | |||||
| Show Int | Since: base-2.1 | ||||
| PrintfArg Int | Since: base-2.1 | ||||
Defined in Text.Printf | |||||
| NFData Int | |||||
Defined in Control.DeepSeq | |||||
| Eq Int | |||||
| Ord Int | |||||
| Hashable Int | |||||
Defined in Data.Hashable.Class | |||||
| IArray UArray Int | |||||
Defined in Data.Array.Base Methods bounds :: Ix i => UArray i Int -> (i, i) # numElements :: Ix i => UArray i Int -> Int # unsafeArray :: Ix i => (i, i) -> [(Int, Int)] -> UArray i Int # unsafeAt :: Ix i => UArray i Int -> Int -> Int # unsafeReplace :: Ix i => UArray i Int -> [(Int, Int)] -> UArray i Int # unsafeAccum :: Ix i => (Int -> e' -> Int) -> UArray i Int -> [(Int, e')] -> UArray i Int # unsafeAccumArray :: Ix i => (Int -> e' -> Int) -> Int -> (i, i) -> [(Int, e')] -> UArray i Int # | |||||
| Lift Int | |||||
| MArray IOUArray Int IO | |||||
Defined in Data.Array.IO.Internals Methods getBounds :: Ix i => IOUArray i Int -> IO (i, i) # getNumElements :: Ix i => IOUArray i Int -> IO Int # newArray :: Ix i => (i, i) -> Int -> IO (IOUArray i Int) # newArray_ :: Ix i => (i, i) -> IO (IOUArray i Int) # unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Int) # unsafeRead :: Ix i => IOUArray i Int -> Int -> IO Int # unsafeWrite :: Ix i => IOUArray i Int -> Int -> Int -> IO () # | |||||
| GEq1 v (UInt :: Type -> Type) | |||||
| GOrd1 v (UInt :: Type -> Type) | |||||
Defined in Data.Functor.Classes.Generic.Internal | |||||
| GShow1Con v (UInt :: Type -> Type) | |||||
Defined in Data.Functor.Classes.Generic.Internal | |||||
| Generic1 (URec Int :: k -> Type) | |||||
Defined in GHC.Generics Associated Types
| |||||
| Foldable (UInt :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in Data.Foldable Methods fold :: Monoid m => UInt m -> m # foldMap :: Monoid m => (a -> m) -> UInt a -> m # foldMap' :: Monoid m => (a -> m) -> UInt a -> m # foldr :: (a -> b -> b) -> b -> UInt a -> b # foldr' :: (a -> b -> b) -> b -> UInt a -> b # foldl :: (b -> a -> b) -> b -> UInt a -> b # foldl' :: (b -> a -> b) -> b -> UInt a -> b # foldr1 :: (a -> a -> a) -> UInt a -> a # foldl1 :: (a -> a -> a) -> UInt a -> a # elem :: Eq a => a -> UInt a -> Bool # maximum :: Ord a => UInt a -> a # | |||||
| Traversable (UInt :: Type -> Type) | Since: base-4.9.0.0 | ||||
| IsNullaryCon (UInt :: Type -> Type) | |||||
Defined in Data.Functor.Classes.Generic.Internal Methods isNullaryCon :: UInt a -> Bool # | |||||
| MArray (STUArray s) Int (ST s) | |||||
Defined in Data.Array.Base Methods getBounds :: Ix i => STUArray s i Int -> ST s (i, i) # getNumElements :: Ix i => STUArray s i Int -> ST s Int # newArray :: Ix i => (i, i) -> Int -> ST s (STUArray s i Int) # newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int) # unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int) # unsafeRead :: Ix i => STUArray s i Int -> Int -> ST s Int # unsafeWrite :: Ix i => STUArray s i Int -> Int -> Int -> ST s () # | |||||
| Functor (URec Int :: Type -> Type) | Since: base-4.9.0.0 | ||||
| GEq (UInt p) | |||||
| GOrd (UInt p) | |||||
| GShowCon (UInt p) | |||||
Defined in Data.Functor.Classes.Generic.Internal | |||||
| Generic (URec Int p) | |||||
Defined in GHC.Generics Associated Types
| |||||
| Show (URec Int p) | Since: base-4.9.0.0 | ||||
| Eq (URec Int p) | Since: base-4.9.0.0 | ||||
| Ord (URec Int p) | Since: base-4.9.0.0 | ||||
| data URec Int (p :: k) | Used for marking occurrences of Since: base-4.9.0.0 | ||||
| type Rep1 (URec Int :: k -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
| type Rep (URec Int p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
Single-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE single-precision type.
Instances
| Data Float | Since: base-4.0.0.0 | ||||
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Float -> c Float # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Float # dataTypeOf :: Float -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Float) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Float) # gmapT :: (forall b. Data b => b -> b) -> Float -> Float # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Float -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Float -> r # gmapQ :: (forall d. Data d => d -> u) -> Float -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Float -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Float -> m Float # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Float -> m Float # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Float -> m Float # | |||||
| Storable Float | Since: base-2.1 | ||||
| Floating Float | Since: base-2.1 | ||||
| RealFloat Float | Since: base-2.1 | ||||
Defined in GHC.Float Methods floatRadix :: Float -> Integer # floatDigits :: Float -> Int # floatRange :: Float -> (Int, Int) # decodeFloat :: Float -> (Integer, Int) # encodeFloat :: Integer -> Int -> Float # significand :: Float -> Float # scaleFloat :: Int -> Float -> Float # isInfinite :: Float -> Bool # isDenormalized :: Float -> Bool # isNegativeZero :: Float -> Bool # | |||||
| Read Float | Since: base-2.1 | ||||
| PrintfArg Float | Since: base-2.1 | ||||
Defined in Text.Printf | |||||
| NFData Float | |||||
Defined in Control.DeepSeq | |||||
| Eq Float | Note that due to the presence of
Also note that
| ||||
| Ord Float | See | ||||
| Hashable Float | Note: prior to The Since: hashable-1.3.0.0 | ||||
Defined in Data.Hashable.Class | |||||
| IArray UArray Float | |||||
Defined in Data.Array.Base Methods bounds :: Ix i => UArray i Float -> (i, i) # numElements :: Ix i => UArray i Float -> Int # unsafeArray :: Ix i => (i, i) -> [(Int, Float)] -> UArray i Float # unsafeAt :: Ix i => UArray i Float -> Int -> Float # unsafeReplace :: Ix i => UArray i Float -> [(Int, Float)] -> UArray i Float # unsafeAccum :: Ix i => (Float -> e' -> Float) -> UArray i Float -> [(Int, e')] -> UArray i Float # unsafeAccumArray :: Ix i => (Float -> e' -> Float) -> Float -> (i, i) -> [(Int, e')] -> UArray i Float # | |||||
| Lift Float | |||||
| MArray IOUArray Float IO | |||||
Defined in Data.Array.IO.Internals Methods getBounds :: Ix i => IOUArray i Float -> IO (i, i) # getNumElements :: Ix i => IOUArray i Float -> IO Int # newArray :: Ix i => (i, i) -> Float -> IO (IOUArray i Float) # newArray_ :: Ix i => (i, i) -> IO (IOUArray i Float) # unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Float) # unsafeRead :: Ix i => IOUArray i Float -> Int -> IO Float # unsafeWrite :: Ix i => IOUArray i Float -> Int -> Float -> IO () # | |||||
| GEq1 v (UFloat :: Type -> Type) | |||||
| GOrd1 v (UFloat :: Type -> Type) | |||||
Defined in Data.Functor.Classes.Generic.Internal | |||||
| GShow1Con v (UFloat :: Type -> Type) | |||||
Defined in Data.Functor.Classes.Generic.Internal | |||||
| Generic1 (URec Float :: k -> Type) | |||||
Defined in GHC.Generics Associated Types
| |||||
| Foldable (UFloat :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in Data.Foldable Methods fold :: Monoid m => UFloat m -> m # foldMap :: Monoid m => (a -> m) -> UFloat a -> m # foldMap' :: Monoid m => (a -> m) -> UFloat a -> m # foldr :: (a -> b -> b) -> b -> UFloat a -> b # foldr' :: (a -> b -> b) -> b -> UFloat a -> b # foldl :: (b -> a -> b) -> b -> UFloat a -> b # foldl' :: (b -> a -> b) -> b -> UFloat a -> b # foldr1 :: (a -> a -> a) -> UFloat a -> a # foldl1 :: (a -> a -> a) -> UFloat a -> a # elem :: Eq a => a -> UFloat a -> Bool # maximum :: Ord a => UFloat a -> a # minimum :: Ord a => UFloat a -> a # | |||||
| Traversable (UFloat :: Type -> Type) | Since: base-4.9.0.0 | ||||
| IsNullaryCon (UFloat :: Type -> Type) | |||||
Defined in Data.Functor.Classes.Generic.Internal Methods isNullaryCon :: UFloat a -> Bool # | |||||
| MArray (STUArray s) Float (ST s) | |||||
Defined in Data.Array.Base Methods getBounds :: Ix i => STUArray s i Float -> ST s (i, i) # getNumElements :: Ix i => STUArray s i Float -> ST s Int # newArray :: Ix i => (i, i) -> Float -> ST s (STUArray s i Float) # newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Float) # unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Float) # unsafeRead :: Ix i => STUArray s i Float -> Int -> ST s Float # unsafeWrite :: Ix i => STUArray s i Float -> Int -> Float -> ST s () # | |||||
| Functor (URec Float :: Type -> Type) | Since: base-4.9.0.0 | ||||
| GEq (UFloat p) | |||||
| GOrd (UFloat p) | |||||
| GShowCon (UFloat p) | |||||
Defined in Data.Functor.Classes.Generic.Internal | |||||
| Generic (URec Float p) | |||||
Defined in GHC.Generics Associated Types
| |||||
| Show (URec Float p) | |||||
| Eq (URec Float p) | |||||
| Ord (URec Float p) | |||||
Defined in GHC.Generics | |||||
| data URec Float (p :: k) | Used for marking occurrences of Since: base-4.9.0.0 | ||||
| type Rep1 (URec Float :: k -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
| type Rep (URec Float p) | |||||
Defined in GHC.Generics | |||||
The character type Char represents Unicode codespace
and its elements are code points as in definitions
D9 and D10 of the Unicode Standard.
Character literals in Haskell are single-quoted: 'Q', 'Я' or 'Ω'.
To represent a single quote itself use '\'', and to represent a backslash
use '\\'. The full grammar can be found in the section 2.6 of the
Haskell 2010 Language Report.
To specify a character by its code point one can use decimal, hexadecimal
or octal notation: '\65', '\x41' and '\o101' are all alternative forms
of 'A'. The largest code point is '\x10ffff'.
There is a special escape syntax for ASCII control characters:
| Escape | Alternatives | Meaning |
|---|---|---|
'\NUL' | '\0' | null character |
'\SOH' | '\1' | start of heading |
'\STX' | '\2' | start of text |
'\ETX' | '\3' | end of text |
'\EOT' | '\4' | end of transmission |
'\ENQ' | '\5' | enquiry |
'\ACK' | '\6' | acknowledge |
'\BEL' | '\7', '\a' | bell (alert) |
'\BS' | '\8', '\b' | backspace |
'\HT' | '\9', '\t' | horizontal tab |
'\LF' | '\10', '\n' | line feed (new line) |
'\VT' | '\11', '\v' | vertical tab |
'\FF' | '\12', '\f' | form feed |
'\CR' | '\13', '\r' | carriage return |
'\SO' | '\14' | shift out |
'\SI' | '\15' | shift in |
'\DLE' | '\16' | data link escape |
'\DC1' | '\17' | device control 1 |
'\DC2' | '\18' | device control 2 |
'\DC3' | '\19' | device control 3 |
'\DC4' | '\20' | device control 4 |
'\NAK' | '\21' | negative acknowledge |
'\SYN' | '\22' | synchronous idle |
'\ETB' | '\23' | end of transmission block |
'\CAN' | '\24' | cancel |
'\EM' | '\25' | end of medium |
'\SUB' | '\26' | substitute |
'\ESC' | '\27' | escape |
'\FS' | '\28' | file separator |
'\GS' | '\29' | group separator |
'\RS' | '\30' | record separator |
'\US' | '\31' | unit separator |
'\SP' | '\32', ' ' | space |
'\DEL' | '\127' | delete |
Instances
| Data Char | Since: base-4.0.0.0 | ||||
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Char -> c Char # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Char # dataTypeOf :: Char -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Char) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Char) # gmapT :: (forall b. Data b => b -> b) -> Char -> Char # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Char -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Char -> r # gmapQ :: (forall d. Data d => d -> u) -> Char -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Char -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Char -> m Char # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Char -> m Char # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Char -> m Char # | |||||
| Storable Char | Since: base-2.1 | ||||
Defined in Foreign.Storable | |||||
| Bounded Char | Since: base-2.1 | ||||
| Enum Char | Since: base-2.1 | ||||
| Ix Char | Since: base-2.1 | ||||
| Read Char | Since: base-2.1 | ||||
| Show Char | Since: base-2.1 | ||||
| IsChar Char | Since: base-2.1 | ||||
| PrintfArg Char | Since: base-2.1 | ||||
Defined in Text.Printf | |||||
| NFData Char | |||||
Defined in Control.DeepSeq | |||||
| Eq Char | |||||
| Ord Char | |||||
| Hashable Char | |||||
Defined in Data.Hashable.Class | |||||
| IArray UArray Char | |||||
Defined in Data.Array.Base Methods bounds :: Ix i => UArray i Char -> (i, i) # numElements :: Ix i => UArray i Char -> Int # unsafeArray :: Ix i => (i, i) -> [(Int, Char)] -> UArray i Char # unsafeAt :: Ix i => UArray i Char -> Int -> Char # unsafeReplace :: Ix i => UArray i Char -> [(Int, Char)] -> UArray i Char # unsafeAccum :: Ix i => (Char -> e' -> Char) -> UArray i Char -> [(Int, e')] -> UArray i Char # unsafeAccumArray :: Ix i => (Char -> e' -> Char) -> Char -> (i, i) -> [(Int, e')] -> UArray i Char # | |||||
| TestCoercion SChar | Since: base-4.18.0.0 | ||||
Defined in GHC.TypeLits | |||||
| TestEquality SChar | Since: base-4.18.0.0 | ||||
Defined in GHC.TypeLits | |||||
| StringConv ByteString String Source # | |||||
Defined in Protolude.Conv | |||||
| StringConv ByteString String Source # | |||||
Defined in Protolude.Conv | |||||
| StringConv Text String Source # | |||||
| StringConv Text String Source # | |||||
| StringConv String ByteString Source # | |||||
Defined in Protolude.Conv | |||||
| StringConv String ByteString Source # | |||||
Defined in Protolude.Conv | |||||
| StringConv String Text Source # | |||||
| StringConv String Text Source # | |||||
| StringConv String String Source # | |||||
| ConvertText Text String Source # | |||||
| ConvertText Text String Source # | |||||
| ConvertText String Text Source # | |||||
| ConvertText String Text Source # | |||||
| ConvertText String String Source # | |||||
| Lift Char | |||||
| MArray IOUArray Char IO | |||||
Defined in Data.Array.IO.Internals Methods getBounds :: Ix i => IOUArray i Char -> IO (i, i) # getNumElements :: Ix i => IOUArray i Char -> IO Int # newArray :: Ix i => (i, i) -> Char -> IO (IOUArray i Char) # newArray_ :: Ix i => (i, i) -> IO (IOUArray i Char) # unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Char) # unsafeRead :: Ix i => IOUArray i Char -> Int -> IO Char # unsafeWrite :: Ix i => IOUArray i Char -> Int -> Char -> IO () # | |||||
| GEq1 v (UChar :: Type -> Type) | |||||
| GOrd1 v (UChar :: Type -> Type) | |||||
Defined in Data.Functor.Classes.Generic.Internal | |||||
| GShow1Con v (UChar :: Type -> Type) | |||||
Defined in Data.Functor.Classes.Generic.Internal | |||||
| Generic1 (URec Char :: k -> Type) | |||||
Defined in GHC.Generics Associated Types
| |||||
| Foldable (UChar :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in Data.Foldable Methods fold :: Monoid m => UChar m -> m # foldMap :: Monoid m => (a -> m) -> UChar a -> m # foldMap' :: Monoid m => (a -> m) -> UChar a -> m # foldr :: (a -> b -> b) -> b -> UChar a -> b # foldr' :: (a -> b -> b) -> b -> UChar a -> b # foldl :: (b -> a -> b) -> b -> UChar a -> b # foldl' :: (b -> a -> b) -> b -> UChar a -> b # foldr1 :: (a -> a -> a) -> UChar a -> a # foldl1 :: (a -> a -> a) -> UChar a -> a # elem :: Eq a => a -> UChar a -> Bool # maximum :: Ord a => UChar a -> a # minimum :: Ord a => UChar a -> a # | |||||
| Traversable (UChar :: Type -> Type) | Since: base-4.9.0.0 | ||||
| Print [Char] Source # | |||||
| IsNullaryCon (UChar :: Type -> Type) | |||||
Defined in Data.Functor.Classes.Generic.Internal Methods isNullaryCon :: UChar a -> Bool # | |||||
| MArray (STUArray s) Char (ST s) | |||||
Defined in Data.Array.Base Methods getBounds :: Ix i => STUArray s i Char -> ST s (i, i) # getNumElements :: Ix i => STUArray s i Char -> ST s Int # newArray :: Ix i => (i, i) -> Char -> ST s (STUArray s i Char) # newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Char) # unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Char) # unsafeRead :: Ix i => STUArray s i Char -> Int -> ST s Char # unsafeWrite :: Ix i => STUArray s i Char -> Int -> Char -> ST s () # | |||||
| Functor (URec Char :: Type -> Type) | Since: base-4.9.0.0 | ||||
| GEq (UChar p) | |||||
| GOrd (UChar p) | |||||
| GShowCon (UChar p) | |||||
Defined in Data.Functor.Classes.Generic.Internal | |||||
| Generic (URec Char p) | |||||
Defined in GHC.Generics Associated Types
| |||||
| Show (URec Char p) | Since: base-4.9.0.0 | ||||
| Eq (URec Char p) | Since: base-4.9.0.0 | ||||
| Ord (URec Char p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
| data URec Char (p :: k) | Used for marking occurrences of Since: base-4.9.0.0 | ||||
| type Compare (a :: Char) (b :: Char) | |||||
Defined in Data.Type.Ord | |||||
| type Rep1 (URec Char :: k -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
| type Rep (URec Char p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
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
Instances
| Data Bool | Since: base-4.0.0.0 | ||||
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Bool -> c Bool # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Bool # dataTypeOf :: Bool -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Bool) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Bool) # gmapT :: (forall b. Data b => b -> b) -> Bool -> Bool # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Bool -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Bool -> r # gmapQ :: (forall d. Data d => d -> u) -> Bool -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Bool -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Bool -> m Bool # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Bool -> m Bool # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Bool -> m Bool # | |||||
| Storable Bool | Since: base-2.1 | ||||
Defined in Foreign.Storable | |||||
| Bits Bool | Interpret Since: base-4.7.0.0 | ||||
Defined in GHC.Bits Methods (.&.) :: Bool -> Bool -> Bool # (.|.) :: Bool -> Bool -> Bool # complement :: Bool -> Bool # shift :: Bool -> Int -> Bool # rotate :: Bool -> Int -> Bool # setBit :: Bool -> Int -> Bool # clearBit :: Bool -> Int -> Bool # complementBit :: Bool -> Int -> Bool # testBit :: Bool -> Int -> Bool # bitSizeMaybe :: Bool -> Maybe Int # shiftL :: Bool -> Int -> Bool # unsafeShiftL :: Bool -> Int -> Bool # shiftR :: Bool -> Int -> Bool # unsafeShiftR :: Bool -> Int -> Bool # rotateL :: Bool -> Int -> Bool # | |||||
| FiniteBits Bool | Since: base-4.7.0.0 | ||||
Defined in GHC.Bits Methods finiteBitSize :: Bool -> Int # countLeadingZeros :: Bool -> Int # countTrailingZeros :: Bool -> Int # | |||||
| Bounded Bool | Since: base-2.1 | ||||
| Enum Bool | Since: base-2.1 | ||||
| Generic Bool | |||||
Defined in GHC.Generics | |||||
| SingKind Bool | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics Associated Types
| |||||
| Ix Bool | Since: base-2.1 | ||||
| Read Bool | Since: base-2.1 | ||||
| Show Bool | Since: base-2.1 | ||||
| NFData Bool | |||||
Defined in Control.DeepSeq | |||||
| Eq Bool | |||||
| Ord Bool | |||||
| Hashable Bool | |||||
Defined in Data.Hashable.Class | |||||
| IArray UArray Bool | |||||
Defined in Data.Array.Base Methods bounds :: Ix i => UArray i Bool -> (i, i) # numElements :: Ix i => UArray i Bool -> Int # unsafeArray :: Ix i => (i, i) -> [(Int, Bool)] -> UArray i Bool # unsafeAt :: Ix i => UArray i Bool -> Int -> Bool # unsafeReplace :: Ix i => UArray i Bool -> [(Int, Bool)] -> UArray i Bool # unsafeAccum :: Ix i => (Bool -> e' -> Bool) -> UArray i Bool -> [(Int, e')] -> UArray i Bool # unsafeAccumArray :: Ix i => (Bool -> e' -> Bool) -> Bool -> (i, i) -> [(Int, e')] -> UArray i Bool # | |||||
| SingI 'False | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
| SingI 'True | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
| Lift Bool | |||||
| MArray IOUArray Bool IO | |||||
Defined in Data.Array.IO.Internals Methods getBounds :: Ix i => IOUArray i Bool -> IO (i, i) # getNumElements :: Ix i => IOUArray i Bool -> IO Int # newArray :: Ix i => (i, i) -> Bool -> IO (IOUArray i Bool) # newArray_ :: Ix i => (i, i) -> IO (IOUArray i Bool) # unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Bool) # unsafeRead :: Ix i => IOUArray i Bool -> Int -> IO Bool # unsafeWrite :: Ix i => IOUArray i Bool -> Int -> Bool -> IO () # | |||||
| MArray (STUArray s) Bool (ST s) | |||||
Defined in Data.Array.Base Methods getBounds :: Ix i => STUArray s i Bool -> ST s (i, i) # getNumElements :: Ix i => STUArray s i Bool -> ST s Int # newArray :: Ix i => (i, i) -> Bool -> ST s (STUArray s i Bool) # newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Bool) # unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Bool) # unsafeRead :: Ix i => STUArray s i Bool -> Int -> ST s Bool # unsafeWrite :: Ix i => STUArray s i Bool -> Int -> Bool -> ST s () # | |||||
| type DemoteRep Bool | |||||
Defined in GHC.Generics | |||||
| type Rep Bool | Since: base-4.6.0.0 | ||||
| data Sing (a :: Bool) | |||||
Double-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE double-precision type.
Instances
| Data Double | Since: base-4.0.0.0 | ||||
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Double -> c Double # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Double # toConstr :: Double -> Constr # dataTypeOf :: Double -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Double) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Double) # gmapT :: (forall b. Data b => b -> b) -> Double -> Double # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Double -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Double -> r # gmapQ :: (forall d. Data d => d -> u) -> Double -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Double -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Double -> m Double # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Double -> m Double # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Double -> m Double # | |||||
| Storable Double | Since: base-2.1 | ||||
| Floating Double | Since: base-2.1 | ||||
| RealFloat Double | Since: base-2.1 | ||||
Defined in GHC.Float Methods floatRadix :: Double -> Integer # floatDigits :: Double -> Int # floatRange :: Double -> (Int, Int) # decodeFloat :: Double -> (Integer, Int) # encodeFloat :: Integer -> Int -> Double # significand :: Double -> Double # scaleFloat :: Int -> Double -> Double # isInfinite :: Double -> Bool # isDenormalized :: Double -> Bool # isNegativeZero :: Double -> Bool # | |||||
| Read Double | Since: base-2.1 | ||||
| PrintfArg Double | Since: base-2.1 | ||||
Defined in Text.Printf | |||||
| NFData Double | |||||
Defined in Control.DeepSeq | |||||
| 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 | ||||
| Hashable Double | Note: prior to The Since: hashable-1.3.0.0 | ||||
Defined in Data.Hashable.Class | |||||
| IArray UArray Double | |||||
Defined in Data.Array.Base Methods bounds :: Ix i => UArray i Double -> (i, i) # numElements :: Ix i => UArray i Double -> Int # unsafeArray :: Ix i => (i, i) -> [(Int, Double)] -> UArray i Double # unsafeAt :: Ix i => UArray i Double -> Int -> Double # unsafeReplace :: Ix i => UArray i Double -> [(Int, Double)] -> UArray i Double # unsafeAccum :: Ix i => (Double -> e' -> Double) -> UArray i Double -> [(Int, e')] -> UArray i Double # unsafeAccumArray :: Ix i => (Double -> e' -> Double) -> Double -> (i, i) -> [(Int, e')] -> UArray i Double # | |||||
| Lift Double | |||||
| MArray IOUArray Double IO | |||||
Defined in Data.Array.IO.Internals Methods getBounds :: Ix i => IOUArray i Double -> IO (i, i) # getNumElements :: Ix i => IOUArray i Double -> IO Int # newArray :: Ix i => (i, i) -> Double -> IO (IOUArray i Double) # newArray_ :: Ix i => (i, i) -> IO (IOUArray i Double) # unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Double) # unsafeRead :: Ix i => IOUArray i Double -> Int -> IO Double # unsafeWrite :: Ix i => IOUArray i Double -> Int -> Double -> IO () # | |||||
| GEq1 v (UDouble :: Type -> Type) | |||||
| GOrd1 v (UDouble :: Type -> Type) | |||||
Defined in Data.Functor.Classes.Generic.Internal | |||||
| GShow1Con v (UDouble :: Type -> Type) | |||||
Defined in Data.Functor.Classes.Generic.Internal | |||||
| Generic1 (URec Double :: k -> Type) | |||||
Defined in GHC.Generics Associated Types
| |||||
| Foldable (UDouble :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in Data.Foldable Methods fold :: Monoid m => UDouble m -> m # foldMap :: Monoid m => (a -> m) -> UDouble a -> m # foldMap' :: Monoid m => (a -> m) -> UDouble a -> m # foldr :: (a -> b -> b) -> b -> UDouble a -> b # foldr' :: (a -> b -> b) -> b -> UDouble a -> b # foldl :: (b -> a -> b) -> b -> UDouble a -> b # foldl' :: (b -> a -> b) -> b -> UDouble a -> b # foldr1 :: (a -> a -> a) -> UDouble a -> a # foldl1 :: (a -> a -> a) -> UDouble a -> a # elem :: Eq a => a -> UDouble a -> Bool # maximum :: Ord a => UDouble a -> a # minimum :: Ord a => UDouble a -> a # | |||||
| Traversable (UDouble :: Type -> Type) | Since: base-4.9.0.0 | ||||
| IsNullaryCon (UDouble :: Type -> Type) | |||||
Defined in Data.Functor.Classes.Generic.Internal Methods isNullaryCon :: UDouble a -> Bool # | |||||
| MArray (STUArray s) Double (ST s) | |||||
Defined in Data.Array.Base Methods getBounds :: Ix i => STUArray s i Double -> ST s (i, i) # getNumElements :: Ix i => STUArray s i Double -> ST s Int # newArray :: Ix i => (i, i) -> Double -> ST s (STUArray s i Double) # newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Double) # unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Double) # unsafeRead :: Ix i => STUArray s i Double -> Int -> ST s Double # unsafeWrite :: Ix i => STUArray s i Double -> Int -> Double -> ST s () # | |||||
| Functor (URec Double :: Type -> Type) | Since: base-4.9.0.0 | ||||
| GEq (UDouble p) | |||||
| GOrd (UDouble p) | |||||
| GShowCon (UDouble p) | |||||
Defined in Data.Functor.Classes.Generic.Internal | |||||
| Generic (URec Double p) | |||||
Defined in GHC.Generics Associated Types
| |||||
| Show (URec Double p) | Since: base-4.9.0.0 | ||||
| Eq (URec Double p) | Since: base-4.9.0.0 | ||||
| Ord (URec Double p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics Methods compare :: URec Double p -> URec Double p -> Ordering # (<) :: URec Double p -> URec Double p -> Bool # (<=) :: URec Double p -> URec Double p -> Bool # (>) :: URec Double p -> URec Double p -> Bool # (>=) :: URec Double p -> URec Double p -> Bool # | |||||
| data URec Double (p :: k) | Used for marking occurrences of Since: base-4.9.0.0 | ||||
| type Rep1 (URec Double :: k -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
| type Rep (URec Double p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
Instances
| Data Word | Since: base-4.0.0.0 | ||||
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word -> c Word # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word # dataTypeOf :: Word -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word) # gmapT :: (forall b. Data b => b -> b) -> Word -> Word # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word -> r # gmapQ :: (forall d. Data d => d -> u) -> Word -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word -> m Word # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word -> m Word # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word -> m Word # | |||||
| Storable Word | Since: base-2.1 | ||||
Defined in Foreign.Storable | |||||
| Bits Word | Since: base-2.1 | ||||
Defined in GHC.Bits Methods (.&.) :: Word -> Word -> Word # (.|.) :: Word -> Word -> Word # complement :: Word -> Word # shift :: Word -> Int -> Word # rotate :: Word -> Int -> Word # setBit :: Word -> Int -> Word # clearBit :: Word -> Int -> Word # complementBit :: Word -> Int -> Word # testBit :: Word -> Int -> Bool # bitSizeMaybe :: Word -> Maybe Int # shiftL :: Word -> Int -> Word # unsafeShiftL :: Word -> Int -> Word # shiftR :: Word -> Int -> Word # unsafeShiftR :: Word -> Int -> Word # rotateL :: Word -> Int -> Word # | |||||
| FiniteBits Word | Since: base-4.6.0.0 | ||||
Defined in GHC.Bits Methods finiteBitSize :: Word -> Int # countLeadingZeros :: Word -> Int # countTrailingZeros :: Word -> Int # | |||||
| Bounded Word | Since: base-2.1 | ||||
| Enum Word | Since: base-2.1 | ||||
| Ix Word | Since: base-4.6.0.0 | ||||
| Num Word | Since: base-2.1 | ||||
| Read Word | Since: base-4.5.0.0 | ||||
| Integral Word | Since: base-2.1 | ||||
| Real Word | Since: base-2.1 | ||||
Defined in GHC.Real Methods toRational :: Word -> Rational # | |||||
| Show Word | Since: base-2.1 | ||||
| PrintfArg Word | Since: base-2.1 | ||||
Defined in Text.Printf | |||||
| NFData Word | |||||
Defined in Control.DeepSeq | |||||
| Eq Word | |||||
| Ord Word | |||||
| Hashable Word | |||||
Defined in Data.Hashable.Class | |||||
| IArray UArray Word | |||||
Defined in Data.Array.Base Methods bounds :: Ix i => UArray i Word -> (i, i) # numElements :: Ix i => UArray i Word -> Int # unsafeArray :: Ix i => (i, i) -> [(Int, Word)] -> UArray i Word # unsafeAt :: Ix i => UArray i Word -> Int -> Word # unsafeReplace :: Ix i => UArray i Word -> [(Int, Word)] -> UArray i Word # unsafeAccum :: Ix i => (Word -> e' -> Word) -> UArray i Word -> [(Int, e')] -> UArray i Word # unsafeAccumArray :: Ix i => (Word -> e' -> Word) -> Word -> (i, i) -> [(Int, e')] -> UArray i Word # | |||||
| Lift Word | |||||
| MArray IOUArray Word IO | |||||
Defined in Data.Array.IO.Internals Methods getBounds :: Ix i => IOUArray i Word -> IO (i, i) # getNumElements :: Ix i => IOUArray i Word -> IO Int # newArray :: Ix i => (i, i) -> Word -> IO (IOUArray i Word) # newArray_ :: Ix i => (i, i) -> IO (IOUArray i Word) # unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Word) # unsafeRead :: Ix i => IOUArray i Word -> Int -> IO Word # unsafeWrite :: Ix i => IOUArray i Word -> Int -> Word -> IO () # | |||||
| GEq1 v (UWord :: Type -> Type) | |||||
| GOrd1 v (UWord :: Type -> Type) | |||||
Defined in Data.Functor.Classes.Generic.Internal | |||||
| GShow1Con v (UWord :: Type -> Type) | |||||
Defined in Data.Functor.Classes.Generic.Internal | |||||
| Generic1 (URec Word :: k -> Type) | |||||
Defined in GHC.Generics Associated Types
| |||||
| Foldable (UWord :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in Data.Foldable Methods fold :: Monoid m => UWord m -> m # foldMap :: Monoid m => (a -> m) -> UWord a -> m # foldMap' :: Monoid m => (a -> m) -> UWord a -> m # foldr :: (a -> b -> b) -> b -> UWord a -> b # foldr' :: (a -> b -> b) -> b -> UWord a -> b # foldl :: (b -> a -> b) -> b -> UWord a -> b # foldl' :: (b -> a -> b) -> b -> UWord a -> b # foldr1 :: (a -> a -> a) -> UWord a -> a # foldl1 :: (a -> a -> a) -> UWord a -> a # elem :: Eq a => a -> UWord a -> Bool # maximum :: Ord a => UWord a -> a # minimum :: Ord a => UWord a -> a # | |||||
| Traversable (UWord :: Type -> Type) | Since: base-4.9.0.0 | ||||
| IsNullaryCon (UWord :: Type -> Type) | |||||
Defined in Data.Functor.Classes.Generic.Internal Methods isNullaryCon :: UWord a -> Bool # | |||||
| MArray (STUArray s) Word (ST s) | |||||
Defined in Data.Array.Base Methods getBounds :: Ix i => STUArray s i Word -> ST s (i, i) # getNumElements :: Ix i => STUArray s i Word -> ST s Int # newArray :: Ix i => (i, i) -> Word -> ST s (STUArray s i Word) # newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word) # unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word) # unsafeRead :: Ix i => STUArray s i Word -> Int -> ST s Word # unsafeWrite :: Ix i => STUArray s i Word -> Int -> Word -> ST s () # | |||||
| Functor (URec Word :: Type -> Type) | Since: base-4.9.0.0 | ||||
| GEq (UWord p) | |||||
| GOrd (UWord p) | |||||
| GShowCon (UWord p) | |||||
Defined in Data.Functor.Classes.Generic.Internal | |||||
| Generic (URec Word p) | |||||
Defined in GHC.Generics Associated Types
| |||||
| Show (URec Word p) | Since: base-4.9.0.0 | ||||
| Eq (URec Word p) | Since: base-4.9.0.0 | ||||
| Ord (URec Word p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
| data URec Word (p :: k) | Used for marking occurrences of Since: base-4.9.0.0 | ||||
| type Rep1 (URec Word :: k -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
| type Rep (URec Word p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
Instances
| Data Ordering | Since: base-4.0.0.0 |
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Ordering -> c Ordering # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Ordering # toConstr :: Ordering -> Constr # dataTypeOf :: Ordering -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Ordering) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Ordering) # gmapT :: (forall b. Data b => b -> b) -> Ordering -> Ordering # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Ordering -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Ordering -> r # gmapQ :: (forall d. Data d => d -> u) -> Ordering -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Ordering -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Ordering -> m Ordering # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Ordering -> m Ordering # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Ordering -> m Ordering # | |
| Monoid Ordering | Since: base-2.1 |
| Semigroup Ordering | Since: base-4.9.0.0 |
| Bounded Ordering | Since: base-2.1 |
| Enum Ordering | Since: base-2.1 |
| Generic Ordering | |
Defined in GHC.Generics | |
| Ix Ordering | Since: base-2.1 |
Defined in GHC.Ix Methods range :: (Ordering, Ordering) -> [Ordering] # index :: (Ordering, Ordering) -> Ordering -> Int # unsafeIndex :: (Ordering, Ordering) -> Ordering -> Int # inRange :: (Ordering, Ordering) -> Ordering -> Bool # rangeSize :: (Ordering, Ordering) -> Int # unsafeRangeSize :: (Ordering, Ordering) -> Int # | |
| Read Ordering | Since: base-2.1 |
| Show Ordering | Since: base-2.1 |
| NFData Ordering | |
Defined in Control.DeepSeq | |
| Eq Ordering | |
| Ord Ordering | |
Defined in GHC.Classes | |
| Hashable Ordering | |
Defined in Data.Hashable.Class | |
| type Rep Ordering | Since: base-4.6.0.0 |
class a ~R# b => Coercible (a :: k) (b :: k) #
Coercible is a two-parameter class that has instances for types a and b if
the compiler can infer that they have the same representation. This class
does not have regular instances; instead they are created on-the-fly during
type-checking. Trying to manually declare an instance of Coercible
is an error.
Nevertheless one can pretend that the following three kinds of instances exist. First, as a trivial base-case:
instance Coercible a a
Furthermore, for every type constructor there is
an instance that allows to coerce under the type constructor. For
example, let D be a prototypical type constructor (data or
newtype) with three type arguments, which have roles nominal,
representational resp. phantom. Then there is an instance of
the form
instance Coercible b b' => Coercible (D a b c) (D a b' c')
Note that the nominal type arguments are equal, the
representational type arguments can differ, but need to have a
Coercible instance themself, and the phantom type arguments can be
changed arbitrarily.
The third kind of instance exists for every newtype NT = MkNT T and
comes in two variants, namely
instance Coercible a T => Coercible a NT
instance Coercible T b => Coercible NT b
This instance is only usable if the constructor MkNT is in scope.
If, as a library author of a type constructor like Set a, you
want to prevent a user of your module to write
coerce :: Set T -> Set NT,
you need to set the role of Set's type parameter to nominal,
by writing
type role Set nominal
For more details about this feature, please refer to Safe Coercions by Joachim Breitner, Richard A. Eisenberg, Simon Peyton Jones and Stephanie Weirich.
Since: ghc-prim-0.4.0
(Kind) This is the kind of type-level symbols.
Instances
| SingKind Symbol | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics Associated Types
| |||||
| TestCoercion SSymbol | Since: base-4.18.0.0 | ||||
Defined in GHC.TypeLits | |||||
| TestEquality SSymbol | Since: base-4.18.0.0 | ||||
Defined in GHC.TypeLits | |||||
| KnownSymbol a => SingI (a :: Symbol) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics Methods sing :: Sing a | |||||
| type DemoteRep Symbol | |||||
Defined in GHC.Generics | |||||
| data Sing (s :: Symbol) | |||||
Defined in GHC.Generics | |||||
| type Compare (a :: Symbol) (b :: Symbol) | |||||
Defined in Data.Type.Ord | |||||
Arbitrary precision integers. In contrast with fixed-size integral types
such as Int, the Integer type represents the entire infinite range of
integers.
Integers are stored in a kind of sign-magnitude form, hence do not expect two's complement form when using bit operations.
If the value is small (fit into an Int), IS constructor is used.
Otherwise IP and IN constructors are used to store a BigNat
representing respectively the positive or the negative value magnitude.
Instances
| Data Integer | Since: base-4.0.0.0 |
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Integer -> c Integer # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Integer # toConstr :: Integer -> Constr # dataTypeOf :: Integer -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Integer) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Integer) # gmapT :: (forall b. Data b => b -> b) -> Integer -> Integer # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Integer -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Integer -> r # gmapQ :: (forall d. Data d => d -> u) -> Integer -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Integer -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Integer -> m Integer # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Integer -> m Integer # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Integer -> m Integer # | |
| Bits Integer | Since: base-2.1 |
Defined in GHC.Bits Methods (.&.) :: Integer -> Integer -> Integer # (.|.) :: Integer -> Integer -> Integer # xor :: Integer -> Integer -> Integer # complement :: Integer -> Integer # shift :: Integer -> Int -> Integer # rotate :: Integer -> Int -> Integer # setBit :: Integer -> Int -> Integer # clearBit :: Integer -> Int -> Integer # complementBit :: Integer -> Int -> Integer # testBit :: Integer -> Int -> Bool # bitSizeMaybe :: Integer -> Maybe Int # shiftL :: Integer -> Int -> Integer # unsafeShiftL :: Integer -> Int -> Integer # shiftR :: Integer -> Int -> Integer # unsafeShiftR :: Integer -> Int -> Integer # rotateL :: Integer -> Int -> Integer # | |
| Enum Integer | Since: base-2.1 |
| Ix Integer | Since: base-2.1 |
Defined in GHC.Ix | |
| Num Integer | Since: base-2.1 |
| Read Integer | Since: base-2.1 |
| Integral Integer | Since: base-2.0.1 |
Defined in GHC.Real | |
| Real Integer | Since: base-2.0.1 |
Defined in GHC.Real Methods toRational :: Integer -> Rational # | |
| Show Integer | Since: base-2.1 |
| PrintfArg Integer | Since: base-2.1 |
Defined in Text.Printf | |
| NFData Integer | |
Defined in Control.DeepSeq | |
| Eq Integer | |
| Ord Integer | |
| Hashable Integer | |
Defined in Data.Hashable.Class | |
| Lift Integer | |
type Constraint = CONSTRAINT LiftedRep #
The kind of lifted constraints
callStack :: HasCallStack => CallStack #
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
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
the successor of a value. For numeric types, succ adds 1.
the predecessor of a value. For numeric types, pred subtracts 1.
Convert from an Int.
Convert to an Int.
It is implementation-dependent what fromEnum returns when
applied to a value that is too large to fit in an Int.
Used in Haskell's translation of [n..] with [n..] = enumFrom n,
a possible implementation being enumFrom n = n : enumFrom (succ n).
For example:
enumFrom 4 :: [Integer] = [4,5,6,7,...]
enumFrom 6 :: [Int] = [6,7,8,9,...,maxBound :: Int]
enumFromThen :: a -> a -> [a] #
Used in Haskell's translation of [n,n'..]
with [n,n'..] = enumFromThen n n', a possible implementation being
enumFromThen n n' = n : n' : worker (f x) (f x n'),
worker s v = v : worker s (s v), x = fromEnum n' - fromEnum n and
f n y
| n > 0 = f (n - 1) (succ y)
| n < 0 = f (n + 1) (pred y)
| otherwise = y
For example:
enumFromThen 4 6 :: [Integer] = [4,6,8,10...]
enumFromThen 6 2 :: [Int] = [6,2,-2,-6,...,minBound :: Int]
enumFromTo :: a -> a -> [a] #
Used in Haskell's translation of [n..m] with
[n..m] = enumFromTo n m, a possible implementation being
enumFromTo n m
| n <= m = n : enumFromTo (succ n) m
| otherwise = [].
For example:
enumFromTo 6 10 :: [Int] = [6,7,8,9,10]
enumFromTo 42 1 :: [Integer] = []
enumFromThenTo :: a -> a -> a -> [a] #
Used in Haskell's translation of [n,n'..m] with
[n,n'..m] = enumFromThenTo n n' m, a possible implementation
being enumFromThenTo n n' m = worker (f x) (c x) n m,
x = fromEnum n' - fromEnum n, c x = bool (>=) ((x 0)
f n y
| n > 0 = f (n - 1) (succ y)
| n < 0 = f (n + 1) (pred y)
| otherwise = y and
worker s c v m
| c v m = v : worker s c (s v) m
| otherwise = []
For example:
enumFromThenTo 4 2 -6 :: [Integer] = [4,2,0,-2,-4,-6]
enumFromThenTo 6 8 2 :: [Int] = []
Instances
class (Real a, Enum a) => Integral a where #
Integral numbers, supporting integer division.
The Haskell Report defines no laws for Integral. However, Integral
instances are customarily expected to define a Euclidean domain and have the
following properties for the div/mod and quot/rem pairs, given
suitable Euclidean functions f and g:
x=y * quot x y + rem x ywithrem x y=fromInteger 0org (rem x y)<g yx=y * div x y + mod x ywithmod x y=fromInteger 0orf (mod x y)<f y
An example of a suitable Euclidean function, for Integer's instance, is
abs.
In addition, toInteger should be total, and fromInteger should be a left
inverse for it, i.e. fromInteger (toInteger i) = i.
Methods
quot :: a -> a -> a infixl 7 #
integer division truncated toward zero
WARNING: This function is partial (because it throws when 0 is passed as
the divisor) for all the integer types in base.
integer remainder, satisfying
(x `quot` y)*y + (x `rem` y) == x
WARNING: This function is partial (because it throws when 0 is passed as
the divisor) for all the integer types in base.
integer division truncated toward negative infinity
WARNING: This function is partial (because it throws when 0 is passed as
the divisor) for all the integer types in base.
integer modulus, satisfying
(x `div` y)*y + (x `mod` y) == x
WARNING: This function is partial (because it throws when 0 is passed as
the divisor) for all the integer types in base.
WARNING: This function is partial (because it throws when 0 is passed as
the divisor) for all the integer types in base.
WARNING: This function is partial (because it throws when 0 is passed as
the divisor) for all the integer types in base.
conversion to Integer
Instances
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
| NFData1 Ptr | Since: deepseq-1.4.3.0 | ||||
Defined in Control.DeepSeq | |||||
| IArray UArray (Ptr a) | |||||
Defined in Data.Array.Base Methods bounds :: Ix i => UArray i (Ptr a) -> (i, i) # numElements :: Ix i => UArray i (Ptr a) -> Int # unsafeArray :: Ix i => (i, i) -> [(Int, Ptr a)] -> UArray i (Ptr a) # unsafeAt :: Ix i => UArray i (Ptr a) -> Int -> Ptr a # unsafeReplace :: Ix i => UArray i (Ptr a) -> [(Int, Ptr a)] -> UArray i (Ptr a) # unsafeAccum :: Ix i => (Ptr a -> e' -> Ptr a) -> UArray i (Ptr a) -> [(Int, e')] -> UArray i (Ptr a) # unsafeAccumArray :: Ix i => (Ptr a -> e' -> Ptr a) -> Ptr a -> (i, i) -> [(Int, e')] -> UArray i (Ptr a) # | |||||
| GEq1 v (UAddr :: Type -> Type) | |||||
| GOrd1 v (UAddr :: Type -> Type) | |||||
Defined in Data.Functor.Classes.Generic.Internal | |||||
| MArray IOUArray (Ptr a) IO | |||||
Defined in Data.Array.IO.Internals Methods getBounds :: Ix i => IOUArray i (Ptr a) -> IO (i, i) # getNumElements :: Ix i => IOUArray i (Ptr a) -> IO Int # newArray :: Ix i => (i, i) -> Ptr a -> IO (IOUArray i (Ptr a)) # newArray_ :: Ix i => (i, i) -> IO (IOUArray i (Ptr a)) # unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i (Ptr a)) # unsafeRead :: Ix i => IOUArray i (Ptr a) -> Int -> IO (Ptr a) # unsafeWrite :: Ix i => IOUArray i (Ptr a) -> Int -> Ptr a -> IO () # | |||||
| Generic1 (URec (Ptr ()) :: k -> Type) | |||||
Defined in GHC.Generics Associated Types
| |||||
| Data a => Data (Ptr a) | Since: base-4.8.0.0 | ||||
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Ptr a -> c (Ptr a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Ptr a) # dataTypeOf :: Ptr a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Ptr a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Ptr a)) # gmapT :: (forall b. Data b => b -> b) -> Ptr a -> Ptr a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Ptr a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Ptr a -> r # gmapQ :: (forall d. Data d => d -> u) -> Ptr a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Ptr a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Ptr a -> m (Ptr a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Ptr a -> m (Ptr a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Ptr a -> m (Ptr a) # | |||||
| Foldable (UAddr :: Type -> Type) | Since: base-4.9.0.0 | ||||
Defined in Data.Foldable Methods fold :: Monoid m => UAddr m -> m # foldMap :: Monoid m => (a -> m) -> UAddr a -> m # foldMap' :: Monoid m => (a -> m) -> UAddr a -> m # foldr :: (a -> b -> b) -> b -> UAddr a -> b # foldr' :: (a -> b -> b) -> b -> UAddr a -> b # foldl :: (b -> a -> b) -> b -> UAddr a -> b # foldl' :: (b -> a -> b) -> b -> UAddr a -> b # foldr1 :: (a -> a -> a) -> UAddr a -> a # foldl1 :: (a -> a -> a) -> UAddr a -> a # elem :: Eq a => a -> UAddr a -> Bool # maximum :: Ord a => UAddr a -> a # minimum :: Ord a => UAddr a -> a # | |||||
| Traversable (UAddr :: Type -> Type) | Since: base-4.9.0.0 | ||||
| Storable (Ptr a) | Since: base-2.1 | ||||
| Show (Ptr a) | Since: base-2.1 | ||||
| NFData (Ptr a) | Since: deepseq-1.4.2.0 | ||||
Defined in Control.DeepSeq | |||||
| Eq (Ptr a) | Since: base-2.1 | ||||
| Ord (Ptr a) | Since: base-2.1 | ||||
| Hashable (Ptr a) | |||||
Defined in Data.Hashable.Class | |||||
| MArray (STUArray s) (Ptr a) (ST s) | |||||
Defined in Data.Array.Base Methods getBounds :: Ix i => STUArray s i (Ptr a) -> ST s (i, i) # getNumElements :: Ix i => STUArray s i (Ptr a) -> ST s Int # newArray :: Ix i => (i, i) -> Ptr a -> ST s (STUArray s i (Ptr a)) # newArray_ :: Ix i => (i, i) -> ST s (STUArray s i (Ptr a)) # unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i (Ptr a)) # unsafeRead :: Ix i => STUArray s i (Ptr a) -> Int -> ST s (Ptr a) # unsafeWrite :: Ix i => STUArray s i (Ptr a) -> Int -> Ptr a -> ST s () # | |||||
| Functor (URec (Ptr ()) :: Type -> Type) | Since: base-4.9.0.0 | ||||
| GEq (UAddr p) | |||||
| GOrd (UAddr p) | |||||
| Generic (URec (Ptr ()) p) | |||||
Defined in GHC.Generics Associated Types
| |||||
| Eq (URec (Ptr ()) p) | Since: base-4.9.0.0 | ||||
| Ord (URec (Ptr ()) p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics Methods compare :: URec (Ptr ()) p -> URec (Ptr ()) p -> Ordering # (<) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # (<=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # (>) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # (>=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # max :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p # min :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p # | |||||
| data URec (Ptr ()) (p :: k) | Used for marking occurrences of Since: base-4.9.0.0 | ||||
| type Rep1 (URec (Ptr ()) :: k -> Type) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
| type Rep (URec (Ptr ()) p) | Since: base-4.9.0.0 | ||||
Defined in GHC.Generics | |||||
(++) :: [a] -> [a] -> [a] infixr 5 #
(++) appends two lists, i.e.,
[x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn] [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
If the first list is not finite, the result is the first list.
Performance considerations
This function takes linear time in the number of elements of the
first list. Thus it is better to associate repeated
applications of (++) to the right (which is the default behaviour):
xs ++ (ys ++ zs) or simply xs ++ ys ++ zs, but not (xs ++ ys) ++ zs.
For the same reason concat = foldr (++) []
has linear performance, while foldl (++) [] is prone
to quadratic slowdown
Examples
>>>[1, 2, 3] ++ [4, 5, 6][1,2,3,4,5,6]
>>>[] ++ [1, 2, 3][1,2,3]
>>>[3, 2, 1] ++ [][3,2,1]
The value of is bottom if seq a ba is bottom, and
otherwise equal to b. In other words, it evaluates the first
argument a to weak head normal form (WHNF). seq is usually
introduced to improve performance by avoiding unneeded laziness.
A note on evaluation order: the expression does
not guarantee that seq a ba will be evaluated before b.
The only guarantee given by seq is that the both a
and b will be evaluated before seq returns a value.
In particular, this means that b may be evaluated before
a. If you need to guarantee a specific order of evaluation,
you must use the function pseq from the "parallel" package.
print :: Show a => a -> IO () #
The print function outputs a value of any printable type to the
standard output device.
Printable types are those that are instances of class Show; print
converts values to strings for output using the show operation and
adds a newline.
For example, a program to print the first 20 integers and their powers of 2 could be written as:
main = print ([(n, 2^n) | n <- [0..19]])
Basic numeric class.
The Haskell Report defines no laws for Num. However, ( and +)( are
customarily expected to define a ring and have the following properties:*)
- Associativity of
(+) (x + y) + z=x + (y + z)- Commutativity of
(+) x + y=y + xis the additive identityfromInteger0x + fromInteger 0=xnegategives the additive inversex + negate x=fromInteger 0- Associativity of
(*) (x * y) * z=x * (y * z)is the multiplicative identityfromInteger1x * fromInteger 1=xandfromInteger 1 * x=x- Distributivity of
(with respect to*)(+) a * (b + c)=(a * b) + (a * c)and(b + c) * a=(b * a) + (c * a)- Coherence with
toInteger - if the type also implements
Integral, thenfromIntegeris a left inverse fortoInteger, i.e.fromInteger (toInteger i) == i
Note that it isn't customarily expected that a type instance of both Num
and Ord implement an ordered ring. Indeed, in base only Integer and
Rational do.
Methods
Unary negation.
Absolute value.
Sign of a number.
The functions abs and signum should satisfy the law:
abs x * signum x == x
For real numbers, the signum is either -1 (negative), 0 (zero)
or 1 (positive).
fromInteger :: Integer -> a #
Conversion from an Integer.
An integer literal represents the application of the function
fromInteger to the appropriate value of type Integer,
so such literals have type (.Num a) => a
Instances
| Num CBool | |
| Num CChar | |
| Num CClock | |
| Num CDouble | |
| Num CFloat | |
| Num CInt | |
| Num CIntMax | |
| Num CIntPtr | |
| Num CLLong | |
| Num CLong | |
| Num CPtrdiff | |
| Num CSChar | |
| Num CSUSeconds | |
Defined in Foreign.C.Types Methods (+) :: CSUSeconds -> CSUSeconds -> CSUSeconds # (-) :: CSUSeconds -> CSUSeconds -> CSUSeconds # (*) :: CSUSeconds -> CSUSeconds -> CSUSeconds # negate :: CSUSeconds -> CSUSeconds # abs :: CSUSeconds -> CSUSeconds # signum :: CSUSeconds -> CSUSeconds # fromInteger :: Integer -> CSUSeconds # | |
| Num CShort | |
| Num CSigAtomic | |
Defined in Foreign.C.Types Methods (+) :: CSigAtomic -> CSigAtomic -> CSigAtomic # (-) :: CSigAtomic -> CSigAtomic -> CSigAtomic # (*) :: CSigAtomic -> CSigAtomic -> CSigAtomic # negate :: CSigAtomic -> CSigAtomic # abs :: CSigAtomic -> CSigAtomic # signum :: CSigAtomic -> CSigAtomic # fromInteger :: Integer -> CSigAtomic # | |
| Num CSize | |
| Num CTime | |
| Num CUChar | |
| Num CUInt | |
| Num CUIntMax | |
| Num CUIntPtr | |
| Num CULLong | |
| Num CULong | |
| Num CUSeconds | |
Defined in Foreign.C.Types | |
| Num CUShort | |
| Num CWchar | |
| Num IntPtr | |
| Num WordPtr | |
| Num Int16 | Since: base-2.1 |
| Num Int32 | Since: base-2.1 |
| Num Int64 | Since: base-2.1 |
| Num Int8 | Since: base-2.1 |
| Num Word16 | Since: base-2.1 |
| Num Word32 | Since: base-2.1 |
| Num Word64 | Since: base-2.1 |
| Num Word8 | Since: base-2.1 |
| Num CBlkCnt | |
| Num CBlkSize | |
| Num CCc | |
| Num CClockId | |
| Num CDev | |
| Num CFsBlkCnt | |
Defined in System.Posix.Types | |
| Num CFsFilCnt | |
Defined in System.Posix.Types | |
| Num CGid | |
| Num CId | |
| Num CIno | |
| Num CKey | |
| Num CMode | |
| Num CNfds | |
| Num CNlink | |
| Num COff | |
| Num CPid | |
| Num CRLim | |
| Num CSocklen | |
| Num CSpeed | |
| Num CSsize | |
| Num CTcflag | |
| Num CUid | |
| Num Fd | |
| Num I8 | |
| Num Size | |
| Num Integer | Since: base-2.1 |
| Num Natural | Note that Since: base-4.8.0.0 |
| Num Int | Since: base-2.1 |
| Num Word | Since: base-2.1 |
| RealFloat a => Num (Complex a) | Since: base-2.1 |
| Num a => Num (Identity a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Identity | |
| Num a => Num (Down a) | Since: base-4.11.0.0 |
| Num a => Num (Max a) | Since: base-4.9.0.0 |
| Num a => Num (Min a) | Since: base-4.9.0.0 |
| Num a => Num (Product a) | Since: base-4.7.0.0 |
Defined in Data.Semigroup.Internal | |
| Num a => Num (Sum a) | Since: base-4.7.0.0 |
| Integral a => Num (Ratio a) | Since: base-2.0.1 |
| HasResolution a => Num (Fixed a) | Multiplication is not associative or distributive:
Since: base-2.1 |
| Num a => Num (Op a b) | |
| Num a => Num (Const a b) | Since: base-4.9.0.0 |
Defined in Data.Functor.Const | |
| (Applicative f, Num a) => Num (Ap f a) | Note that even if the underlying Commutativity:
Additive inverse:
Distributivity:
Since: base-4.12.0.0 |
| Num (f a) => Num (Alt f a) | Since: base-4.8.0.0 |
| Num (f (g a)) => Num (Compose f g a) | Since: base-4.19.0.0 |
Defined in Data.Functor.Compose Methods (+) :: Compose f g a -> Compose f g a -> Compose f g a # (-) :: Compose f g a -> Compose f g a -> Compose f g a # (*) :: Compose f g a -> Compose f g a -> Compose f g a # negate :: Compose f g a -> Compose f g a # abs :: Compose f g a -> Compose f g a # signum :: Compose f g a -> Compose f g a # fromInteger :: Integer -> Compose f g a # | |
class Num a => Fractional a where #
Fractional numbers, supporting real division.
The Haskell Report defines no laws for Fractional. However, ( and
+)( are customarily expected to define a division ring and have the
following properties:*)
recipgives the multiplicative inversex * recip x=recip x * x=fromInteger 1- Totality of
toRational toRationalis total- Coherence with
toRational - if the type also implements
Real, thenfromRationalis a left inverse fortoRational, i.e.fromRational (toRational i) = i
Note that it isn't customarily expected that a type instance of
Fractional implement a field. However, all instances in base do.
Minimal complete definition
fromRational, (recip | (/))
Methods
Fractional division.
Reciprocal fraction.
fromRational :: Rational -> a #
Conversion from a Rational (that is ).
A floating literal stands for an application of Ratio IntegerfromRational
to a value of type Rational, so such literals have type
(.Fractional a) => a
Instances
| Fractional CDouble | |
| Fractional CFloat | |
| RealFloat a => Fractional (Complex a) | Since: base-2.1 |
| Fractional a => Fractional (Identity a) | Since: base-4.9.0.0 |
| Fractional a => Fractional (Down a) | Since: base-4.14.0.0 |
| Integral a => Fractional (Ratio a) | Since: base-2.0.1 |
| HasResolution a => Fractional (Fixed a) | Since: base-2.1 |
| Fractional a => Fractional (Op a b) | |
| Fractional a => Fractional (Const a b) | Since: base-4.9.0.0 |
fromIntegral :: (Integral a, Num b) => a -> b #
General coercion from Integral types.
WARNING: This function performs silent truncation if the result type is not at least as big as the argument's type.
realToFrac :: (Real a, Fractional b) => a -> b #
General coercion to Fractional types.
WARNING: This function goes through the Rational type, which does not have values for NaN for example.
This means it does not round-trip.
For Double it also behaves differently with or without -O0:
Prelude> realToFrac nan -- With -O0 -Infinity Prelude> realToFrac nan NaN
class (Num a, Ord a) => Real a where #
Real numbers.
The Haskell report defines no laws for Real, however Real instances
are customarily expected to adhere to the following law:
- Coherence with
fromRational - if the type also implements
Fractional, thenfromRationalis a left inverse fortoRational, i.e.fromRational (toRational i) = i
The law does not hold for Float, Double, CFloat,
CDouble, etc., because these types contain non-finite values,
which cannot be roundtripped through Rational.
Methods
toRational :: a -> Rational #
the rational equivalent of its real argument with full precision
Instances
The Bounded class is used to name the upper and lower limits of a
type. Ord is not a superclass of Bounded since types that are not
totally ordered may also have upper and lower bounds.
The Bounded class may be derived for any enumeration type;
minBound is the first constructor listed in the data declaration
and maxBound is the last.
Bounded may also be derived for single-constructor datatypes whose
constituent types are in Bounded.
Instances
| Bounded All | Since: base-2.1 |
| Bounded Any | Since: base-2.1 |
| Bounded CBool | |
| Bounded CChar | |
| Bounded CInt | |
| Bounded CIntMax | |
| Bounded CIntPtr | |
| Bounded CLLong | |
| Bounded CLong | |
| Bounded CPtrdiff | |
| Bounded CSChar | |
| Bounded CShort | |
| Bounded CSigAtomic | |
Defined in Foreign.C.Types | |
| Bounded CSize | |
| Bounded CUChar | |
| Bounded CUInt | |
| Bounded CUIntMax | |
| Bounded CUIntPtr | |
| Bounded CULLong | |
| Bounded CULong | |
| Bounded CUShort | |
| Bounded CWchar | |
| Bounded IntPtr | |
| Bounded WordPtr | |
| Bounded ByteOrder | Since: base-4.11.0.0 |
| Bounded Associativity | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
| Bounded DecidedStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
| Bounded SourceStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
| Bounded SourceUnpackedness | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
| Bounded Int16 | Since: base-2.1 |
| Bounded Int32 | Since: base-2.1 |
| Bounded Int64 | Since: base-2.1 |
| Bounded Int8 | Since: base-2.1 |
| Bounded GeneralCategory | Since: base-2.1 |
Defined in GHC.Unicode | |
| Bounded Word16 | Since: base-2.1 |
| Bounded Word32 | Since: base-2.1 |
| Bounded Word64 | Since: base-2.1 |
| Bounded Word8 | Since: base-2.1 |
| Bounded CBlkCnt | |
| Bounded CBlkSize | |
| Bounded CClockId | |
| Bounded CDev | |
| Bounded CFsBlkCnt | |
| Bounded CFsFilCnt | |
| Bounded CGid | |
| Bounded CId | |
| Bounded CIno | |
| Bounded CKey | |
| Bounded CMode | |
| Bounded CNfds | |
| Bounded CNlink | |
| Bounded COff | |
| Bounded CPid | |
| Bounded CRLim | |
| Bounded CSocklen | |
| Bounded CSsize | |
| Bounded CTcflag | |
| Bounded CUid | |
| Bounded Fd | |
| Bounded Extension | |
| Bounded Ordering | Since: base-2.1 |
| Bounded Leniency Source # | |
| Bounded I8 | |
| Bounded FPFormat | |
| Bounded () | Since: base-2.1 |
| Bounded Bool | Since: base-2.1 |
| Bounded Char | Since: base-2.1 |
| Bounded Int | Since: base-2.1 |
| Bounded Levity | Since: base-4.16.0.0 |
| Bounded VecCount | Since: base-4.10.0.0 |
| Bounded VecElem | Since: base-4.10.0.0 |
| Bounded Word | Since: base-2.1 |
| Bounded a => Bounded (And a) | Since: base-4.16 |
| Bounded a => Bounded (Iff a) | Since: base-4.16 |
| Bounded a => Bounded (Ior a) | Since: base-4.16 |
| Bounded a => Bounded (Xor a) | Since: base-4.16 |
| Bounded a => Bounded (Identity a) | Since: base-4.9.0.0 |
| Bounded a => Bounded (Down a) | Swaps Since: base-4.14.0.0 |
| Bounded a => Bounded (First a) | Since: base-4.9.0.0 |
| Bounded a => Bounded (Last a) | Since: base-4.9.0.0 |
| Bounded a => Bounded (Max a) | Since: base-4.9.0.0 |
| Bounded a => Bounded (Min a) | Since: base-4.9.0.0 |
| Bounded m => Bounded (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup | |
| Bounded a => Bounded (Dual a) | Since: base-2.1 |
| Bounded a => Bounded (Product a) | Since: base-2.1 |
| Bounded a => Bounded (Sum a) | Since: base-2.1 |
| Bounded a => Bounded (Solo a) | |
| Bounded (Proxy t) | Since: base-4.7.0.0 |
| (Bounded a, Bounded b) => Bounded (a, b) | Since: base-2.1 |
| Bounded a => Bounded (Const a b) | Since: base-4.9.0.0 |
| (Applicative f, Bounded a) => Bounded (Ap f a) | Since: base-4.12.0.0 |
| Coercible a b => Bounded (Coercion a b) | Since: base-4.7.0.0 |
| a ~ b => Bounded (a :~: b) | Since: base-4.7.0.0 |
| (Bounded a, Bounded b, Bounded c) => Bounded (a, b, c) | Since: base-2.1 |
| a ~~ b => Bounded (a :~~: b) | Since: base-4.10.0.0 |
| (Bounded a, Bounded b, Bounded c, Bounded d) => Bounded (a, b, c, d) | Since: base-2.1 |
| Bounded (f (g a)) => Bounded (Compose f g a) | Since: base-4.19.0.0 |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e) => Bounded (a, b, c, d, e) | Since: base-2.1 |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f) => Bounded (a, b, c, d, e, f) | Since: base-2.1 |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g) => Bounded (a, b, c, d, e, f, g) | Since: base-2.1 |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h) => Bounded (a, b, c, d, e, f, g, h) | Since: base-2.1 |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i) => Bounded (a, b, c, d, e, f, g, h, i) | Since: base-2.1 |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j) => Bounded (a, b, c, d, e, f, g, h, i, j) | Since: base-2.1 |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k) => Bounded (a, b, c, d, e, f, g, h, i, j, k) | Since: base-2.1 |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l) | Since: base-2.1 |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m) | Since: base-2.1 |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m, Bounded n) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m, n) | Since: base-2.1 |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m, Bounded n, Bounded o) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) | Since: base-2.1 |
class Fractional a => Floating a where #
Trigonometric and hyperbolic functions and related functions.
The Haskell Report defines no laws for Floating. However, (, +)(
and *)exp are customarily expected to define an exponential field and have
the following properties:
exp (a + b)=exp a * exp bexp (fromInteger 0)=fromInteger 1
Minimal complete definition
pi, exp, log, sin, cos, asin, acos, atan, sinh, cosh, asinh, acosh, atanh
Methods
(**) :: a -> a -> a infixr 8 #
computes log1p x, but provides more precise
results for small (absolute) values of log (1 + x)x if possible.
Since: base-4.9.0.0
computes expm1 x, but provides more precise
results for small (absolute) values of exp x - 1x if possible.
Since: base-4.9.0.0
Instances
class (RealFrac a, Floating a) => RealFloat a where #
Efficient, machine-independent access to the components of a floating-point number.
Minimal complete definition
floatRadix, floatDigits, floatRange, decodeFloat, encodeFloat, isNaN, isInfinite, isDenormalized, isNegativeZero, isIEEE
Methods
floatRadix :: a -> Integer #
a constant function, returning the radix of the representation
(often 2)
floatDigits :: a -> Int #
a constant function, returning the number of digits of
floatRadix in the significand
floatRange :: a -> (Int, Int) #
a constant function, returning the lowest and highest values the exponent may assume
decodeFloat :: a -> (Integer, Int) #
The function decodeFloat applied to a real floating-point
number returns the significand expressed as an Integer and an
appropriately scaled exponent (an Int). If
yields decodeFloat x(m,n), then x is equal in value to m*b^^n, where b
is the floating-point radix, and furthermore, either m and n
are both zero or else b^(d-1) <= , where abs m < b^dd is
the value of .
In particular, floatDigits x. If the type
contains a negative zero, also decodeFloat 0 = (0,0).
The result of decodeFloat (-0.0) = (0,0) is unspecified if either of
decodeFloat x or isNaN x is isInfinite xTrue.
encodeFloat :: Integer -> Int -> a #
encodeFloat performs the inverse of decodeFloat in the
sense that for finite x with the exception of -0.0,
.
uncurry encodeFloat (decodeFloat x) = x is one of the two closest representable
floating-point numbers to encodeFloat m nm*b^^n (or ±Infinity if overflow
occurs); usually the closer, but if m contains too many bits,
the result may be rounded in the wrong direction.
exponent corresponds to the second component of decodeFloat.
and for finite nonzero exponent 0 = 0x,
.
If exponent x = snd (decodeFloat x) + floatDigits xx is a finite floating-point number, it is equal in value to
, where significand x * b ^^ exponent xb is the
floating-point radix.
The behaviour is unspecified on infinite or NaN values.
significand :: a -> a #
The first component of decodeFloat, scaled to lie in the open
interval (-1,1), either 0.0 or of absolute value >= 1/b,
where b is the floating-point radix.
The behaviour is unspecified on infinite or NaN values.
scaleFloat :: Int -> a -> a #
multiplies a floating-point number by an integer power of the radix
True if the argument is an IEEE "not-a-number" (NaN) value
isInfinite :: a -> Bool #
True if the argument is an IEEE infinity or negative infinity
isDenormalized :: a -> Bool #
True if the argument is too small to be represented in
normalized format
isNegativeZero :: a -> Bool #
True if the argument is an IEEE negative zero
True if the argument is an IEEE floating point number
a version of arctangent taking two real floating-point arguments.
For real floating x and y, computes the angle
(from the positive x-axis) of the vector from the origin to the
point atan2 y x(x,y). returns a value in the range [atan2 y x-pi,
pi]. It follows the Common Lisp semantics for the origin when
signed zeroes are supported. , with atan2 y 1y in a type
that is RealFloat, should return the same value as .
A default definition of atan yatan2 is provided, but implementors
can provide a more accurate implementation.
Instances
class (Real a, Fractional a) => RealFrac a where #
Extracting components of fractions.
Minimal complete definition
Methods
properFraction :: Integral b => a -> (b, a) #
The function properFraction takes a real fractional number x
and returns a pair (n,f) such that x = n+f, and:
nis an integral number with the same sign asx; andfis a fraction with the same type and sign asx, and with absolute value less than1.
The default definitions of the ceiling, floor, truncate
and round functions are in terms of properFraction.
truncate :: Integral b => a -> b #
returns the integer nearest truncate xx between zero and x
round :: Integral b => a -> b #
returns the nearest integer to round xx;
the even integer if x is equidistant between two integers
ceiling :: Integral b => a -> b #
returns the least integer not less than ceiling xx
floor :: Integral b => a -> b #
returns the greatest integer not greater than floor xx
Instances
This class gives the integer associated with a type-level natural. There are instances of the class for every concrete literal: 0, 1, 2, etc.
Since: base-4.7.0.0
Minimal complete definition
class KnownSymbol (n :: Symbol) #
This class gives the string associated with a type-level symbol. There are instances of the class for every concrete literal: "hello", etc.
Since: base-4.7.0.0
Minimal complete definition
Rational numbers, with numerator and denominator of some Integral type.
Note that Ratio's instances inherit the deficiencies from the type
parameter's. For example, Ratio Natural's Num instance has similar
problems to Natural's.
Instances
| NFData1 Ratio | Available on Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
| Integral a => Lift (Ratio a :: Type) | |
| (Data a, Integral a) => Data (Ratio a) | Since: base-4.0.0.0 |
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Ratio a -> c (Ratio a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Ratio a) # toConstr :: Ratio a -> Constr # dataTypeOf :: Ratio a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Ratio a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Ratio a)) # gmapT :: (forall b. Data b => b -> b) -> Ratio a -> Ratio a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Ratio a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Ratio a -> r # gmapQ :: (forall d. Data d => d -> u) -> Ratio a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Ratio a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Ratio a -> m (Ratio a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Ratio a -> m (Ratio a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Ratio a -> m (Ratio a) # | |
| (Storable a, Integral a) => Storable (Ratio a) | Since: base-4.8.0.0 |
| Integral a => Enum (Ratio a) | Since: base-2.0.1 |
| Integral a => Num (Ratio a) | Since: base-2.0.1 |
| (Integral a, Read a) => Read (Ratio a) | Since: base-2.1 |
| Integral a => Fractional (Ratio a) | Since: base-2.0.1 |
| Integral a => Real (Ratio a) | Since: base-2.0.1 |
Defined in GHC.Real Methods toRational :: Ratio a -> Rational # | |
| Integral a => RealFrac (Ratio a) | Since: base-2.0.1 |
| Show a => Show (Ratio a) | Since: base-2.0.1 |
| NFData a => NFData (Ratio a) | |
Defined in Control.DeepSeq | |
| Eq a => Eq (Ratio a) | Since: base-2.1 |
| Integral a => Ord (Ratio a) | Since: base-2.0.1 |
| Hashable a => Hashable (Ratio a) | |
Defined in Data.Hashable.Class | |
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
A reference to a value of type a.
Instances
| IsStatic StaticPtr | Since: base-4.9.0.0 |
Defined in GHC.StaticPtr Methods fromStaticPtr :: Typeable a => StaticPtr a -> StaticPtr a # | |
CallStacks are a lightweight method of obtaining a
partial call-stack at any point in the program.
A function can request its call-site with the HasCallStack constraint.
For example, we can define
putStrLnWithCallStack :: HasCallStack => String -> IO ()
as a variant of putStrLn that will get its call-site and print it,
along with the string given as argument. We can access the
call-stack inside putStrLnWithCallStack with callStack.
>>>:{putStrLnWithCallStack :: HasCallStack => String -> IO () putStrLnWithCallStack msg = do putStrLn msg putStrLn (prettyCallStack callStack) :}
Thus, if we call putStrLnWithCallStack we will get a formatted call-stack
alongside our string.
>>>putStrLnWithCallStack "hello"hello CallStack (from HasCallStack): putStrLnWithCallStack, called at <interactive>:... in interactive:Ghci...
GHC solves HasCallStack constraints in three steps:
- If there is a
CallStackin scope -- i.e. the enclosing function has aHasCallStackconstraint -- GHC will append the new call-site to the existingCallStack. - If there is no
CallStackin scope -- e.g. in the GHCi session above -- and the enclosing definition does not have an explicit type signature, GHC will infer aHasCallStackconstraint for the enclosing definition (subject to the monomorphism restriction). - If there is no
CallStackin scope and the enclosing definition has an explicit type signature, GHC will solve theHasCallStackconstraint for the singletonCallStackcontaining just the current call-site.
CallStacks do not interact with the RTS and do not require compilation
with -prof. On the other hand, as they are built up explicitly via the
HasCallStack constraints, they will generally not contain as much
information as the simulated call-stacks maintained by the RTS.
A CallStack is a [(String, SrcLoc)]. The String is the name of
function that was called, the SrcLoc is the call-site. The list is
ordered with the most recently called function at the head.
NOTE: The intrepid user may notice that HasCallStack is just an
alias for an implicit parameter ?callStack :: CallStack. This is an
implementation detail and should not be considered part of the
CallStack API, we may decide to change the implementation in the
future.
Since: base-4.8.1.0
type family CmpNat (a :: Natural) (b :: Natural) :: Ordering where ... #
Comparison of type-level naturals, as a function.
Since: base-4.7.0.0
type HasCallStack = ?callStack :: CallStack #
Request a CallStack.
NOTE: The implicit parameter ?callStack :: CallStack is an
implementation detail and should not be considered part of the
CallStack API, we may decide to change the implementation in the
future.
Since: base-4.9.0.0
getCallStack :: CallStack -> [([Char], SrcLoc)] #
Extract a list of call-sites from the CallStack.
The list is ordered by most recent call.
Since: base-4.8.1.0
until :: (a -> Bool) -> (a -> a) -> a -> a #
yields the result of applying until p ff until p holds.
currentCallStack :: IO [String] #
Returns a [String] representing the current call stack. This
can be useful for debugging.
The implementation uses the call-stack simulation maintained by the
profiler, so it only works if the program was compiled with -prof
and contains suitable SCC annotations (e.g. by using -fprof-auto).
Otherwise, the list returned is likely to be empty or
uninformative.
Since: base-4.5.0.0
boundedEnumFrom :: (Enum a, Bounded a) => a -> [a] #
boundedEnumFromThen :: (Enum a, Bounded a) => a -> a -> [a] #
divZeroError :: a #
overflowError :: a #
underflowError :: a #
ratioPrec1 :: Int #
notANumber :: Rational #
reduce :: Integral a => a -> a -> Ratio a #
reduce is a subsidiary function used only in this module.
It normalises a ratio by dividing both numerator and denominator by
their greatest common divisor.
Extract the numerator of the ratio in reduced form: the numerator and denominator have no common factor and the denominator is positive.
denominator :: Ratio a -> a #
Extract the denominator of the ratio in reduced form: the numerator and denominator have no common factor and the denominator is positive.
numericEnumFrom :: Fractional a => a -> [a] #
numericEnumFromThen :: Fractional a => a -> a -> [a] #
numericEnumFromTo :: (Ord a, Fractional a) => a -> a -> [a] #
numericEnumFromThenTo :: (Ord a, Fractional a) => a -> a -> a -> [a] #
Arguments
| :: Real a | |
| => (a -> ShowS) | a function that can show unsigned values |
| -> Int | the precedence of the enclosing context |
| -> a | the value to show |
| -> ShowS |
Converts a possibly-negative Real value to a string.
(^^) :: (Fractional a, Integral b) => a -> b -> a infixr 8 #
raise a number to an integral power
gcd :: Integral a => a -> a -> a #
is the non-negative factor of both gcd x yx and y of which
every common factor of x and y is also a factor; for example
, gcd 4 2 = 2, gcd (-4) 6 = 2 = gcd 0 44. = gcd 0 00.
(That is, the common divisor that is "greatest" in the divisibility
preordering.)
Note: Since for signed fixed-width integer types, ,
the result may be negative if one of the arguments is abs minBound < 0 (and
necessarily is if the other is minBound0 or ) for such types.minBound
lcm :: Integral a => a -> a -> a #
is the smallest positive integer that both lcm x yx and y divide.
integralEnumFrom :: (Integral a, Bounded a) => a -> [a] #
integralEnumFromThen :: (Integral a, Bounded a) => a -> a -> [a] #
integralEnumFromTo :: Integral a => a -> a -> [a] #
integralEnumFromThenTo :: Integral a => a -> a -> a -> [a] #
showFloat :: RealFloat a => a -> ShowS #
Show a signed RealFloat value to full precision
using standard decimal notation for arguments whose absolute value lies
between 0.1 and 9,999,999, and scientific notation otherwise.
This type represents unknown type-level natural numbers.
Since: base-4.10.0.0
A type synonym for Natural.
Previously, this was an opaque data type, but it was changed to a type synonym.
Since: base-4.16.0.0
someNatVal :: Integer -> Maybe SomeNat #
Convert an integer into an unknown type-level natural.
Since: base-4.7.0.0
data SomeSymbol #
This type represents unknown type-level symbols.
Constructors
| KnownSymbol n => SomeSymbol (Proxy n) | Since: base-4.7.0.0 |
Instances
| Read SomeSymbol | Since: base-4.7.0.0 |
Defined in GHC.TypeLits Methods readsPrec :: Int -> ReadS SomeSymbol # readList :: ReadS [SomeSymbol] # readPrec :: ReadPrec SomeSymbol # readListPrec :: ReadPrec [SomeSymbol] # | |
| Show SomeSymbol | Since: base-4.7.0.0 |
Defined in GHC.TypeLits Methods showsPrec :: Int -> SomeSymbol -> ShowS # show :: SomeSymbol -> String # showList :: [SomeSymbol] -> ShowS # | |
| Eq SomeSymbol | Since: base-4.7.0.0 |
Defined in GHC.TypeLits | |
| Ord SomeSymbol | Since: base-4.7.0.0 |
Defined in GHC.TypeLits Methods compare :: SomeSymbol -> SomeSymbol -> Ordering # (<) :: SomeSymbol -> SomeSymbol -> Bool # (<=) :: SomeSymbol -> SomeSymbol -> Bool # (>) :: SomeSymbol -> SomeSymbol -> Bool # (>=) :: SomeSymbol -> SomeSymbol -> Bool # max :: SomeSymbol -> SomeSymbol -> SomeSymbol # min :: SomeSymbol -> SomeSymbol -> SomeSymbol # | |
symbolVal :: forall (n :: Symbol) proxy. KnownSymbol n => proxy n -> String #
Since: base-4.7.0.0
someSymbolVal :: String -> SomeSymbol #
Convert a string into an unknown type-level symbol.
Since: base-4.7.0.0
prettySrcLoc :: SrcLoc -> String #
Pretty print a SrcLoc.
Since: base-4.9.0.0
prettyCallStack :: CallStack -> String #
Pretty print a CallStack.
Since: base-4.9.0.0
withFrozenCallStack :: HasCallStack => (HasCallStack => a) -> a #
Perform some computation without adding new entries to the CallStack.
Since: base-4.9.0.0
Location information about an address from a backtrace.
Constructors
| Location | |
Fields
| |
getStackTrace :: IO (Maybe [Location]) #
Get a trace of the current execution stack state.
Returns Nothing if stack trace support isn't available on host machine.
showStackTrace :: IO (Maybe String) #
Get a string representation of the current execution stack state.