Safe Haskell | None |
---|---|
Language | Haskell98 |
Imm.Prelude
Synopsis
- type Text = Text
- type LText = Text
- type ByteString = ByteString
- type LByteString = ByteString
- io :: MonadIO m => IO a -> m a
- show :: (Show a, IsString b) => a -> b
- (++) :: [a] -> [a] -> [a]
- seq :: a -> b -> b
- zip :: [a] -> [b] -> [(a, b)]
- print :: Show a => a -> IO ()
- fst :: (a, b) -> a
- snd :: (a, b) -> b
- otherwise :: Bool
- assert :: Bool -> a -> a
- map :: (a -> b) -> [a] -> [b]
- ($) :: (a -> b) -> a -> 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 Eq a where
- class Fractional a => Floating a where
- class Num a => Fractional a where
- (/) :: a -> a -> a
- recip :: a -> a
- fromRational :: Rational -> a
- class (Real a, Enum a) => Integral a where
- class Applicative m => Monad (m :: Type -> Type) where
- class Functor (f :: Type -> Type) where
- class Num a where
- class Eq a => Ord a where
- class Read 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 where
- class Typeable (a :: k)
- class IsString a where
- fromString :: String -> a
- class Functor f => Applicative (f :: Type -> Type) where
- class Foldable (t :: Type -> Type) where
- class (Functor t, Foldable t) => Traversable (t :: Type -> Type) where
- traverse :: Applicative f => (a -> f b) -> t a -> f (t b)
- sequenceA :: Applicative f => t (f a) -> f (t a)
- mapM :: Monad m => (a -> m b) -> t a -> m (t b)
- sequence :: Monad m => t (m a) -> m (t a)
- class Semigroup a where
- (<>) :: a -> a -> a
- class Semigroup a => Monoid a where
- data Bool
- data Char
- data Double
- data Float
- data Int
- data Integer
- data Maybe a
- data Ordering
- type Rational = Ratio Integer
- data IO a
- data Word
- data Either a b
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- type String = [Char]
- type ShowS = String -> String
- read :: Read a => String -> a
- class Applicative f => Alternative (f :: Type -> Type) where
- class (Alternative m, Monad m) => MonadPlus (m :: Type -> Type) where
- class Bifunctor (p :: Type -> Type -> Type) where
- class Monad m => MonadIO (m :: Type -> Type) where
- unless :: Applicative f => Bool -> f () -> f ()
- forM :: (Traversable t, Monad m) => t a -> (a -> m b) -> m (t b)
- for :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)
- optional :: Alternative f => f a -> f (Maybe a)
- newtype WrappedMonad (m :: Type -> Type) a = WrapMonad {
- unwrapMonad :: m a
- newtype WrappedArrow (a :: Type -> Type -> Type) b c = WrapArrow {
- unwrapArrow :: a b c
- newtype ZipList a = ZipList {
- getZipList :: [a]
- readIO :: Read a => String -> IO a
- readLn :: Read a => IO a
- appendFile :: FilePath -> String -> IO ()
- interact :: (String -> String) -> IO ()
- getContents :: IO String
- getChar :: IO Char
- putChar :: Char -> IO ()
- stderr :: Handle
- ioError :: IOError -> IO a
- data SomeAsyncException where
- SomeAsyncException :: forall e. Exception e => e -> SomeAsyncException
- stdout :: Handle
- type FilePath = String
- userError :: String -> IOError
- data IOException
- type IOError = IOException
- class (Typeable e, Show e) => Exception e where
- toException :: e -> SomeException
- fromException :: SomeException -> Maybe e
- displayException :: e -> String
- newtype Const a (b :: k) :: forall k. Type -> k -> Type = Const {
- getConst :: a
- forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m ()
- mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
- reads :: Read a => ReadS a
- 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
- comparing :: Ord a => (b -> a) -> b -> b -> Ordering
- newtype Down a = Down a
- data IOMode
- lex :: ReadS String
- readParen :: Bool -> ReadS a -> ReadS a
- type ReadS a = String -> [(a, String)]
- void :: Functor f => f a -> f ()
- lcm :: Integral a => a -> a -> a
- gcd :: Integral a => a -> a -> a
- (^^) :: (Fractional a, Integral b) => a -> b -> a
- (^) :: (Num a, Integral b) => a -> b -> a
- odd :: Integral a => a -> Bool
- even :: Integral a => a -> Bool
- showParen :: Bool -> ShowS -> ShowS
- showString :: String -> ShowS
- showChar :: Char -> ShowS
- shows :: Show a => a -> ShowS
- unzip3 :: [(a, b, c)] -> ([a], [b], [c])
- unzip :: [(a, b)] -> ([a], [b])
- zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
- zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
- zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]
- (!!) :: [a] -> Int -> a
- cycle :: [a] -> [a]
- repeat :: a -> [a]
- iterate :: (a -> a) -> a -> [a]
- scanr1 :: (a -> a -> a) -> [a] -> [a]
- scanr :: (a -> b -> b) -> b -> [a] -> [b]
- scanl1 :: (a -> a -> a) -> [a] -> [a]
- scanl :: (b -> a -> b) -> b -> [a] -> [b]
- init :: [a] -> [a]
- last :: [a] -> a
- tail :: [a] -> [a]
- head :: [a] -> a
- mapMaybe :: (a -> Maybe b) -> [a] -> [b]
- listToMaybe :: [a] -> Maybe a
- maybeToList :: Maybe a -> [a]
- fromMaybe :: a -> Maybe a -> a
- fromJust :: Maybe a -> a
- isNothing :: Maybe a -> Bool
- isJust :: Maybe a -> Bool
- maybe :: b -> (a -> b) -> Maybe a -> b
- uncurry :: (a -> b -> c) -> (a, b) -> c
- curry :: ((a, b) -> c) -> a -> b -> c
- subtract :: Num a => a -> a -> a
- asTypeOf :: a -> a -> a
- until :: (a -> Bool) -> (a -> a) -> a -> a
- ($!) :: (a -> b) -> a -> b
- flip :: (a -> b -> c) -> b -> a -> c
- (.) :: (b -> c) -> (a -> b) -> a -> c
- const :: a -> b -> a
- id :: a -> a
- when :: Applicative f => Bool -> f () -> f ()
- (=<<) :: Monad m => (a -> m b) -> m a -> m b
- 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
- undefined :: HasCallStack => a
- errorWithoutStackTrace :: [Char] -> a
- error :: HasCallStack => [Char] -> a
- data SomeException where
- SomeException :: forall e. Exception e => e -> SomeException
- (&&) :: Bool -> Bool -> Bool
- (||) :: Bool -> Bool -> Bool
- not :: Bool -> Bool
- lift :: (MonadTrans t, Monad m) => m a -> t m a
- class Monad m => MonadThrow (m :: Type -> Type)
- handleIOError :: MonadCatch m => (IOError -> m a) -> m a -> m a
- catchIOError :: MonadCatch m => m a -> (IOError -> m a) -> m a
- uninterruptibleMask_ :: MonadMask m => m a -> m a
- mask_ :: MonadMask m => m a -> m a
- class MonadThrow m => MonadCatch (m :: Type -> Type)
- class MonadCatch m => MonadMask (m :: Type -> Type) where
- mask :: ((forall a. m a -> m a) -> m b) -> m b
- uninterruptibleMask :: ((forall a. m a -> m a) -> m b) -> m b
- generalBracket :: m a -> (a -> ExitCase b -> m c) -> (a -> m b) -> m (b, c)
- data Handler (m :: Type -> Type) a where
- class (Applicative b, Applicative m, Monad b, Monad m) => MonadBase (b :: Type -> Type) (m :: Type -> Type) | m -> b where
- liftBase :: b α -> m α
- repack :: (MonoFoldable a, IsSequence b, Element a ~ Element b) => a -> b
- unpack :: MonoFoldable mono => mono -> [Element mono]
- pack :: IsSequence seq => [Element seq] -> seq
- sortOn :: (Ord o, SemiSequence seq) => (Element seq -> o) -> seq -> seq
- catMaybes :: (IsSequence (f (Maybe t)), Functor f, Element (f (Maybe t)) ~ Maybe t) => f (Maybe t) -> f t
- sort :: (SemiSequence seq, Ord (Element seq)) => seq -> seq
- replaceSeqLazyText :: Text -> Text -> Text -> Text
- splitSeqLazyText :: Text -> Text -> [Text]
- replaceSeqStrictText :: Text -> Text -> Text -> Text
- splitSeqStrictText :: Text -> Text -> [Text]
- stripSuffixLazyBS :: ByteString -> ByteString -> Maybe ByteString
- stripPrefixLazyBS :: ByteString -> ByteString -> Maybe ByteString
- splitSeqLazyBS :: Word8 -> ByteString -> [ByteString]
- stripSuffixStrictBS :: ByteString -> ByteString -> Maybe ByteString
- stripPrefixStrictBS :: ByteString -> ByteString -> Maybe ByteString
- splitElemStrictBS :: Word8 -> ByteString -> [ByteString]
- deleteBy :: (IsSequence seq, Eq (Element seq)) => (Element seq -> Element seq -> Bool) -> Element seq -> seq -> seq
- delete :: (IsSequence seq, Eq (Element seq)) => Element seq -> seq -> seq
- groupAll :: (IsSequence seq, Eq (Element seq)) => seq -> [seq]
- group :: (IsSequence seq, Eq (Element seq)) => seq -> [seq]
- isInfixOf :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> Bool
- isSuffixOf :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> Bool
- isPrefixOf :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> Bool
- ensureSuffix :: (Eq (Element seq), IsSequence seq) => seq -> seq -> seq
- ensurePrefix :: (Eq (Element seq), IsSequence seq) => seq -> seq -> seq
- dropSuffix :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> seq
- dropPrefix :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> seq
- stripSuffix :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> Maybe seq
- stripPrefix :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> Maybe seq
- replaceSeq :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> seq -> seq
- splitSeq :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> [seq]
- splitElem :: (IsSequence seq, Eq (Element seq)) => Element seq -> seq -> [seq]
- initDef :: IsSequence seq => seq -> seq
- tailDef :: IsSequence seq => seq -> seq
- defaultSnoc :: IsSequence seq => seq -> Element seq -> seq
- defaultCons :: IsSequence seq => Element seq -> seq -> seq
- vectorSort :: (Vector v e, Ord e) => v e -> v e
- vectorSortBy :: Vector v e => (e -> e -> Ordering) -> v e -> v e
- defaultSplitWhen :: IsSequence seq => (Element seq -> Bool) -> seq -> [seq]
- defaultSortBy :: IsSequence seq => (Element seq -> Element seq -> Ordering) -> seq -> seq
- defaultReverse :: IsSequence seq => seq -> seq
- defaultIntersperse :: IsSequence seq => Element seq -> seq -> seq
- defaultFind :: MonoFoldable seq => (Element seq -> Bool) -> seq -> Maybe (Element seq)
- singleton :: MonoPointed seq => Element seq -> seq
- class (Integral (Index seq), GrowingAppend seq) => SemiSequence seq where
- class (Monoid seq, MonoTraversable seq, SemiSequence seq, MonoPointed seq) => IsSequence seq where
- fromList :: [Element seq] -> seq
- lengthIndex :: seq -> Index seq
- break :: (Element seq -> Bool) -> seq -> (seq, seq)
- span :: (Element seq -> Bool) -> seq -> (seq, seq)
- dropWhile :: (Element seq -> Bool) -> seq -> seq
- takeWhile :: (Element seq -> Bool) -> seq -> seq
- splitAt :: Index seq -> seq -> (seq, seq)
- unsafeSplitAt :: Index seq -> seq -> (seq, seq)
- take :: Index seq -> seq -> seq
- unsafeTake :: Index seq -> seq -> seq
- drop :: Index seq -> seq -> seq
- unsafeDrop :: Index seq -> seq -> seq
- dropEnd :: Index seq -> seq -> seq
- partition :: (Element seq -> Bool) -> seq -> (seq, seq)
- uncons :: seq -> Maybe (Element seq, seq)
- unsnoc :: seq -> Maybe (seq, Element seq)
- filter :: (Element seq -> Bool) -> seq -> seq
- filterM :: Monad m => (Element seq -> m Bool) -> seq -> m seq
- replicate :: Index seq -> Element seq -> seq
- replicateM :: Monad m => Index seq -> m (Element seq) -> m seq
- groupBy :: (Element seq -> Element seq -> Bool) -> seq -> [seq]
- groupAllOn :: Eq b => (Element seq -> b) -> seq -> [seq]
- subsequences :: seq -> [seq]
- permutations :: seq -> [seq]
- tailEx :: seq -> seq
- tailMay :: seq -> Maybe seq
- initEx :: seq -> seq
- initMay :: seq -> Maybe seq
- unsafeTail :: seq -> seq
- unsafeInit :: seq -> seq
- index :: seq -> Index seq -> Maybe (Element seq)
- indexEx :: seq -> Index seq -> Element seq
- unsafeIndex :: seq -> Index seq -> Element seq
- splitWhen :: (Element seq -> Bool) -> seq -> [seq]
- class (IsSequence t, IsString t, Element t ~ Char) => Textual t where
- words :: t -> [t]
- unwords :: (Element seq ~ t, MonoFoldable seq) => seq -> t
- lines :: t -> [t]
- unlines :: (Element seq ~ t, MonoFoldable seq) => seq -> t
- toLower :: t -> t
- toUpper :: t -> t
- toCaseFold :: t -> t
- breakWord :: t -> (t, t)
- breakLine :: t -> (t, t)
- class (IsSequence lazy, IsSequence strict) => LazySequence lazy strict | lazy -> strict, strict -> lazy where
- toChunks :: lazy -> [strict]
- fromChunks :: [strict] -> lazy
- toStrict :: lazy -> strict
- fromStrict :: strict -> lazy
- class (Textual textual, IsSequence binary) => Utf8 textual binary | textual -> binary, binary -> textual where
- encodeUtf8 :: textual -> binary
- decodeUtf8 :: binary -> textual
- sequence_ :: (Applicative m, MonoFoldable mono, Element mono ~ m ()) => mono -> m ()
- foldM :: (MonoFoldable mono, Monad m) => (a -> Element mono -> m a) -> a -> mono -> m a
- concat :: (MonoFoldable mono, Monoid (Element mono)) => mono -> Element mono
- fold :: (MonoFoldable mono, Monoid (Element mono)) => mono -> Element mono
- intercalate :: (MonoFoldable mono, Monoid (Element mono)) => Element mono -> mono -> Element mono
- point :: MonoPointed mono => Element mono -> mono
- notElem :: (MonoFoldable mono, Eq (Element mono)) => Element mono -> mono -> Bool
- elem :: (MonoFoldable mono, Eq (Element mono)) => Element mono -> mono -> Bool
- concatMap :: (MonoFoldable mono, Monoid m) => (Element mono -> m) -> mono -> m
- or :: (MonoFoldable mono, Element mono ~ Bool) => mono -> Bool
- and :: (MonoFoldable mono, Element mono ~ Bool) => mono -> Bool
- product :: (MonoFoldable mono, Num (Element mono)) => mono -> Element mono
- sum :: (MonoFoldable mono, Num (Element mono)) => mono -> Element mono
- foldl1Ex' :: MonoFoldable mono => (Element mono -> Element mono -> Element mono) -> mono -> Element mono
- foldr1Ex :: MonoFoldable mono => (Element mono -> Element mono -> Element mono) -> mono -> Element mono
- foldMap1Ex :: (MonoFoldable mono, Semigroup m) => (Element mono -> m) -> mono -> m
- foldlM :: (MonoFoldable mono, Monad m) => (a -> Element mono -> m a) -> a -> mono -> m a
- for_ :: (MonoFoldable mono, Applicative f) => mono -> (Element mono -> f b) -> f ()
- traverse_ :: (MonoFoldable mono, Applicative f) => (Element mono -> f b) -> mono -> f ()
- compareLength :: (MonoFoldable mono, Integral i) => mono -> i -> Ordering
- length64 :: MonoFoldable mono => mono -> Int64
- length :: MonoFoldable mono => mono -> Int
- null :: MonoFoldable mono => mono -> Bool
- any :: MonoFoldable mono => (Element mono -> Bool) -> mono -> Bool
- all :: MonoFoldable mono => (Element mono -> Bool) -> mono -> Bool
- toList :: MonoFoldable mono => mono -> [Element mono]
- foldl' :: MonoFoldable mono => (a -> Element mono -> a) -> a -> mono -> a
- foldr :: MonoFoldable mono => (Element mono -> b -> b) -> b -> mono -> b
- foldMap :: (MonoFoldable mono, Monoid m) => (Element mono -> m) -> mono -> m
- class (Monoid set, Semigroup set, MonoFoldable set, Eq (ContainerKey set), GrowingAppend set) => SetContainer set where
- type ContainerKey set :: Type
- member :: ContainerKey set -> set -> Bool
- notMember :: ContainerKey set -> set -> Bool
- union :: set -> set -> set
- unions :: (MonoFoldable mono, Element mono ~ set) => mono -> set
- difference :: set -> set -> set
- intersection :: set -> set -> set
- keys :: set -> [ContainerKey set]
- class PolyMap (map :: Type -> Type) where
- differenceMap :: map value1 -> map value2 -> map value1
- intersectionMap :: map value1 -> map value2 -> map value1
- intersectionWithMap :: (value1 -> value2 -> value3) -> map value1 -> map value2 -> map value3
- class BiPolyMap (map :: Type -> Type -> Type) where
- type BPMKeyConstraint (map :: Type -> Type -> Type) key :: Constraint
- mapKeysWith :: (BPMKeyConstraint map k1, BPMKeyConstraint map k2) => (v -> v -> v) -> (k1 -> k2) -> map k1 v -> map k2 v
- class (MonoTraversable map, SetContainer map) => IsMap map where
- type MapValue map :: Type
- lookup :: ContainerKey map -> map -> Maybe (MapValue map)
- insertMap :: ContainerKey map -> MapValue map -> map -> map
- deleteMap :: ContainerKey map -> map -> map
- singletonMap :: ContainerKey map -> MapValue map -> map
- mapFromList :: [(ContainerKey map, MapValue map)] -> map
- mapToList :: map -> [(ContainerKey map, MapValue map)]
- findWithDefault :: MapValue map -> ContainerKey map -> map -> MapValue map
- insertWith :: (MapValue map -> MapValue map -> MapValue map) -> ContainerKey map -> MapValue map -> map -> map
- insertWithKey :: (ContainerKey map -> MapValue map -> MapValue map -> MapValue map) -> ContainerKey map -> MapValue map -> map -> map
- insertLookupWithKey :: (ContainerKey map -> MapValue map -> MapValue map -> MapValue map) -> ContainerKey map -> MapValue map -> map -> (Maybe (MapValue map), map)
- adjustMap :: (MapValue map -> MapValue map) -> ContainerKey map -> map -> map
- adjustWithKey :: (ContainerKey map -> MapValue map -> MapValue map) -> ContainerKey map -> map -> map
- updateMap :: (MapValue map -> Maybe (MapValue map)) -> ContainerKey map -> map -> map
- updateWithKey :: (ContainerKey map -> MapValue map -> Maybe (MapValue map)) -> ContainerKey map -> map -> map
- updateLookupWithKey :: (ContainerKey map -> MapValue map -> Maybe (MapValue map)) -> ContainerKey map -> map -> (Maybe (MapValue map), map)
- alterMap :: (Maybe (MapValue map) -> Maybe (MapValue map)) -> ContainerKey map -> map -> map
- unionWith :: (MapValue map -> MapValue map -> MapValue map) -> map -> map -> map
- unionWithKey :: (ContainerKey map -> MapValue map -> MapValue map -> MapValue map) -> map -> map -> map
- unionsWith :: (MapValue map -> MapValue map -> MapValue map) -> [map] -> map
- mapWithKey :: (ContainerKey map -> MapValue map -> MapValue map) -> map -> map
- omapKeysWith :: (MapValue map -> MapValue map -> MapValue map) -> (ContainerKey map -> ContainerKey map) -> map -> map
- filterMap :: (MapValue map -> Bool) -> map -> map
- class (SetContainer set, Element set ~ ContainerKey set) => IsSet set where
- insertSet :: Element set -> set -> set
- deleteSet :: Element set -> set -> set
- singletonSet :: Element set -> set
- setFromList :: [Element set] -> set
- setToList :: set -> [Element set]
- class MonoFunctor mono => MonoZip mono where
- class SetContainer set => HasKeysSet set where
- class (IsString t, LeftReductiveMonoid t, LeftGCDMonoid t, FactorialMonoid t) => TextualMonoid t where
- catchesAsync :: (MonadCatch m, MonadThrow m) => m a -> [Handler m a] -> m a
- catchesDeep :: (MonadCatch m, MonadThrow m, MonadIO m, NFData a) => m a -> [Handler m a] -> m a
- catches :: (MonadCatch m, MonadThrow m) => m a -> [Handler m a] -> m a
- isAsyncException :: Exception e => e -> Bool
- isSyncException :: Exception e => e -> Bool
- toAsyncException :: Exception e => e -> SomeException
- toSyncException :: Exception e => e -> SomeException
- bracketWithError :: MonadMask m => m a -> (Maybe SomeException -> a -> m b) -> (a -> m c) -> m c
- bracketOnError_ :: MonadMask m => m a -> m b -> m c -> m c
- bracketOnError :: MonadMask m => m a -> (a -> m b) -> (a -> m c) -> m c
- finally :: MonadMask m => m a -> m b -> m a
- bracket_ :: MonadMask m => m a -> m b -> m c -> m c
- bracket :: MonadMask m => m a -> (a -> m b) -> (a -> m c) -> m c
- withException :: (MonadMask m, Exception e) => m a -> (e -> m b) -> m a
- onException :: MonadMask m => m a -> m b -> m a
- tryJust :: (MonadCatch m, Exception e) => (e -> Maybe b) -> m a -> m (Either b a)
- tryAsync :: (MonadCatch m, Exception e) => m a -> m (Either e a)
- tryAnyDeep :: (MonadCatch m, MonadIO m, NFData a) => m a -> m (Either SomeException a)
- tryDeep :: (MonadCatch m, MonadIO m, Exception e, NFData a) => m a -> m (Either e a)
- tryAny :: MonadCatch m => m a -> m (Either SomeException a)
- tryIO :: MonadCatch m => m a -> m (Either IOException a)
- try :: (MonadCatch m, Exception e) => m a -> m (Either e a)
- handleJust :: (MonadCatch m, Exception e) => (e -> Maybe b) -> (b -> m a) -> m a -> m a
- handleAsync :: (MonadCatch m, Exception e) => (e -> m a) -> m a -> m a
- handleAnyDeep :: (MonadCatch m, MonadIO m, NFData a) => (SomeException -> m a) -> m a -> m a
- handleDeep :: (MonadCatch m, Exception e, MonadIO m, NFData a) => (e -> m a) -> m a -> m a
- handleAny :: MonadCatch m => (SomeException -> m a) -> m a -> m a
- handleIO :: MonadCatch m => (IOException -> m a) -> m a -> m a
- catchJust :: (MonadCatch m, Exception e) => (e -> Maybe b) -> m a -> (b -> m a) -> m a
- catchAsync :: (MonadCatch m, Exception e) => m a -> (e -> m a) -> m a
- catchAnyDeep :: (MonadCatch m, MonadIO m, NFData a) => m a -> (SomeException -> m a) -> m a
- catchDeep :: (MonadCatch m, MonadIO m, Exception e, NFData a) => m a -> (e -> m a) -> m a
- catchAny :: MonadCatch m => m a -> (SomeException -> m a) -> m a
- catchIO :: MonadCatch m => m a -> (IOException -> m a) -> m a
- catch :: (MonadCatch m, Exception e) => m a -> (e -> m a) -> m a
- impureThrow :: Exception e => e -> a
- throwTo :: (Exception e, MonadIO m) => ThreadId -> e -> m ()
- throwString :: (MonadThrow m, HasCallStack) => String -> m a
- throwM :: (MonadThrow m, Exception e) => e -> m a
- throwIO :: (MonadThrow m, Exception e) => e -> m a
- throw :: (MonadThrow m, Exception e) => e -> m a
- data StringException = StringException String CallStack
- data SyncExceptionWrapper where
- SyncExceptionWrapper :: forall e. Exception e => e -> SyncExceptionWrapper
- data AsyncExceptionWrapper where
- AsyncExceptionWrapper :: forall e. Exception e => e -> AsyncExceptionWrapper
- putStrLn :: Text -> IO ()
- putStr :: Text -> IO ()
- getLine :: IO Text
- liftBaseDefault :: (MonadTrans t, MonadBase b m) => b α -> t m α
Documentation
type ByteString = ByteString Source #
type LByteString = ByteString Source #
(++) :: [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.
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.
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]])
If the first argument evaluates to True
, then the result is the
second argument. Otherwise an AssertionFailed
exception is raised,
containing a String
with the source file and line number of the
call to assert
.
Assertions can normally be turned on or off with a compiler flag
(for GHC, assertions are normally on unless optimisation is turned on
with -O
or the -fignore-asserts
option is given). When assertions are turned off, the first
argument to assert
is ignored, and the second argument is
returned as the result.
map :: (a -> b) -> [a] -> [b] #
map
f xs
is the list obtained by applying f
to each element
of xs
, i.e.,
map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] map f [x1, x2, ...] == [f x1, f x2, ...]
($) :: (a -> b) -> a -> b infixr 0 #
Application operator. This operator is redundant, since ordinary
application (f x)
means the same as (f
. However, $
x)$
has
low, right-associative binding precedence, so it sometimes allows
parentheses to be omitted; for example:
f $ g $ h x = f (g (h x))
It is also useful in higher-order situations, such as
,
or map
($
0) xs
.zipWith
($
) fs xs
Note that ($)
is levity-polymorphic in its result type, so that
foo $ True where foo :: Bool -> Int#
is well-typed
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
Bounded Bool | Since: base-2.1 |
Bounded Char | Since: base-2.1 |
Bounded Int | Since: base-2.1 |
Bounded Int8 | Since: base-2.1 |
Bounded Int16 | Since: base-2.1 |
Bounded Int32 | Since: base-2.1 |
Bounded Int64 | Since: base-2.1 |
Bounded Ordering | Since: base-2.1 |
Bounded Word | Since: base-2.1 |
Bounded Word8 | Since: base-2.1 |
Bounded Word16 | Since: base-2.1 |
Bounded Word32 | Since: base-2.1 |
Bounded Word64 | Since: base-2.1 |
Bounded VecCount | Since: base-4.10.0.0 |
Bounded VecElem | Since: base-4.10.0.0 |
Bounded () | Since: base-2.1 |
Bounded All | Since: base-2.1 |
Bounded Any | Since: base-2.1 |
Bounded Associativity | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
Bounded SourceUnpackedness | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
Bounded SourceStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
Bounded DecidedStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
Bounded CChar | |
Bounded CSChar | |
Bounded CUChar | |
Bounded CShort | |
Bounded CUShort | |
Bounded CInt | |
Bounded CUInt | |
Bounded CLong | |
Bounded CULong | |
Bounded CLLong | |
Bounded CULLong | |
Bounded CBool | |
Bounded CPtrdiff | |
Bounded CSize | |
Bounded CWchar | |
Bounded CSigAtomic | |
Defined in Foreign.C.Types | |
Bounded CIntPtr | |
Bounded CUIntPtr | |
Bounded CIntMax | |
Bounded CUIntMax | |
Bounded UTF32_Invalid | |
Defined in Basement.String.Encoding.UTF32 | |
Bounded Encoding | |
Bounded FileType | |
Bounded XdgDirectory | |
Defined in System.Directory.Internal.Common | |
Bounded XdgDirectoryList | |
Defined in System.Directory.Internal.Common | |
Bounded StdMethod | |
Bounded Hour | |
Bounded Day | |
Bounded NanoSecs | |
Defined in Streamly.SVar | |
Bounded Format | |
Bounded Method | |
Bounded CompressionStrategy | |
Defined in Codec.Compression.Zlib.Stream | |
Bounded Count | |
Defined in Streamly.SVar | |
Bounded a => Bounded (Min a) | Since: base-4.9.0.0 |
Bounded a => Bounded (Max a) | Since: base-4.9.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 m => Bounded (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup | |
Bounded a => Bounded (Identity a) | Since: base-4.9.0.0 |
Bounded a => Bounded (Dual a) | Since: base-2.1 |
Bounded a => Bounded (Sum a) | Since: base-2.1 |
Bounded a => Bounded (Product a) | Since: base-2.1 |
(Bounded a, Bounded b) => Bounded (a, b) | Since: base-2.1 |
Bounded (Proxy t) | Since: base-4.7.0.0 |
(Bounded a, Bounded b, Bounded c) => Bounded (a, b, c) | 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 |
a ~ b => Bounded (a :~: b) | Since: base-4.7.0.0 |
Bounded b => Bounded (Tagged s b) | |
(Bounded a, Bounded b, Bounded c, Bounded d) => Bounded (a, b, c, d) | Since: base-2.1 |
a ~~ b => Bounded (a :~~: b) | Since: base-4.10.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 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
The Eq
class defines equality (==
) and inequality (/=
).
All the basic datatypes exported by the Prelude are instances of Eq
,
and Eq
may be derived for any datatype whose constituents are also
instances of Eq
.
The Haskell Report defines no laws for Eq
. However, ==
is customarily
expected to implement an equivalence relationship where two values comparing
equal are indistinguishable by "public" functions, with a "public" function
being one not allowing to see implementation details. For example, for a
type representing non-normalised natural numbers modulo 100, a "public"
function doesn't make the difference between 1 and 201. It is expected to
have the following properties: