-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | An enhanced core prelude; a common foundation for alternate preludes.
--
-- The premise of basic-prelude is that there are a lot of very
-- commonly desired features missing from the standard Prelude,
-- such as commonly used operators (<$> and
-- >=>, for instance) and imports for common datatypes
-- (e.g., ByteString and Vector). At the same time,
-- there are lots of other components which are more debatable, such as
-- providing polymorphic versions of common functions.
--
-- So basic-prelude is intended to give a common foundation for
-- a number of alternate preludes. The package provides two modules:
-- CorePrelude provides the common ground for other preludes to
-- build on top of, while BasicPrelude exports
-- CorePrelude together with commonly used list functions to
-- provide a drop-in replacement for the standard Prelude.
--
-- Users wishing to have an improved Prelude can use
-- BasicPrelude. Developers wishing to create a new prelude
-- should use CorePrelude.
--
-- Release history:
--
--
-- - 0.3 Moved a number of exports from BasicPrelude to
-- CorePrelude and vice-versa.
-- - 0.2 Renamed BasicPrelude to CorePrelude
-- and added a new BasicPrelude module provided a full-featured
-- Prelude alternative. Also added a number of new exports.
-- - 0.1 Initial version, code taken from
-- classy-prelude with a few minor tweaks.
--
@package basic-prelude
@version 0.3.10
module CorePrelude
($) :: (a -> b) -> a -> b
($!) :: (a -> b) -> a -> b
(&&) :: Bool -> Bool -> Bool
(||) :: Bool -> Bool -> Bool
(.) :: Category cat => forall b c a. cat b c -> cat a b -> cat a c
not :: Bool -> Bool
otherwise :: Bool
fst :: (a, b) -> a
snd :: (a, b) -> b
id :: Category cat => forall a. cat a a
maybe :: b -> (a -> b) -> Maybe a -> b
either :: (a -> c) -> (b -> c) -> Either a b -> c
flip :: (a -> b -> c) -> b -> a -> c
const :: a -> b -> a
error :: [Char] -> a
putStr :: MonadIO m => Text -> m ()
putStrLn :: MonadIO m => Text -> m ()
getArgs :: MonadIO m => m [Text]
odd :: Integral a => a -> Bool
even :: Integral a => a -> Bool
uncurry :: (a -> b -> c) -> (a, b) -> c
curry :: ((a, b) -> c) -> a -> b -> c
swap :: (a, b) -> (b, a)
until :: (a -> Bool) -> (a -> a) -> a -> a
asTypeOf :: a -> a -> a
undefined :: a
seq :: a -> b -> b
class Eq a => Ord a
compare :: Ord a => a -> a -> Ordering
(<) :: Ord a => a -> a -> Bool
(>=) :: Ord a => a -> a -> Bool
(>) :: Ord a => a -> a -> Bool
(<=) :: Ord a => a -> a -> Bool
max :: Ord a => a -> a -> a
min :: Ord a => a -> a -> a
class Eq a
(==) :: Eq a => a -> a -> Bool
(/=) :: Eq a => a -> a -> Bool
class Bounded a
minBound :: Bounded a => a
maxBound :: Bounded a => a
class Enum a
succ :: Enum a => a -> a
pred :: Enum a => a -> a
toEnum :: Enum a => Int -> a
fromEnum :: Enum a => a -> Int
enumFrom :: Enum a => a -> [a]
enumFromThen :: Enum a => a -> a -> [a]
enumFromTo :: Enum a => a -> a -> [a]
enumFromThenTo :: Enum a => a -> a -> a -> [a]
class Show a
class Read a
class Functor (f :: * -> *)
fmap :: Functor f => (a -> b) -> f a -> f b
(<$) :: Functor f => a -> f b -> f a
class Monad (m :: * -> *)
(>>=) :: Monad m => m a -> (a -> m b) -> m b
(>>) :: Monad m => m a -> m b -> m b
return :: Monad m => a -> m a
fail :: Monad m => String -> m a
(=<<) :: Monad m => (a -> m b) -> m a -> m b
class IsString a
fromString :: IsString a => String -> a
class Num a
(+) :: Num a => a -> a -> a
(*) :: Num a => a -> a -> a
(-) :: Num a => a -> a -> a
negate :: Num a => a -> a
abs :: Num a => a -> a
signum :: Num a => a -> a
fromInteger :: Num a => Integer -> a
class (Num a, Ord a) => Real a
toRational :: Real a => a -> Rational
class (Real a, Enum a) => Integral a
quot :: Integral a => a -> a -> a
rem :: Integral a => a -> a -> a
div :: Integral a => a -> a -> a
mod :: Integral a => a -> a -> a
quotRem :: Integral a => a -> a -> (a, a)
divMod :: Integral a => a -> a -> (a, a)
toInteger :: Integral a => a -> Integer
class Num a => Fractional a
(/) :: Fractional a => a -> a -> a
recip :: Fractional a => a -> a
fromRational :: Fractional a => Rational -> a
class Fractional a => Floating a
pi :: Floating a => a
exp :: Floating a => a -> a
sqrt :: Floating a => a -> a
log :: Floating a => a -> a
(**) :: Floating a => a -> a -> a
logBase :: Floating a => a -> a -> a
sin :: Floating a => a -> a
tan :: Floating a => a -> a
cos :: Floating a => a -> a
asin :: Floating a => a -> a
atan :: Floating a => a -> a
acos :: Floating a => a -> a
sinh :: Floating a => a -> a
tanh :: Floating a => a -> a
cosh :: Floating a => a -> a
asinh :: Floating a => a -> a
atanh :: Floating a => a -> a
acosh :: Floating a => a -> a
class (Real a, Fractional a) => RealFrac a
properFraction :: (RealFrac a, Integral b) => a -> (b, a)
truncate :: (RealFrac a, Integral b) => a -> b
round :: (RealFrac a, Integral b) => a -> b
ceiling :: (RealFrac a, Integral b) => a -> b
floor :: (RealFrac a, Integral b) => a -> b
class (RealFrac a, Floating a) => RealFloat a
floatRadix :: RealFloat a => a -> Integer
floatDigits :: RealFloat a => a -> Int
floatRange :: RealFloat a => a -> (Int, Int)
decodeFloat :: RealFloat a => a -> (Integer, Int)
encodeFloat :: RealFloat a => Integer -> Int -> a
exponent :: RealFloat a => a -> Int
significand :: RealFloat a => a -> a
scaleFloat :: RealFloat a => Int -> a -> a
isNaN :: RealFloat a => a -> Bool
isInfinite :: RealFloat a => a -> Bool
isDenormalized :: RealFloat a => a -> Bool
isNegativeZero :: RealFloat a => a -> Bool
isIEEE :: RealFloat a => a -> Bool
atan2 :: RealFloat a => a -> a -> a
data Maybe a :: * -> *
Nothing :: Maybe a
Just :: a -> Maybe a
data Ordering :: *
LT :: Ordering
EQ :: Ordering
GT :: Ordering
data Bool :: *
False :: Bool
True :: Bool
data Char :: *
data IO a :: * -> *
data Either a b :: * -> * -> *
Left :: a -> Either a b
Right :: b -> Either a b
data ByteString :: *
type LByteString = ByteString
-- | A space efficient, packed, unboxed Unicode text type.
data Text :: *
type LText = Text
data Map k a :: * -> * -> *
-- | A map from keys to values. A map cannot contain duplicate keys; each
-- key can map to at most one value.
data HashMap k v :: * -> * -> *
data IntMap a :: * -> *
data Set a :: * -> *
-- | A set of values. A set cannot contain duplicate values.
data HashSet a :: * -> *
data IntSet :: *
data Seq a :: * -> *
-- | Boxed vectors, supporting efficient slicing.
data Vector a :: * -> *
type UVector = Vector
class (Vector Vector a, MVector MVector a) => Unbox a
type SVector = Vector
class Storable a
-- | The class of types that can be converted to a hash value.
--
-- Minimal implementation: hashWithSalt.
class Hashable a
hashWithSalt :: Hashable a => Int -> a -> Int
hash :: Hashable a => a -> Int
data Word :: *
data Word8 :: *
data Word32 :: *
data Word64 :: *
data Int :: *
data Int32 :: *
data Int64 :: *
data Integer :: *
type Rational = Ratio Integer
data Float :: *
data Double :: *
(^) :: (Num a, Integral b) => a -> b -> a
(^^) :: (Fractional a, Integral b) => a -> b -> a
subtract :: Num a => a -> a -> a
fromIntegral :: (Integral a, Num b) => a -> b
realToFrac :: (Real a, Fractional b) => a -> b
class Monoid a
mempty :: Monoid a => a
mappend :: Monoid a => a -> a -> a
mconcat :: Monoid a => [a] -> a
(<>) :: Monoid m => m -> m -> m
first :: Arrow a => forall b c d. a b c -> a (b, d) (c, d)
second :: Arrow a => forall b c d. a b c -> a (d, b) (d, c)
(***) :: Arrow a => forall b c b' c'. a b c -> a b' c' -> a (b, b') (c, c')
(&&&) :: Arrow a => forall b c c'. a b c -> a b c' -> a b (c, c')
mapMaybe :: (a -> Maybe b) -> [a] -> [b]
catMaybes :: [Maybe a] -> [a]
fromMaybe :: a -> Maybe a -> a
isJust :: Maybe a -> Bool
isNothing :: Maybe a -> Bool
listToMaybe :: [a] -> Maybe a
maybeToList :: Maybe a -> [a]
partitionEithers :: [Either a b] -> ([a], [b])
lefts :: [Either a b] -> [a]
rights :: [Either a b] -> [b]
on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
comparing :: Ord a => (b -> a) -> b -> b -> Ordering
equating :: Eq a => (b -> a) -> b -> b -> Bool
newtype Down a :: * -> *
Down :: a -> Down a
class Functor f => Applicative (f :: * -> *)
pure :: Applicative f => a -> f a
(<*>) :: Applicative f => f (a -> b) -> f a -> f b
(*>) :: Applicative f => f a -> f b -> f b
(<*) :: Applicative f => f a -> f b -> f a
(<$>) :: Functor f => (a -> b) -> f a -> f b
(<|>) :: Alternative f => forall a. f a -> f a -> f a
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
-- | Lift a computation from the argument monad to the constructed monad.
lift :: MonadTrans t => forall (m :: * -> *) a. Monad m => m a -> t m a
-- | Monads in which IO computations may be embedded. Any monad
-- built by applying a sequence of monad transformers to the IO
-- monad will be an instance of this class.
--
-- Instances should satisfy the following laws, which state that
-- liftIO is a transformer of monads:
--
--
class Monad m => MonadIO (m :: * -> *)
liftIO :: MonadIO m => IO a -> m a
-- | Lift a computation from the IO monad.
liftIO :: MonadIO m => forall a. IO a -> m a
class (Typeable e, Show e) => Exception e
toException :: Exception e => e -> SomeException
fromException :: Exception e => SomeException -> Maybe e
class Typeable a
typeOf :: Typeable a => a -> TypeRep
data SomeException :: *
data IOException :: *
-- | Generalized version of throwIO.
throwIO :: (MonadBase IO m, Exception e) => e -> m a
-- | Generalized version of try.
--
-- Note, when the given computation throws an exception any monadic side
-- effects in m will be discarded.
try :: (MonadBaseControl IO m, Exception e) => m a -> m (Either e a)
-- | Generalized version of tryJust.
--
-- Note, when the given computation throws an exception any monadic side
-- effects in m will be discarded.
tryJust :: (MonadBaseControl IO m, Exception e) => (e -> Maybe b) -> m a -> m (Either b a)
-- | Generalized version of catch.
--
-- Note, when the given computation throws an exception any monadic side
-- effects in m will be discarded.
catch :: (MonadBaseControl IO m, Exception e) => m a -> (e -> m a) -> m a
-- | Generalized version of catchJust.
--
-- Note, when the given computation throws an exception any monadic side
-- effects in m will be discarded.
catchJust :: (MonadBaseControl IO m, Exception e) => (e -> Maybe b) -> m a -> (b -> m a) -> m a
-- | Generalized version of handle.
--
-- Note, when the given computation throws an exception any monadic side
-- effects in m will be discarded.
handle :: (MonadBaseControl IO m, Exception e) => (e -> m a) -> m a -> m a
-- | Generalized version of handleJust.
--
-- Note, when the given computation throws an exception any monadic side
-- effects in m will be discarded.
handleJust :: (MonadBaseControl IO m, Exception e) => (e -> Maybe b) -> (b -> m a) -> m a -> m a
-- | Generalized version of bracket.
--
-- Note:
--
--
-- - When the "acquire" or "release" computations throw exceptions any
-- monadic side effects in m will be discarded.
-- - When the "in-between" computation throws an exception any monadic
-- side effects in m produced by that computation will be
-- discarded but the side effects of the "acquire" or "release"
-- computations will be retained.
-- - Also, any monadic side effects in m of the "release"
-- computation will be discarded; it is run only for its side effects in
-- IO.
--
--
-- Note that when your acquire and release computations
-- are of type IO it will be more efficient to write:
--
--
-- liftBaseOp (bracket acquire release)
--
bracket :: MonadBaseControl IO m => m a -> (a -> m b) -> (a -> m c) -> m c
-- | Generalized version of bracket_.
--
-- Note any monadic side effects in m of both the
-- "acquire" and "release" computations will be discarded. To keep the
-- monadic side effects of the "acquire" computation, use bracket
-- with constant functions instead.
--
-- Note that when your acquire and release computations
-- are of type IO it will be more efficient to write:
--
--
-- liftBaseOp_ (bracket_ acquire release)
--
bracket_ :: MonadBaseControl IO m => m a -> m b -> m c -> m c
-- | Generalized version of bracketOnError.
--
-- Note:
--
--
-- - When the "acquire" or "release" computations throw exceptions any
-- monadic side effects in m will be discarded.
-- - When the "in-between" computation throws an exception any monadic
-- side effects in m produced by that computation will be
-- discarded but the side effects of the "acquire" computation will be
-- retained.
-- - Also, any monadic side effects in m of the "release"
-- computation will be discarded; it is run only for its side effects in
-- IO.
--
--
-- Note that when your acquire and release computations
-- are of type IO it will be more efficient to write:
--
--
-- liftBaseOp (bracketOnError acquire release)
--
bracketOnError :: MonadBaseControl IO m => m a -> (a -> m b) -> (a -> m c) -> m c
-- | Generalized version of onException.
--
-- Note, any monadic side effects in m of the "afterward"
-- computation will be discarded.
onException :: MonadBaseControl IO m => m a -> m b -> m a
-- | Generalized version of finally.
--
-- Note, any monadic side effects in m of the "afterward"
-- computation will be discarded.
finally :: MonadBaseControl IO m => m a -> m b -> m a
-- | Generalized version of mask.
mask :: MonadBaseControl IO m => ((forall a. m a -> m a) -> m b) -> m b
-- | Generalized version of mask_.
mask_ :: MonadBaseControl IO m => m a -> m a
-- | Generalized version of uninterruptibleMask.
uninterruptibleMask :: MonadBaseControl IO m => ((forall a. m a -> m a) -> m b) -> m b
-- | Generalized version of uninterruptibleMask_.
uninterruptibleMask_ :: MonadBaseControl IO m => m a -> m a
data FilePath :: *
-- | An alias for append.
(>) :: FilePath -> FilePath -> FilePath
-- | An alias for addExtension.
(<.>) :: FilePath -> Text -> FilePath
-- | Get whether a FilePath’s last extension is the predicate.
hasExtension :: FilePath -> Text -> Bool
-- | Retrieve a FilePath’s basename component.
--
--
-- basename "foo/bar.txt" == "bar"
--
basename :: FilePath -> FilePath
-- | Retrieve a FilePath’s filename component.
--
--
-- filename "foo/bar.txt" == "bar.txt"
--
filename :: FilePath -> FilePath
-- | Retrieves the FilePath’s directory. If the path is already a
-- directory, it is returned unchanged.
directory :: FilePath -> FilePath
type String = [Char]
-- | Like hashWithSalt, but no salt is used. The default
-- implementation uses hashWithSalt with some default salt.
-- Instances might want to implement this method to provide a more
-- efficient implementation than the default implementation.
hash :: Hashable a => a -> Int
-- | Return a hash value for the argument, using the given salt.
--
-- The general contract of hashWithSalt is:
--
--
-- - If two values are equal according to the == method, then
-- applying the hashWithSalt method on each of the two values
-- must produce the same integer result if the same salt is used
-- in each case.
-- - It is not required that if two values are unequal according
-- to the == method, then applying the hashWithSalt method
-- on each of the two values must produce distinct integer results.
-- However, the programmer should be aware that producing distinct
-- integer results for unequal values may improve the performance of
-- hashing-based data structures.
-- - This method can be used to compute different hash values for the
-- same input by providing a different salt in each application of the
-- method. This implies that any instance that defines
-- hashWithSalt must make use of the salt in its
-- implementation.
--
hashWithSalt :: Hashable a => Int -> a -> Int
print :: Show a => a -> IO ()
readArgs :: (MonadIO m, ArgumentTuple a) => m a
-- | BasicPrelude mostly re-exports several key libraries in their
-- entirety. The exception is Data.List, where various functions are
-- replaced by similar versions that are either generalized, operate on
-- Text, or are implemented strictly.
module BasicPrelude
-- |
-- map = fmap
--
map :: Functor f => (a -> b) -> f a -> f b
-- |
-- empty = mempty
--
empty :: Monoid w => w
-- |
-- (++) = mappend
--
(++) :: Monoid w => w -> w -> w
-- |
-- concat = mconcat
--
concat :: Monoid w => [w] -> w
-- |
-- intercalate = mconcat .: intersperse
--
intercalate :: Monoid w => w -> [w] -> w
-- | Compute the sum of a finite list of numbers.
sum :: Num a => [a] -> a
-- | Compute the product of a finite list of numbers.
product :: Num a => [a] -> a
-- | Convert a value to readable Text
show :: Show a => a -> Text
-- | Parse Text to a value
read :: Read a => Text -> a
-- | The readIO function is similar to read except that it signals parse
-- failure to the IO monad instead of terminating the program.
readIO :: Read a => Text -> IO a
-- | Read a file and return the contents of the file as Text. The entire
-- file is read strictly.
readFile :: FilePath -> IO Text
-- | Write Text to a file. The file is truncated to zero length before
-- writing begins.
writeFile :: FilePath -> Text -> IO ()
-- | Write Text to the end of a file.
appendFile :: FilePath -> Text -> IO ()
-- | O(n) Breaks a Text up into a list of Texts at
-- newline Chars. The resulting strings do not contain newlines.
lines :: Text -> [Text]
-- | O(n) Breaks a Text up into a list of words, delimited by
-- Chars representing white space.
words :: Text -> [Text]
-- | O(n) Joins lines, after appending a terminating newline to
-- each.
unlines :: [Text] -> Text
-- | O(n) Joins words using single space characters.
unwords :: [Text] -> Text
textToString :: Text -> String
ltextToString :: LText -> String
-- | Encode text using UTF-8 encoding.
encodeUtf8 :: Text -> ByteString
-- | Note that this is not the standard
-- Data.Text.Encoding.decodeUtf8. That function will throw
-- impure exceptions on any decoding errors. This function instead uses
-- decodeLenient.
decodeUtf8 :: ByteString -> Text
-- | Read a single line of user input from stdin.
getLine :: IO Text
-- | Lazily read all user input on stdin as a single string.
getContents :: IO Text
-- | The interact function takes a function of type Text ->
-- Text as its argument. The entire input from the standard input
-- device is passed (lazily) to this function as its argument, and the
-- resulting string is output on the standard output device.
interact :: (Text -> Text) -> IO ()
gcd :: Integral a => a -> a -> a
lcm :: Integral a => a -> a -> a
type ShowS = String -> String
showsPrec :: Show a => Int -> a -> ShowS
showList :: Show a => [a] -> ShowS
shows :: Show a => a -> ShowS
showChar :: Char -> ShowS
showString :: String -> ShowS
showParen :: Bool -> ShowS -> ShowS
type ReadS a = String -> [(a, String)]
readsPrec :: Read a => Int -> ReadS a
readList :: Read a => ReadS [a]
reads :: Read a => ReadS a
readParen :: Bool -> ReadS a -> ReadS a
lex :: ReadS String
readMay :: Read a => Text -> Maybe a
putChar :: Char -> IO ()
getChar :: IO Char
readLn :: Read a => IO a