Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
Protolude
Contents
- Base functions
- Function functions
- List functions
- Data Structures
- Show functions
- Bool functions
- Monad functions
- Functor functions
- Either functions
- Applicative functions
- String conversion
- Debug functions
- Panic functions
- Exception functions
- Semiring functions
- String functions
- Safe functions
- Eq functions
- Ord functions
- Traversable functions
- Foldable functions
- Semigroup functions
- Monoid functions
- Bifunctor functions
- Bifunctor functions
- Deepseq functions
- Tuple functions
- Typelevel programming
- Monads
- Integers
- Complex functions
- Char functions
- Maybe functions
- Generics functions
- ByteString functions
- Text functions
- Read functions
- System functions
- Concurrency functions
- Foreign functions
Synopsis
- (++) :: [a] -> [a] -> [a]
- seq :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b
- fromIntegral :: (Integral a, Num b) => a -> b
- realToFrac :: (Real a, Fractional b) => a -> b
- class Bounded a where
- 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 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 Num a => Fractional a where
- (/) :: a -> a -> a
- recip :: a -> a
- fromRational :: Rational -> a
- class (Real a, Enum a) => Integral a where
- class Num a where
- class (Num a, Ord a) => Real a where
- toRational :: a -> Rational
- 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 Show a
- class KnownNat (n :: Nat)
- class KnownSymbol (n :: Symbol)
- class IsLabel (x :: Symbol) a where
- fromLabel :: a
- class HasField (x :: k) r a | x r -> a where
- getField :: r -> a
- data Bool
- data Char
- data Double = D# Double#
- data Float = F# Float#
- data Int
- data Integer
- data Ordering
- data Ratio a
- type Rational = Ratio Integer
- data IO a
- data Word
- data Ptr a
- data FunPtr a
- type Type = Type
- data Constraint
- data Nat
- data Symbol
- type family CmpNat (a :: Nat) (b :: Nat) :: Ordering where ...
- class a ~R# b => Coercible (a :: k) (b :: k)
- data StaticPtr a
- data CallStack
- showStackTrace :: IO (Maybe String)
- getStackTrace :: IO (Maybe [Location])
- data SrcLoc = SrcLoc String Int Int
- data Location = Location {
- objectName :: String
- functionName :: String
- srcLoc :: Maybe SrcLoc
- withFrozenCallStack :: HasCallStack => (HasCallStack => a) -> a
- callStack :: HasCallStack => CallStack
- prettyCallStack :: CallStack -> String
- prettySrcLoc :: SrcLoc -> String
- someSymbolVal :: String -> SomeSymbol
- someNatVal :: Integer -> Maybe SomeNat
- symbolVal :: forall (n :: Symbol) proxy. KnownSymbol n => proxy n -> String
- natVal :: forall (n :: Nat) proxy. KnownNat n => proxy n -> Integer
- data SomeSymbol = KnownSymbol n => SomeSymbol (Proxy n)
- data SomeNat = KnownNat n => SomeNat (Proxy n)
- integralEnumFromThenTo :: Integral a => a -> a -> a -> [a]
- integralEnumFromTo :: Integral a => a -> a -> [a]
- integralEnumFromThen :: (Integral a, Bounded a) => a -> a -> [a]
- integralEnumFrom :: (Integral a, Bounded a) => a -> [a]
- lcm :: Integral a => a -> a -> a
- gcd :: Integral a => a -> a -> a
- (^^%^^) :: Integral a => Rational -> a -> Rational
- (^%^) :: Integral a => Rational -> a -> Rational
- (^^) :: (Fractional a, Integral b) => a -> b -> a
- (^) :: (Num a, Integral b) => a -> b -> a
- odd :: Integral a => a -> Bool
- even :: Integral a => a -> Bool
- numericEnumFromThenTo :: (Ord a, Fractional a) => a -> a -> a -> [a]
- numericEnumFromTo :: (Ord a, Fractional a) => a -> a -> [a]
- numericEnumFromThen :: Fractional a => a -> a -> [a]
- numericEnumFrom :: Fractional a => a -> [a]
- denominator :: Ratio a -> a
- numerator :: Ratio a -> a
- (%) :: Integral a => a -> a -> Ratio a
- reduce :: Integral a => a -> a -> Ratio a
- notANumber :: Rational
- infinity :: Rational
- ratioPrec1 :: Int
- ratioPrec :: Int
- underflowError :: a
- overflowError :: a
- ratioZeroDenominatorError :: a
- divZeroError :: a
- boundedEnumFromThen :: (Enum a, Bounded a) => a -> a -> [a]
- boundedEnumFrom :: (Enum a, Bounded a) => a -> [a]
- subtract :: Num a => a -> a -> a
- currentCallStack :: IO [String]
- asTypeOf :: a -> a -> a
- until :: (a -> Bool) -> (a -> a) -> a -> a
- maxInt :: Int
- minInt :: Int
- ord :: Char -> Int
- getCallStack :: CallStack -> [([Char], SrcLoc)]
- type HasCallStack = ?callStack :: CallStack
- ($!) :: (a -> b) -> a -> b
- identity :: a -> a
- pass :: Applicative f => f ()
- ($) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
- (&) :: a -> (a -> b) -> b
- on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
- fix :: (a -> a) -> a
- flip :: (a -> b -> c) -> b -> a -> c
- (.) :: (b -> c) -> (a -> b) -> a -> c
- const :: a -> b -> a
- applyN :: Int -> (a -> a) -> a -> a
- filter :: (a -> Bool) -> [a] -> [a]
- zip :: [a] -> [b] -> [(a, b)]
- nonEmpty :: [a] -> Maybe (NonEmpty a)
- unfoldr :: (b -> Maybe (a, b)) -> b -> [a]
- sortBy :: (a -> a -> Ordering) -> [a] -> [a]
- sort :: Ord a => [a] -> [a]
- permutations :: [a] -> [[a]]
- subsequences :: [a] -> [[a]]
- tails :: [a] -> [[a]]
- inits :: [a] -> [[a]]
- groupBy :: (a -> a -> Bool) -> [a] -> [[a]]
- group :: Eq a => [a] -> [[a]]
- genericReplicate :: Integral i => i -> a -> [a]
- genericSplitAt :: Integral i => i -> [a] -> ([a], [a])
- genericDrop :: Integral i => i -> [a] -> [a]
- genericTake :: Integral i => i -> [a] -> [a]
- genericLength :: Num i => [a] -> i
- transpose :: [[a]] -> [[a]]
- intercalate :: [a] -> [[a]] -> [a]
- intersperse :: a -> [a] -> [a]
- isInfixOf :: Eq a => [a] -> [a] -> Bool
- isSuffixOf :: Eq a => [a] -> [a] -> Bool
- isPrefixOf :: Eq a => [a] -> [a] -> Bool
- unzip :: [(a, b)] -> ([a], [b])
- zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
- reverse :: [a] -> [a]
- break :: (a -> Bool) -> [a] -> ([a], [a])
- splitAt :: Int -> [a] -> ([a], [a])
- drop :: Int -> [a] -> [a]
- take :: Int -> [a] -> [a]
- dropWhile :: (a -> Bool) -> [a] -> [a]
- takeWhile :: (a -> Bool) -> [a] -> [a]
- cycle :: [a] -> [a]
- replicate :: Int -> a -> [a]
- repeat :: a -> [a]
- iterate :: (a -> a) -> a -> [a]
- scanr :: (a -> b -> b) -> b -> [a] -> [b]
- scanl' :: (b -> a -> b) -> b -> [a] -> [b]
- scanl :: (b -> a -> b) -> b -> [a] -> [b]
- data NonEmpty a = a :| [a]
- head :: Foldable f => f a -> Maybe a
- sortOn :: Ord o => (a -> o) -> [a] -> [a]
- ordNub :: Ord a => [a] -> [a]
- list :: [b] -> (a -> b) -> [a] -> [b]
- product :: (Foldable f, Num a) => f a -> a
- sum :: (Foldable f, Num a) => f a -> a
- map :: Functor f => (a -> b) -> f a -> f b
- uncons :: [a] -> Maybe (a, [a])
- unsnoc :: [x] -> Maybe ([x], x)
- data IntMap a
- data IntSet
- data Map k a
- data Seq a
- data Set a
- module Protolude.Show
- show :: (Show a, StringConv String b) => a -> b
- print :: (MonadIO m, Show a) => a -> m ()
- otherwise :: Bool
- data Bool
- (&&) :: Bool -> Bool -> Bool
- (||) :: Bool -> Bool -> Bool
- not :: Bool -> Bool
- bool :: a -> a -> Bool -> a
- whenM :: Monad m => m Bool -> m () -> m ()
- unlessM :: Monad m => m Bool -> m () -> m ()
- ifM :: Monad m => m Bool -> m a -> m a -> m a
- guardM :: MonadPlus m => m Bool -> m ()
- (||^) :: Monad m => m Bool -> m Bool -> m Bool
- (<||>) :: Applicative a => a Bool -> a Bool -> a Bool
- (&&^) :: Monad m => m Bool -> m Bool -> m Bool
- (<&&>) :: Applicative a => a Bool -> a Bool -> a Bool
- module Protolude.Monad
- liftIO1 :: MonadIO m => (a -> IO b) -> a -> m b
- liftIO2 :: MonadIO m => (a -> b -> IO c) -> a -> b -> m c
- class Functor (f :: Type -> Type) where
- newtype Identity a = Identity {
- runIdentity :: a
- void :: Functor f => f a -> f ()
- ($>) :: Functor f => f a -> b -> f b
- (<&>) :: Functor f => f a -> (a -> b) -> f b
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- (<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
- foreach :: Functor f => f a -> (a -> b) -> f b
- data Either a b
- fromRight :: b -> Either a b -> b
- fromLeft :: a -> Either a b -> a
- isRight :: Either a b -> Bool
- isLeft :: Either a b -> Bool
- partitionEithers :: [Either a b] -> ([a], [b])
- rights :: [Either a b] -> [b]
- lefts :: [Either a b] -> [a]
- either :: (a -> c) -> (b -> c) -> Either a b -> c
- leftToMaybe :: Either l r -> Maybe l
- rightToMaybe :: Either l r -> Maybe r
- maybeToRight :: l -> Maybe r -> Either l r
- maybeToLeft :: r -> Maybe l -> Either l r
- maybeEmpty :: Monoid b => (a -> b) -> Maybe a -> b
- maybeToEither :: e -> Maybe a -> Either e a
- class Functor f => Applicative (f :: Type -> Type) where
- optional :: Alternative f => f a -> f (Maybe a)
- newtype ZipList a = ZipList {
- getZipList :: [a]
- newtype Const a (b :: k) = Const {
- getConst :: a
- liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
- liftA :: Applicative f => (a -> b) -> f a -> f b
- (<**>) :: Applicative f => f a -> f (a -> b) -> f b
- class Applicative f => Alternative (f :: Type -> Type) where
- orAlt :: (Alternative f, Monoid a) => f a -> f a
- orEmpty :: Alternative f => Bool -> a -> f a
- eitherA :: Alternative f => f a -> f b -> f (Either a b)
- purer :: (Applicative f, Applicative g) => a -> f (g a)
- liftAA2 :: (Applicative f, Applicative g) => (a -> b -> c) -> f (g a) -> f (g b) -> f (g c)
- (<<*>>) :: (Applicative f, Applicative g) => f (g (a -> b)) -> f (g a) -> f (g b)
- guarded :: Alternative f => (a -> Bool) -> a -> f a
- guardedA :: (Functor f, Alternative t) => (a -> f Bool) -> a -> f (t a)
- module Protolude.ConvertText
- module Protolude.Debug
- module Protolude.Panic
- allowInterrupt :: IO ()
- catches :: IO a -> [Handler a] -> IO a
- data Handler a = Exception e => Handler (e -> IO a)
- bracketOnError :: IO a -> (a -> IO b) -> (a -> IO c) -> IO c
- bracket_ :: IO a -> IO b -> IO c -> IO c
- finally :: IO a -> IO b -> IO a
- bracket :: IO a -> (a -> IO b) -> (a -> IO c) -> IO c
- onException :: IO a -> IO b -> IO a
- tryJust :: Exception e => (e -> Maybe b) -> IO a -> IO (Either b a)
- try :: Exception e => IO a -> IO (Either e a)
- mapException :: (Exception e1, Exception e2) => (e1 -> e2) -> a -> a
- handleJust :: Exception e => (e -> Maybe b) -> (b -> IO a) -> IO a -> IO a
- handle :: Exception e => (e -> IO a) -> IO a -> IO a
- catchJust :: Exception e => (e -> Maybe b) -> IO a -> (b -> IO a) -> IO a
- newtype PatternMatchFail = PatternMatchFail String
- newtype RecSelError = RecSelError String
- newtype RecConError = RecConError String
- newtype RecUpdError = RecUpdError String
- newtype NoMethodError = NoMethodError String
- newtype TypeError = TypeError String
- data NonTermination = NonTermination
- data NestedAtomically = NestedAtomically
- ioError :: IOError -> IO a
- asyncExceptionFromException :: Exception e => SomeException -> Maybe e
- asyncExceptionToException :: Exception e => e -> SomeException
- data BlockedIndefinitelyOnMVar = BlockedIndefinitelyOnMVar
- data BlockedIndefinitelyOnSTM = BlockedIndefinitelyOnSTM
- data Deadlock = Deadlock
- data AllocationLimitExceeded = AllocationLimitExceeded
- newtype CompactionFailed = CompactionFailed String
- newtype AssertionFailed = AssertionFailed String
- data SomeAsyncException = Exception e => SomeAsyncException e
- data AsyncException
- data ArrayException
- evaluate :: a -> IO a
- uninterruptibleMask :: ((forall a. IO a -> IO a) -> IO b) -> IO b
- uninterruptibleMask_ :: IO a -> IO a
- mask :: ((forall a. IO a -> IO a) -> IO b) -> IO b
- mask_ :: IO a -> IO a
- getMaskingState :: IO MaskingState
- interruptible :: IO a -> IO a
- catch :: Exception e => IO a -> (e -> IO a) -> IO a
- data MaskingState
- data IOException
- data ErrorCall where
- class (Typeable e, Show e) => Exception e where
- toException :: e -> SomeException
- fromException :: SomeException -> Maybe e
- displayException :: e -> String
- data ArithException
- data SomeException = Exception e => SomeException e
- hush :: Alternative m => Either e a -> m a
- note :: MonadError e m => e -> Maybe a -> m a
- tryIO :: MonadIO m => IO a -> ExceptT IOException m a
- throwIO :: (MonadIO m, Exception e) => e -> m a
- throwTo :: (MonadIO m, Exception e) => ThreadId -> e -> m ()
- module Protolude.Semiring
- class IsString a
- headMay :: [a] -> Maybe a
- headDef :: a -> [a] -> a
- initMay :: [a] -> Maybe [a]
- initDef :: [a] -> [a] -> [a]
- initSafe :: [a] -> [a]
- tailMay :: [a] -> Maybe [a]
- tailDef :: [a] -> [a] -> [a]
- tailSafe :: [a] -> [a]
- lastMay :: [a] -> Maybe a
- lastDef :: a -> [a] -> a
- minimumMay :: Ord a => [a] -> Maybe a
- maximumMay :: Ord a => [a] -> Maybe a
- minimumDef :: Ord a => a -> [a] -> a
- maximumDef :: Ord a => a -> [a] -> a
- foldr1May :: (a -> a -> a) -> [a] -> Maybe a
- foldl1May :: (a -> a -> a) -> [a] -> Maybe a
- foldl1May' :: (a -> a -> a) -> [a] -> Maybe a
- atMay :: [a] -> Int -> Maybe a
- atDef :: a -> [a] -> Int -> a
- class Eq a where
- class Eq a => Ord a where
- data Ordering
- comparing :: Ord a => (b -> a) -> b -> b -> Ordering
- newtype Down a = Down a
- module Data.Traversable
- class Foldable (t :: Type -> Type) where
- fold :: Monoid m => t m -> m
- foldMap :: Monoid m => (a -> m) -> t a -> m
- foldr :: (a -> b -> b) -> b -> t a -> b
- foldr' :: (a -> b -> b) -> b -> t a -> b
- foldl :: (b -> a -> b) -> b -> t a -> b
- foldl' :: (b -> a -> b) -> b -> t a -> b
- toList :: t a -> [a]
- null :: t a -> Bool
- length :: t a -> Int
- elem :: Eq a => a -> t a -> Bool
- maximum :: Ord a => t a -> a
- minimum :: Ord a => t a -> a
- forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m ()
- mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
- find :: Foldable t => (a -> Bool) -> t a -> Maybe a
- notElem :: (Foldable t, Eq a) => a -> t a -> Bool
- minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
- maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
- all :: Foldable t => (a -> Bool) -> t a -> Bool
- any :: Foldable t => (a -> Bool) -> t a -> Bool
- or :: Foldable t => t Bool -> Bool
- and :: Foldable t => t Bool -> Bool
- concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
- concat :: Foldable t => t [a] -> [a]
- msum :: (Foldable t, MonadPlus m) => t (m a) -> m a
- asum :: (Foldable t, Alternative f) => t (f a) -> f a
- sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
- sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f ()
- for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()
- traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
- foldlM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
- foldrM :: (Foldable t, Monad m) => (a -> b -> m b) -> b -> t a -> m b
- class Semigroup a where
- option :: b -> (a -> b) -> Option a -> b
- mtimesDefault :: (Integral b, Monoid a) => b -> a -> a
- diff :: Semigroup m => m -> Endo m
- cycle1 :: Semigroup m => m -> m
- data WrappedMonoid m
- newtype Option a = Option {}
- stimesMonoid :: (Integral b, Monoid a) => b -> a -> a
- stimesIdempotent :: Integral b => b -> a -> a
- stimesIdempotentMonoid :: (Integral b, Monoid a) => b -> a -> a
- module Data.Monoid
- class Bifunctor (p :: Type -> Type -> Type) where
- hashUsing :: Hashable b => (a -> b) -> Int -> a -> Int
- class Eq a => Hashable a where
- hashWithSalt :: Int -> a -> Int
- hash :: a -> Int
- force :: NFData a => a -> a
- ($!!) :: NFData a => (a -> b) -> a -> b
- deepseq :: NFData a => a -> b -> b
- class NFData a where
- rnf :: a -> ()
- fst :: (a, b) -> a
- snd :: (a, b) -> b
- swap :: (a, b) -> (b, a)
- uncurry :: (a -> b -> c) -> (a, b) -> c
- curry :: ((a, b) -> c) -> a -> b -> c
- class Typeable (a :: k)
- gcast :: forall k (a :: k) (b :: k) c. (Typeable a, Typeable b) => c a -> Maybe (c b)
- eqT :: forall k (a :: k) (b :: k). (Typeable a, Typeable b) => Maybe (a :~: b)
- cast :: (Typeable a, Typeable b) => a -> Maybe b
- typeRep :: forall k proxy (a :: k). Typeable a => proxy a -> TypeRep
- typeOf :: Typeable a => a -> TypeRep
- type TypeRep = SomeTypeRep
- vacuous :: Functor f => f Void -> f a
- absurd :: Void -> a
- data Void
- data Proxy (t :: k) = Proxy
- repr :: forall k (a :: k) (b :: k). (a :~: b) -> Coercion a b
- coerceWith :: Coercion a b -> a -> b
- data Coercion (a :: k) (b :: k) where
- gcastWith :: forall k (a :: k) (b :: k) r. (a :~: b) -> (a ~ b => r) -> r
- castWith :: (a :~: b) -> a -> b
- trans :: forall k (a :: k) (b :: k) (c :: k). (a :~: b) -> (b :~: c) -> a :~: c
- sym :: forall k (a :: k) (b :: k). (a :~: b) -> b :~: a
- data (a :: k) :~: (b :: k) where
- type family (a :: k) == (b :: k) :: Bool where ...
- class Monad m => MonadFail (m :: Type -> Type)
- gets :: MonadState s m => (s -> a) -> m a
- modify :: MonadState s m => (s -> s) -> m ()
- class Monad m => MonadState s (m :: Type -> Type) | m -> s where
- newtype StateT s (m :: Type -> Type) a = StateT {
- runStateT :: s -> m (a, s)
- type State s = StateT s Identity
- runState :: State s a -> s -> (a, s)
- evalState :: State s a -> s -> a
- execState :: State s a -> s -> s
- withState :: (s -> s) -> State s a -> State s a
- evalStateT :: Monad m => StateT s m a -> s -> m a
- execStateT :: Monad m => StateT s m a -> s -> m s
- asks :: MonadReader r m => (r -> a) -> m a
- class Monad m => MonadReader r (m :: Type -> Type) | m -> r where
- newtype ReaderT r (m :: Type -> Type) a = ReaderT {
- runReaderT :: r -> m a
- type Reader r = ReaderT r Identity
- runReader :: Reader r a -> r -> a
- class Monad m => MonadError e (m :: Type -> Type) | m -> e where
- throwError :: e -> m a
- catchError :: m a -> (e -> m a) -> m a
- newtype ExceptT e (m :: Type -> Type) a = ExceptT (m (Either e a))
- type Except e = ExceptT e Identity
- runExcept :: Except e a -> Either e a
- mapExcept :: (Either e a -> Either e' b) -> Except e a -> Except e' b
- withExcept :: (e -> e') -> Except e a -> Except e' a
- runExceptT :: ExceptT e m a -> m (Either e a)
- mapExceptT :: (m (Either e a) -> n (Either e' b)) -> ExceptT e m a -> ExceptT e' n b
- withExceptT :: forall (m :: Type -> Type) e e' a. Functor m => (e -> e') -> ExceptT e m a -> ExceptT e' m a
- catchE :: forall (m :: Type -> Type) e a e'. Monad m => ExceptT e m a -> (e -> ExceptT e' m a) -> ExceptT e' m a
- throwE :: forall (m :: Type -> Type) e a. Monad m => e -> ExceptT e m a
- class Monad m => MonadIO (m :: Type -> Type) where
- lift :: (MonadTrans t, Monad m) => m a -> t m a
- data ST s a
- fixST :: (a -> ST s a) -> ST s a
- runST :: (forall s. ST s a) -> a
- catchSTM :: Exception e => STM a -> (e -> STM a) -> STM a
- throwSTM :: Exception e => e -> STM a
- orElse :: STM a -> STM a -> STM a
- retry :: STM a
- atomically :: STM a -> IO a
- data STM a
- check :: Bool -> STM ()
- data Int
- data Int8
- data Int16
- data Int32
- data Int64
- data Word
- data Word8
- data Word16
- data Word32
- data Word64
- byteSwap64 :: Word64 -> Word64
- byteSwap32 :: Word32 -> Word32
- byteSwap16 :: Word16 -> Word16
- toIntegralSized :: (Integral a, Integral b, Bits a, Bits b) => a -> Maybe b
- popCountDefault :: (Bits a, Num a) => a -> Int
- testBitDefault :: (Bits a, Num a) => a -> Int -> Bool
- bitDefault :: (Bits a, Num a) => Int -> a
- class Eq a => Bits a where
- (.&.) :: a -> a -> a
- (.|.) :: a -> a -> a
- xor :: a -> a -> a
- complement :: a -> a
- shift :: a -> Int -> a
- rotate :: a -> Int -> a
- zeroBits :: a
- bit :: Int -> a
- setBit :: a -> Int -> a
- clearBit :: a -> Int -> a
- complementBit :: a -> Int -> a
- testBit :: a -> Int -> Bool
- bitSizeMaybe :: a -> Maybe Int
- bitSize :: a -> Int
- isSigned :: a -> Bool
- shiftL :: a -> Int -> a
- shiftR :: a -> Int -> a
- rotateL :: a -> Int -> a
- rotateR :: a -> Int -> a
- popCount :: a -> Int
- class Bits b => FiniteBits b where
- finiteBitSize :: b -> Int
- countLeadingZeros :: b -> Int
- countTrailingZeros :: b -> Int
- phase :: RealFloat a => Complex a -> a
- magnitude :: RealFloat a => Complex a -> a
- polar :: RealFloat a => Complex a -> (a, a)
- cis :: Floating a => a -> Complex a
- mkPolar :: Floating a => a -> a -> Complex a
- conjugate :: Num a => Complex a -> Complex a
- imagPart :: Complex a -> a
- realPart :: Complex a -> a
- data Complex a = !a :+ !a
- data Char
- isLetter :: Char -> Bool
- digitToInt :: Char -> Int
- toTitle :: Char -> Char
- toUpper :: Char -> Char
- toLower :: Char -> Char
- isLower :: Char -> Bool
- isUpper :: Char -> Bool
- isPrint :: Char -> Bool
- isControl :: Char -> Bool
- isAlphaNum :: Char -> Bool
- isAlpha :: Char -> Bool
- isHexDigit :: Char -> Bool
- isDigit :: Char -> Bool
- isSpace :: Char -> Bool
- isAscii :: Char -> Bool
- chr :: Int -> Char
- intToDigit :: Int -> Char
- ord :: Char -> Int
- data Maybe a
- mapMaybe :: (a -> Maybe b) -> [a] -> [b]
- catMaybes :: [Maybe a] -> [a]
- listToMaybe :: [a] -> Maybe a
- maybeToList :: Maybe a -> [a]
- fromMaybe :: a -> Maybe a -> a
- isNothing :: Maybe a -> Bool
- isJust :: Maybe a -> Bool
- maybe :: b -> (a -> b) -> Maybe a -> b
- class Generic a where
- class Generic1 (f :: k -> Type)
- class Datatype (d :: k) where
- datatypeName :: forall k1 t (f :: k1 -> Type) (a :: k1). t d f a -> [Char]
- moduleName :: forall k1 t (f :: k1 -> Type) (a :: k1). t d f a -> [Char]
- packageName :: forall k1 t (f :: k1 -> Type) (a :: k1). t d f a -> [Char]
- isNewtype :: forall k1 t (f :: k1 -> Type) (a :: k1). t d f a -> Bool
- class Constructor (c :: k) where
- class Selector (s :: k) where
- selName :: forall k1 t (f :: k1 -> Type) (a :: k1). t s f a -> [Char]
- selSourceUnpackedness :: forall k1 t (f :: k1 -> Type) (a :: k1). t s f a -> SourceUnpackedness
- selSourceStrictness :: forall k1 t (f :: k1 -> Type) (a :: k1). t s f a -> SourceStrictness
- selDecidedStrictness :: forall k1 t (f :: k1 -> Type) (a :: k1). t s f a -> DecidedStrictness
- data V1 (p :: k)
- data U1 (p :: k) = U1
- newtype K1 i c (p :: k) = K1 {
- unK1 :: c
- newtype M1 i (c :: Meta) (f :: k -> Type) (p :: k) = M1 {
- unM1 :: f p
- data ((f :: k -> Type) :+: (g :: k -> Type)) (p :: k)
- data ((f :: k -> Type) :*: (g :: k -> Type)) (p :: k) = (f p) :*: (g p)
- newtype ((f :: k2 -> Type) :.: (g :: k1 -> k2)) (p :: k1) = Comp1 {
- unComp1 :: f (g p)
- type Rec0 = K1 R :: Type -> k -> Type
- type D1 = M1 D :: Meta -> (k -> Type) -> k -> Type
- type C1 = M1 C :: Meta -> (k -> Type) -> k -> Type
- type S1 = M1 S :: Meta -> (k -> Type) -> k -> Type
- type family Rep a :: Type -> Type
- data family URec a (p :: k)
- data Fixity
- data FixityI
- data Associativity
- data Meta
- data ByteString
- type LByteString = ByteString
- getLine :: IO Text
- getContents :: IO Text
- interact :: (Text -> Text) -> IO ()
- appendFile :: FilePath -> Text -> IO ()
- writeFile :: FilePath -> Text -> IO ()
- readFile :: FilePath -> IO Text
- fromStrict :: Text -> Text
- toStrict :: Text -> Text
- unwords :: [Text] -> Text
- unlines :: [Text] -> Text
- lines :: Text -> [Text]
- words :: Text -> [Text]
- encodeUtf8 :: Text -> ByteString
- decodeUtf8' :: ByteString -> Either UnicodeException Text
- decodeUtf8 :: ByteString -> Text
- decodeUtf8With :: OnDecodeError -> ByteString -> Text
- data Text
- replace :: b -> OnError a b
- ignore :: OnError a b
- lenientDecode :: OnDecodeError
- strictDecode :: OnDecodeError
- type OnError a b = String -> Maybe a -> Maybe b
- type OnDecodeError = OnError Word8 Char
- data UnicodeException
- type LText = Text
- class Read a
- reads :: Read a => ReadS a
- readMaybe :: (Read b, StringConv a String) => a -> Maybe b
- readEither :: (Read a, StringConv String e, StringConv e String) => e -> Either e a
- data Handle
- getArgs :: IO [String]
- exitSuccess :: IO a
- exitFailure :: IO a
- exitWith :: ExitCode -> IO a
- withFile :: FilePath -> IOMode -> (Handle -> IO r) -> IO r
- openFile :: FilePath -> IOMode -> IO Handle
- stderr :: Handle
- stdin :: Handle
- data ExitCode
- stdout :: Handle
- type FilePath = String
- data IOMode
- die :: Text -> IO a
- forkOnWithUnmask :: Int -> ((forall a. IO a -> IO a) -> IO ()) -> IO ThreadId
- forkIOWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO ThreadId
- forkOn :: Int -> IO () -> IO ThreadId
- forkOS :: IO () -> IO ThreadId
- forkIO :: IO () -> IO ThreadId
- data ThreadId
- concurrently :: IO a -> IO b -> IO (a, b)
- race_ :: IO a -> IO b -> IO ()
- race :: IO a -> IO b -> IO (Either a b)
- link2 :: Async a -> Async b -> IO ()
- link :: Async a -> IO ()
- waitBoth :: Async a -> Async b -> IO (a, b)
- waitEitherCancel :: Async a -> Async b -> IO (Either a b)
- waitEither_ :: Async a -> Async b -> IO ()
- waitEither :: Async a -> Async b -> IO (Either a b)
- waitEitherCatchCancel :: Async a -> Async b -> IO (Either (Either SomeException a) (Either SomeException b))
- waitEitherCatch :: Async a -> Async b -> IO (Either (Either SomeException a) (Either SomeException b))
- waitAnyCancel :: [Async a] -> IO (Async a, a)
- waitAny :: [Async a] -> IO (Async a, a)
- waitAnyCatchCancel :: [Async a] -> IO (Async a, Either SomeException a)
- waitAnyCatch :: [Async a] -> IO (Async a, Either SomeException a)
- cancelWith :: Exception e => Async a -> e -> IO ()
- cancel :: Async a -> IO ()
- poll :: Async a -> IO (Maybe (Either SomeException a))
- waitCatch :: Async a -> IO (Either SomeException a)
- wait :: Async a -> IO a
- withAsyncOn :: Int -> IO a -> (Async a -> IO b) -> IO b
- withAsyncBound :: IO a -> (Async a -> IO b) -> IO b
- withAsync :: IO a -> (Async a -> IO b) -> IO b
- asyncOn :: Int -> IO a -> IO (Async a)
- asyncBound :: IO a -> IO (Async a)
- async :: IO a -> IO (Async a)
- data Async a
- newtype Concurrently a = Concurrently {
- runConcurrently :: IO a
- threadWaitWriteSTM :: Fd -> IO (STM (), IO ())
- threadWaitReadSTM :: Fd -> IO (STM (), IO ())
- threadWaitWrite :: Fd -> IO ()
- threadWaitRead :: Fd -> IO ()
- runInUnboundThread :: IO a -> IO a
- runInBoundThread :: IO a -> IO a
- isCurrentThreadBound :: IO Bool
- forkOSWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO ThreadId
- forkFinally :: IO a -> (Either SomeException a -> IO ()) -> IO ThreadId
- rtsSupportsBoundThreads :: Bool
- writeList2Chan :: Chan a -> [a] -> IO ()
- getChanContents :: Chan a -> IO [a]
- dupChan :: Chan a -> IO (Chan a)
- readChan :: Chan a -> IO a
- writeChan :: Chan a -> a -> IO ()
- newChan :: IO (Chan a)
- data Chan a
- signalQSem :: QSem -> IO ()
- waitQSem :: QSem -> IO ()
- newQSem :: Int -> IO QSem
- data QSem
- signalQSemN :: QSemN -> Int -> IO ()
- waitQSemN :: QSemN -> Int -> IO ()
- newQSemN :: Int -> IO QSemN
- data QSemN
- threadDelay :: Int -> IO ()
- mkWeakMVar :: MVar a -> IO () -> IO (Weak (MVar a))
- addMVarFinalizer :: MVar a -> IO () -> IO ()
- modifyMVarMasked :: MVar a -> (a -> IO (a, b)) -> IO b
- modifyMVarMasked_ :: MVar a -> (a -> IO a) -> IO ()
- modifyMVar :: MVar a -> (a -> IO (a, b)) -> IO b
- modifyMVar_ :: MVar a -> (a -> IO a) -> IO ()
- withMVarMasked :: MVar a -> (a -> IO b) -> IO b
- withMVar :: MVar a -> (a -> IO b) -> IO b
- swapMVar :: MVar a -> a -> IO a
- mkWeakThreadId :: ThreadId -> IO (Weak ThreadId)
- threadCapability :: ThreadId -> IO (Int, Bool)
- yield :: IO ()
- myThreadId :: IO ThreadId
- killThread :: ThreadId -> IO ()
- setNumCapabilities :: Int -> IO ()
- getNumCapabilities :: IO Int
- isEmptyMVar :: MVar a -> IO Bool
- tryReadMVar :: MVar a -> IO (Maybe a)
- tryPutMVar :: MVar a -> a -> IO Bool
- tryTakeMVar :: MVar a -> IO (Maybe a)
- putMVar :: MVar a -> a -> IO ()
- readMVar :: MVar a -> IO a
- takeMVar :: MVar a -> IO a
- newMVar :: a -> IO (MVar a)
- newEmptyMVar :: IO (MVar a)
- data MVar a
- data StablePtr a
- data WordPtr
- data IntPtr
- class Storable a
Base functions
(++) :: [a] -> [a] -> [a] infixr 5 #
Append 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.
seq :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b infixr 0 #
The value of seq a b
is bottom if a
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 seq a b
does
not guarantee that a
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.
fromIntegral :: (Integral a, Num b) => a -> b #
general coercion from integral types
realToFrac :: (Real a, Fractional b) => a -> b #
general coercion to fractional types
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
Class Enum
defines operations on sequentially ordered types.
The enumFrom
... methods are used in Haskell's translation of
arithmetic sequences.
Instances of Enum
may be derived for any enumeration type (types
whose constructors have no fields). The nullary constructors are
assumed to be numbered left-to-right by fromEnum
from 0
through n-1
.
See Chapter 10 of the Haskell Report for more details.
For any type that is an instance of class Bounded
as well as Enum
,
the following should hold:
- The calls
andsucc
maxBound
should result in a runtime error.pred
minBound
fromEnum
andtoEnum
should give a runtime error if the result value is not representable in the result type. For example,
is an error.toEnum
7 ::Bool
enumFrom
andenumFromThen
should be defined with an implicit bound, thus:
enumFrom x = enumFromTo x maxBound enumFromThen x y = enumFromThenTo x y bound where bound | fromEnum y >= fromEnum x = maxBound | otherwise = minBound
Methods
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 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 b
exp (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 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:*
)
recip
gives the multiplicative inversex * recip x
=recip x * x
=fromInteger 1
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
Integer
fromRational
to a value of type Rational
, so such literals have type
(
.Fractional
a) => a
Instances
Fractional CFloat | |
Fractional CDouble | |
Integral a => Fractional (Ratio a) | Since: base-2.0.1 |
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 |
Fractional a => Fractional (Const a b) | Since: base-4.9.0.0 |
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 y
withrem x y
=fromInteger 0
org (rem x y)
<g y
x
=y * div x y + mod x y
withmod x y
=fromInteger 0
orf (mod x y)
<f y
An example of a suitable Euclidean function, for Integer
's instance, is
abs
.
Methods
quot :: a -> a -> a infixl 7 #
integer division truncated toward zero
integer remainder, satisfying
(x `quot` y)*y + (x `rem` y) == x
integer division truncated toward negative infinity
integer modulus, satisfying
(x `div` y)*y + (x `mod` y) == x
conversion to Integer
Instances
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 + x
is the additive identityfromInteger
0x + fromInteger 0
=x
negate
gives the additive inversex + negate x
=fromInteger 0
- Associativity of
(
*
) (x * y) * z
=x * (y * z)
is the multiplicative identityfromInteger
1x * fromInteger 1
=x
andfromInteger 1 * x
=x
- Distributivity of
(
with respect to*
)(
+
) a * (b + c)
=(a * b) + (a * c)
and(b + c) * a
=(b * a) + (c * a)
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