-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | A compatibility layer for base
--   
--   Provides functions available in later versions of base to a
--   wider range of compilers, without requiring you to use CPP pragmas in
--   your code. See the README for what is covered. Also see the
--   changelog for recent changes.
--   
--   Note that base-compat does not add any orphan instances.
--   There is a separate package, base-orphans, for that.
--   
--   In addition, `base-compat` does not backport any data types or type
--   classes. See this section of the README for more info.
@package base-compat
@version 0.9.3

module Text.Read.Compat

-- | Parsing of Strings, producing values.
--   
--   Derived instances of Read make the following assumptions, which
--   derived instances of Show obey:
--   
--   
--   
- If the constructor is defined to be an infix operator, then the
--   derived Read instance will parse only infix applications of the
--   constructor (not the prefix form).
--   
- Associativity is not used to reduce the occurrence of parentheses,
--   although precedence may be.
--   
- If the constructor is defined using record syntax, the derived
--   Read will parse only the record-syntax form, and furthermore,
--   the fields must be given in the same order as the original
--   declaration.
--   
- The derived Read instance allows arbitrary Haskell
--   whitespace between tokens of the input string. Extra parentheses are
--   also allowed.
--   
--   
--   For example, given the declarations
--   
--   
--   infixr 5 :^:
--   data Tree a =  Leaf a  |  Tree a :^: Tree a
--   
--   
--   the derived instance of Read in Haskell 2010 is equivalent to
--   
--   
--   instance (Read a) => Read (Tree a) where
--   
--           readsPrec d r =  readParen (d > app_prec)
--                            (\r -> [(Leaf m,t) |
--                                    ("Leaf",s) <- lex r,
--                                    (m,t) <- readsPrec (app_prec+1) s]) r
--   
--                         ++ readParen (d > up_prec)
--                            (\r -> [(u:^:v,w) |
--                                    (u,s) <- readsPrec (up_prec+1) r,
--                                    (":^:",t) <- lex s,
--                                    (v,w) <- readsPrec (up_prec+1) t]) r
--   
--             where app_prec = 10
--                   up_prec = 5
--   
--   
--   Note that right-associativity of :^: is unused.
--   
--   The derived instance in GHC is equivalent to
--   
--   
--   instance (Read a) => Read (Tree a) where
--   
--           readPrec = parens $ (prec app_prec $ do
--                                    Ident "Leaf" <- lexP
--                                    m <- step readPrec
--                                    return (Leaf m))
--   
--                        +++ (prec up_prec $ do
--                                    u <- step readPrec
--                                    Symbol ":^:" <- lexP
--                                    v <- step readPrec
--                                    return (u :^: v))
--   
--             where app_prec = 10
--                   up_prec = 5
--   
--           readListPrec = readListPrecDefault
--   
class Read a

-- | attempts to parse a value from the front of the string, returning a
--   list of (parsed value, remaining string) pairs. If there is no
--   successful parse, the returned list is empty.
--   
--   Derived instances of Read and Show satisfy the
--   following:
--   
--   
--   
- (x,"") is an element of (readsPrec d
--   (showsPrec d x "")).
--   
--   
--   That is, readsPrec parses the string produced by
--   showsPrec, and delivers the value that showsPrec started
--   with.
readsPrec :: Read a => Int -> ReadS a

-- | The method readList is provided to allow the programmer to give
--   a specialised way of parsing lists of values. For example, this is
--   used by the predefined Read instance of the Char type,
--   where values of type String should be are expected to use
--   double quotes, rather than square brackets.
readList :: Read a => ReadS [a]

-- | Proposed replacement for readsPrec using new-style parsers (GHC
--   only).
readPrec :: Read a => ReadPrec a

-- | Proposed replacement for readList using new-style parsers (GHC
--   only). The default definition uses readList. Instances that
--   define readPrec should also define readListPrec as
--   readListPrecDefault.
readListPrec :: Read a => ReadPrec [a]

-- | A parser for a type a, represented as a function that takes a
--   String and returns a list of possible parses as
--   (a,String) pairs.
--   
--   Note that this kind of backtracking parser is very inefficient;
--   reading a large structure may be quite slow (cf ReadP).
type ReadS a = String -> [(a, String)]

-- | equivalent to readsPrec with a precedence of 0.
reads :: Read a => ReadS a

-- | The read function reads input from a string, which must be
--   completely consumed by the input process.
read :: Read a => String -> a

-- | readParen True p parses what p parses,
--   but surrounded with parentheses.
--   
--   readParen False p parses what p
--   parses, but optionally surrounded with parentheses.
readParen :: Bool -> ReadS a -> ReadS a

-- | The lex function reads a single lexeme from the input,
--   discarding initial white space, and returning the characters that
--   constitute the lexeme. If the input string contains only white space,
--   lex returns a single successful `lexeme' consisting of the
--   empty string. (Thus lex "" = [("","")].) If there is
--   no legal lexeme at the beginning of the input string, lex fails
--   (i.e. returns []).
--   
--   This lexer is not completely faithful to the Haskell lexical syntax in
--   the following respects:
--   
--   
--   
- Qualified names are not handled properly
--   
- Octal and hexadecimal numerics are not recognized as a single
--   token
--   
- Comments are not treated properly
--   
lex :: ReadS String
data Lexeme :: *

-- | Character literal
Char :: Char -> Lexeme

-- | String literal, with escapes interpreted
String :: String -> Lexeme

-- | Punctuation or reserved symbol, e.g. (, ::
Punc :: String -> Lexeme

-- | Haskell identifier, e.g. foo, Baz
Ident :: String -> Lexeme

-- | Haskell symbol, e.g. >>, :%
Symbol :: String -> Lexeme

Number :: Number -> Lexeme
EOF :: Lexeme

-- | Parse a single lexeme
lexP :: ReadPrec Lexeme

-- | (parens p) parses "P", "(P0)", "((P0))", etc, where
--   p parses "P" in the current precedence context and parses
--   "P0" in precedence context zero
parens :: ReadPrec a -> ReadPrec a

-- | A possible replacement definition for the readList method (GHC
--   only). This is only needed for GHC, and even then only for Read
--   instances where readListPrec isn't defined as
--   readListPrecDefault.
readListDefault :: Read a => ReadS [a]

-- | A possible replacement definition for the readListPrec method,
--   defined using readPrec (GHC only).
readListPrecDefault :: Read a => ReadPrec [a]

-- | Parse a string using the Read instance. Succeeds if there is
--   exactly one valid result. A Left value indicates a parse error.
readEither :: Read a => String -> Either String a

-- | Parse a string using the Read instance. Succeeds if there is
--   exactly one valid result.
readMaybe :: Read a => String -> Maybe a

module System.IO.Unsafe.Compat

-- | A slightly faster version of fixIO that may not be safe to use
--   with multiple threads. The unsafety arises when used like this:
--   
--   
--   unsafeFixIO $ \r -> do
--      forkIO (print r)
--      return (...)
--   
--   
--   In this case, the child thread will receive a NonTermination
--   exception instead of waiting for the value of r to be
--   computed.
unsafeFixIO :: (a -> IO a) -> IO a

-- | This version of unsafePerformIO is more efficient because it
--   omits the check that the IO is only being performed by a single
--   thread. Hence, when you use unsafeDupablePerformIO, there is a
--   possibility that the IO action may be performed multiple times (on a
--   multiprocessor), and you should therefore ensure that it gives the
--   same results each time. It may even happen that one of the duplicated
--   IO actions is only run partially, and then interrupted in the middle
--   without an exception being raised. Therefore, functions like
--   bracket cannot be used safely within
--   unsafeDupablePerformIO.
unsafeDupablePerformIO :: IO a -> a

module System.Exit.Compat

-- | Write given error message to stderr and terminate with
--   exitFailure.
die :: String -> IO a

-- | Miscellaneous information about the system environment.
module System.Environment.Compat

-- | Computation getArgs returns a list of the program's command
--   line arguments (not including the program name).
getArgs :: IO [String]

-- | Computation getProgName returns the name of the program as it
--   was invoked.
--   
--   However, this is hard-to-impossible to implement on some non-Unix
--   OSes, so instead, for maximum portability, we just return the leafname
--   of the program as invoked. Even then there are some differences
--   between platforms: on Windows, for example, a program invoked as foo
--   is probably really FOO.EXE, and that is what
--   getProgName will return.
getProgName :: IO String

-- | Computation getEnv var returns the value of the
--   environment variable var. For the inverse, POSIX users can
--   use putEnv.
--   
--   This computation may fail with:
--   
--   
--   
- isDoesNotExistError if the environment variable does not
--   exist.
--   
getEnv :: String -> IO String

-- | Return the value of the environment variable var, or
--   Nothing if there is no such value.
--   
--   For POSIX users, this is equivalent to getEnv.
lookupEnv :: String -> IO (Maybe String)

-- | setEnv name value sets the specified environment variable to
--   value.
--   
--   On Windows setting an environment variable to the empty string
--   removes that environment variable from the environment. For the sake
--   of compatibility we adopt that behavior. In particular
--   
--   
--   setEnv name ""
--   
--   
--   has the same effect as
--   
--   
--   unsetEnv name
--   
--   
--   If you don't care about Windows support and want to set an environment
--   variable to the empty string use System.Posix.Env.setEnv from
--   the unix package instead.
--   
--   Throws IOException if name is the empty string or
--   contains an equals sign.
setEnv :: String -> String -> IO ()

-- | unSet name removes the specified environment variable from
--   the environment of the current process.
--   
--   Throws IOException if name is the empty string or
--   contains an equals sign.
unsetEnv :: String -> IO ()

-- | withArgs args act - while executing action
--   act, have getArgs return args.
withArgs :: [String] -> IO a -> IO a

-- | withProgName name act - while executing action
--   act, have getProgName return name.
withProgName :: String -> IO a -> IO a

-- | getEnvironment retrieves the entire environment as a list of
--   (key,value) pairs.
--   
--   If an environment entry does not contain an '=' character,
--   the key is the whole entry and the value is the
--   empty string.
getEnvironment :: IO [(String, String)]

module Prelude.Compat

module Numeric.Compat

-- | Show a signed RealFloat value using standard decimal notation
--   (e.g. 245000, 0.0015).
--   
--   This behaves as showFFloat, except that a decimal point is
--   always guaranteed, even if not needed.
showFFloatAlt :: RealFloat a => Maybe Int -> a -> ShowS

-- | Show a signed RealFloat value using standard decimal notation
--   for arguments whose absolute value lies between 0.1 and
--   9,999,999, and scientific notation otherwise.
--   
--   This behaves as showFFloat, except that a decimal point is
--   always guaranteed, even if not needed.
showGFloatAlt :: RealFloat a => Maybe Int -> a -> ShowS

module Foreign.Marshal.Utils.Compat

-- | Fill a given number of bytes in memory area with a byte value.
fillBytes :: Ptr a -> Word8 -> Int -> IO ()

module Foreign.Marshal.Unsafe.Compat

-- | Sometimes an external entity is a pure function, except that it passes
--   arguments and/or results via pointers. The function
--   unsafeLocalState permits the packaging of such entities as
--   pure functions.
--   
--   The only IO operations allowed in the IO action passed to
--   unsafeLocalState are (a) local allocation (alloca,
--   allocaBytes and derived operations such as withArray
--   and withCString), and (b) pointer operations
--   (Foreign.Storable and Foreign.Ptr) on the pointers
--   to local storage, and (c) foreign functions whose only observable
--   effect is to read and/or write the locally allocated memory. Passing
--   an IO operation that does not obey these rules results in undefined
--   behaviour.
--   
--   It is expected that this operation will be replaced in a future
--   revision of Haskell.
unsafeLocalState :: IO a -> a

module Foreign.Marshal.Safe.Compat

module Foreign.Marshal.Array.Compat

-- | Like mallocArray, but allocated memory is filled with bytes of
--   value zero.
callocArray :: Storable a => Int -> IO (Ptr a)

-- | Like callocArray0, but allocated memory is filled with bytes of
--   value zero.
callocArray0 :: Storable a => Int -> IO (Ptr a)

module Foreign.Marshal.Alloc.Compat

-- | Like malloc but memory is filled with bytes of value zero.
calloc :: Storable a => IO (Ptr a)

-- | Llike mallocBytes but memory is filled with bytes of value
--   zero.
callocBytes :: Int -> IO (Ptr a)

module Foreign.Marshal.Compat

module Foreign.ForeignPtr.Unsafe.Compat

-- | This function extracts the pointer component of a foreign pointer.
--   This is a potentially dangerous operations, as if the argument to
--   unsafeForeignPtrToPtr is the last usage occurrence of the given
--   foreign pointer, then its finalizer(s) will be run, which potentially
--   invalidates the plain pointer just obtained. Hence,
--   touchForeignPtr must be used wherever it has to be guaranteed
--   that the pointer lives on - i.e., has another usage occurrence.
--   
--   To avoid subtle coding errors, hand written marshalling code should
--   preferably use withForeignPtr rather than combinations of
--   unsafeForeignPtrToPtr and touchForeignPtr. However, the
--   latter routines are occasionally preferred in tool generated
--   marshalling code.
unsafeForeignPtrToPtr :: ForeignPtr a -> Ptr a

module Foreign.ForeignPtr.Safe.Compat

-- | The type ForeignPtr represents references to objects that are
--   maintained in a foreign language, i.e., that are not part of the data
--   structures usually managed by the Haskell storage manager. The
--   essential difference between ForeignPtrs and vanilla memory
--   references of type Ptr a is that the former may be associated
--   with finalizers. A finalizer is a routine that is invoked when
--   the Haskell storage manager detects that - within the Haskell heap and
--   stack - there are no more references left that are pointing to the
--   ForeignPtr. Typically, the finalizer will, then, invoke
--   routines in the foreign language that free the resources bound by the
--   foreign object.
--   
--   The ForeignPtr is parameterised in the same way as Ptr.
--   The type argument of ForeignPtr should normally be an instance
--   of class Storable.
data ForeignPtr a :: * -> *

-- | A finalizer is represented as a pointer to a foreign function that, at
--   finalisation time, gets as an argument a plain pointer variant of the
--   foreign pointer that the finalizer is associated with.
--   
--   Note that the foreign function must use the ccall
--   calling convention.
type FinalizerPtr a = FunPtr (Ptr a -> IO ())
type FinalizerEnvPtr env a = FunPtr (Ptr env -> Ptr a -> IO ())

-- | Turns a plain memory reference into a foreign pointer, and associates
--   a finalizer with the reference. The finalizer will be executed after
--   the last reference to the foreign object is dropped. There is no
--   guarantee of promptness, however the finalizer will be executed before
--   the program exits.
newForeignPtr :: FinalizerPtr a -> Ptr a -> IO (ForeignPtr a)

-- | Turns a plain memory reference into a foreign pointer that may be
--   associated with finalizers by using addForeignPtrFinalizer.
newForeignPtr_ :: Ptr a -> IO (ForeignPtr a)

-- | This function adds a finalizer to the given foreign object. The
--   finalizer will run before all other finalizers for the same
--   object which have already been registered.
addForeignPtrFinalizer :: FinalizerPtr a -> ForeignPtr a -> IO ()

-- | This variant of newForeignPtr adds a finalizer that expects an
--   environment in addition to the finalized pointer. The environment that
--   will be passed to the finalizer is fixed by the second argument to
--   newForeignPtrEnv.
newForeignPtrEnv :: FinalizerEnvPtr env a -> Ptr env -> Ptr a -> IO (ForeignPtr a)

-- | Like addForeignPtrFinalizerEnv but allows the finalizer to be
--   passed an additional environment parameter to be passed to the
--   finalizer. The environment passed to the finalizer is fixed by the
--   second argument to addForeignPtrFinalizerEnv
addForeignPtrFinalizerEnv :: FinalizerEnvPtr env a -> Ptr env -> ForeignPtr a -> IO ()

-- | This is a way to look at the pointer living inside a foreign object.
--   This function takes a function which is applied to that pointer. The
--   resulting IO action is then executed. The foreign object is
--   kept alive at least during the whole action, even if it is not used
--   directly inside. Note that it is not safe to return the pointer from
--   the action and use it after the action completes. All uses of the
--   pointer should be inside the withForeignPtr bracket. The reason
--   for this unsafeness is the same as for unsafeForeignPtrToPtr
--   below: the finalizer may run earlier than expected, because the
--   compiler can only track usage of the ForeignPtr object, not a
--   Ptr object made from it.
--   
--   This function is normally used for marshalling data to or from the
--   object pointed to by the ForeignPtr, using the operations from
--   the Storable class.
withForeignPtr :: ForeignPtr a -> (Ptr a -> IO b) -> IO b

-- | Causes the finalizers associated with a foreign pointer to be run
--   immediately.
finalizeForeignPtr :: ForeignPtr a -> IO ()

-- | This function ensures that the foreign object in question is alive at
--   the given place in the sequence of IO actions. In particular
--   withForeignPtr does a touchForeignPtr after it executes
--   the user action.
--   
--   Note that this function should not be used to express dependencies
--   between finalizers on ForeignPtrs. For example, if the
--   finalizer for a ForeignPtr F1 calls
--   touchForeignPtr on a second ForeignPtr F2, then
--   the only guarantee is that the finalizer for F2 is never
--   started before the finalizer for F1. They might be started
--   together if for example both F1 and F2 are otherwise
--   unreachable, and in that case the scheduler might end up running the
--   finalizer for F2 first.
--   
--   In general, it is not recommended to use finalizers on separate
--   objects with ordering constraints between them. To express the
--   ordering robustly requires explicit synchronisation using
--   MVars between the finalizers, but even then the runtime
--   sometimes runs multiple finalizers sequentially in a single thread
--   (for performance reasons), so synchronisation between finalizers could
--   result in artificial deadlock. Another alternative is to use explicit
--   reference counting.
touchForeignPtr :: ForeignPtr a -> IO ()

-- | This function casts a ForeignPtr parameterised by one type into
--   another type.
castForeignPtr :: ForeignPtr a -> ForeignPtr b

-- | Allocate some memory and return a ForeignPtr to it. The memory
--   will be released automatically when the ForeignPtr is
--   discarded.
--   
--   mallocForeignPtr is equivalent to
--   
--   
--   do { p <- malloc; newForeignPtr finalizerFree p }
--   
--   
--   although it may be implemented differently internally: you may not
--   assume that the memory returned by mallocForeignPtr has been
--   allocated with malloc.
--   
--   GHC notes: mallocForeignPtr has a heavily optimised
--   implementation in GHC. It uses pinned memory in the garbage collected
--   heap, so the ForeignPtr does not require a finalizer to free
--   the memory. Use of mallocForeignPtr and associated functions is
--   strongly recommended in preference to newForeignPtr with a
--   finalizer.
mallocForeignPtr :: Storable a => IO (ForeignPtr a)

-- | This function is similar to mallocForeignPtr, except that the
--   size of the memory required is given explicitly as a number of bytes.
mallocForeignPtrBytes :: Int -> IO (ForeignPtr a)

-- | This function is similar to mallocArray, but yields a memory
--   area that has a finalizer attached that releases the memory area. As
--   with mallocForeignPtr, it is not guaranteed that the block of
--   memory was allocated by malloc.
mallocForeignPtrArray :: Storable a => Int -> IO (ForeignPtr a)

-- | This function is similar to mallocArray0, but yields a memory
--   area that has a finalizer attached that releases the memory area. As
--   with mallocForeignPtr, it is not guaranteed that the block of
--   memory was allocated by malloc.
mallocForeignPtrArray0 :: Storable a => Int -> IO (ForeignPtr a)

module Foreign.ForeignPtr.Compat

-- | Advances the given address by the given offset in bytes.
--   
--   The new ForeignPtr shares the finalizer of the original,
--   equivalent from a finalization standpoint to just creating another
--   reference to the original. That is, the finalizer will not be called
--   before the new ForeignPtr is unreachable, nor will it be called
--   an additional time due to this call, and the finalizer will be called
--   with the same address that it would have had this call not happened,
--   *not* the new address.
--   
--   Since: 4.10.0.0
plusForeignPtr :: ForeignPtr a -> Int -> ForeignPtr b

module Foreign.Compat

module Debug.Trace.Compat

-- | Like trace but returns the message instead of a third value.
traceId :: String -> String

-- | Like traceShow but returns the shown value instead of a third
--   value.
traceShowId :: Show a => a -> a

-- | Like trace but returning unit in an arbitrary
--   Applicative context. Allows for convenient use in do-notation.
--   
--   Note that the application of traceM is not an action in the
--   Applicative context, as traceIO is in the IO
--   type. While the fresh bindings in the following example will force the
--   traceM expressions to be reduced every time the
--   do-block is executed, traceM "not crashed" would
--   only be reduced once, and the message would only be printed once. If
--   your monad is in MonadIO, liftIO . traceIO may be a
--   better option.
--   
--   
--   ... = do
--     x <- ...
--     traceM $ "x: " ++ show x
--     y <- ...
--     traceM $ "y: " ++ show y
--   
traceM :: Applicative f => String -> f ()

-- | Like traceM, but uses show on the argument to convert it
--   to a String.
--   
--   
--   ... = do
--     x <- ...
--     traceShowM $ x
--     y <- ...
--     traceShowM $ x + y
--   
traceShowM :: (Show a, Applicative f) => a -> f ()

module Data.Word.Compat

-- | Swap bytes in Word16.
byteSwap16 :: Word16 -> Word16

-- | Reverse order of bytes in Word32.
byteSwap32 :: Word32 -> Word32

-- | Reverse order of bytes in Word64.
byteSwap64 :: Word64 -> Word64

module Data.Version.Compat

-- | Construct tag-less Version
makeVersion :: [Int] -> Version

module Data.Type.Coercion.Compat

-- | Generalized form of type-safe cast using representational equality
--   
--   Since: 4.10.0.0
gcoerceWith :: Coercion a b -> (Coercible a b => r) -> r

module Data.String.Compat

-- | A String is a list of characters. String constants in Haskell
--   are values of type String.
type String = [Char]

-- | lines breaks a string up into a list of strings at newline
--   characters. The resulting strings do not contain newlines.
--   
--   Note that after splitting the string at newline characters, the last
--   part of the string is considered a line even if it doesn't end with a
--   newline. For example,
--   
--   
--   lines "" == []
--   lines "\n" == [""]
--   lines "one" == ["one"]
--   lines "one\n" == ["one"]
--   lines "one\n\n" == ["one",""]
--   lines "one\ntwo" == ["one","two"]
--   lines "one\ntwo\n" == ["one","two"]
--   
--   
--   Thus lines s contains at least as many elements as
--   newlines in s.
lines :: String -> [String]

-- | words breaks a string up into a list of words, which were
--   delimited by white space.
words :: String -> [String]

-- | unlines is an inverse operation to lines. It joins
--   lines, after appending a terminating newline to each.
unlines :: [String] -> String

-- | unwords is an inverse operation to words. It joins words
--   with separating spaces.
unwords :: [String] -> String

module Data.STRef.Compat

-- | Strict version of modifySTRef
modifySTRef' :: STRef s a -> (a -> a) -> ST s ()

module Data.Ratio.Compat

module Data.Proxy.Compat

-- | asProxyTypeOf is a type-restricted version of const. It
--   is usually used as an infix operator, and its typing forces its first
--   argument (which is usually overloaded) to have the same type as the
--   tag of the second.
asProxyTypeOf :: a -> proxy a -> a

module Data.Monoid.Compat

-- | An infix synonym for mappend.
(<>) :: Monoid m => m -> m -> m
infixr 6 <>

module Data.List.Compat

module Data.IORef.Compat

-- | Strict version of modifyIORef
modifyIORef' :: IORef a -> (a -> a) -> IO ()

-- | Strict version of atomicModifyIORef. This forces both the value
--   stored in the IORef as well as the value returned.
atomicModifyIORef' :: IORef a -> (a -> (a, b)) -> IO b

-- | Variant of writeIORef with the "barrier to reordering" property
--   that atomicModifyIORef has.
atomicWriteIORef :: IORef a -> a -> IO ()

module Data.Functor.Const.Compat

-- | The Const functor.
newtype Const k a (b :: k) :: forall k. * -> k -> *
Const :: a -> Const k a
[getConst] :: Const k a -> a

module Data.Functor.Compat

-- | The Functor class is used for types that can be mapped over.
--   Instances of Functor should satisfy the following laws:
--   
--   
--   fmap id  ==  id
--   fmap (f . g)  ==  fmap f . fmap g
--   
--   
--   The instances of Functor for lists, Maybe and IO
--   satisfy these laws.
class Functor (f :: * -> *)
fmap :: Functor f => (a -> b) -> f a -> f b

-- | Replace all locations in the input with the same value. The default
--   definition is fmap . const, but this may be
--   overridden with a more efficient version.
(<$) :: Functor f => a -> f b -> f a

-- | Flipped version of <$.
--   
--   
Examples
--   
--   Replace the contents of a Maybe Int with a
--   constant String:
--   
--   
--   >>> Nothing $> "foo"
--   Nothing
--   
--   >>> Just 90210 $> "foo"
--   Just "foo"
--   
--   
--   Replace the contents of an Either Int
--   Int with a constant String, resulting in an
--   Either Int String:
--   
--   
--   >>> Left 8675309 $> "foo"
--   Left 8675309
--   
--   >>> Right 8675309 $> "foo"
--   Right "foo"
--   
--   
--   Replace each element of a list with a constant String:
--   
--   
--   >>> [1,2,3] $> "foo"
--   ["foo","foo","foo"]
--   
--   
--   Replace the second element of a pair with a constant String:
--   
--   
--   >>> (1,2) $> "foo"
--   (1,"foo")
--   
($>) :: Functor f => f a -> b -> f b
infixl 4 $>

-- | void value discards or ignores the result of
--   evaluation, such as the return value of an IO action.
--   
--   
Examples
--   
--   Replace the contents of a Maybe Int with
--   unit:
--   
--   
--   >>> void Nothing
--   Nothing
--   
--   >>> void (Just 3)
--   Just ()
--   
--   
--   Replace the contents of an Either Int
--   Int with unit, resulting in an Either
--   Int '()':
--   
--   
--   >>> void (Left 8675309)
--   Left 8675309
--   
--   >>> void (Right 8675309)
--   Right ()
--   
--   
--   Replace every element of a list with unit:
--   
--   
--   >>> void [1,2,3]
--   [(),(),()]
--   
--   
--   Replace the second element of a pair with unit:
--   
--   
--   >>> void (1,2)
--   (1,())
--   
--   
--   Discard the result of an IO action:
--   
--   
--   >>> mapM print [1,2]
--   1
--   2
--   [(),()]
--   
--   >>> void $ mapM print [1,2]
--   1
--   2
--   
void :: Functor f => f a -> f ()

module Data.Function.Compat

-- | & is a reverse application operator. This provides
--   notational convenience. Its precedence is one higher than that of the
--   forward application operator $, which allows & to be
--   nested in $.
(&) :: a -> (a -> b) -> b
infixl 1 &

module Data.Foldable.Compat

-- | The largest element of a non-empty structure with respect to the given
--   comparison function.
maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a

-- | The least element of a non-empty structure with respect to the given
--   comparison function.
minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a

module Data.Either.Compat

-- | Return True if the given value is a Left-value,
--   False otherwise.
--   
--   
Examples
--   
--   Basic usage:
--   
--   
--   >>> isLeft (Left "foo")
--   True
--   
--   >>> isLeft (Right 3)
--   False
--   
--   
--   Assuming a Left value signifies some sort of error, we can use
--   isLeft to write a very simple error-reporting function that
--   does absolutely nothing in the case of success, and outputs "ERROR" if
--   any error occurred.
--   
--   This example shows how isLeft might be used to avoid pattern
--   matching when one does not care about the value contained in the
--   constructor:
--   
--   
--   >>> import Control.Monad ( when )
--   
--   >>> let report e = when (isLeft e) $ putStrLn "ERROR"
--   
--   >>> report (Right 1)
--   
--   >>> report (Left "parse error")
--   ERROR
--   
isLeft :: Either a b -> Bool

-- | Return True if the given value is a Right-value,
--   False otherwise.
--   
--   
Examples
--   
--   Basic usage:
--   
--   
--   >>> isRight (Left "foo")
--   False
--   
--   >>> isRight (Right 3)
--   True
--   
--   
--   Assuming a Left value signifies some sort of error, we can use
--   isRight to write a very simple reporting function that only
--   outputs "SUCCESS" when a computation has succeeded.
--   
--   This example shows how isRight might be used to avoid pattern
--   matching when one does not care about the value contained in the
--   constructor:
--   
--   
--   >>> import Control.Monad ( when )
--   
--   >>> let report e = when (isRight e) $ putStrLn "SUCCESS"
--   
--   >>> report (Left "parse error")
--   
--   >>> report (Right 1)
--   SUCCESS
--   
isRight :: Either a b -> Bool

-- | Return the contents of a Left-value or a default value
--   otherwise.
--   
--   Since: 4.10.0.0
--   
--   
Examples
--   
--   Basic usage:
--   
--   
--   >>> fromLeft 1 (Left 3)
--   3
--   
--   >>> fromLeft 1 (Right "foo")
--   1
--   
fromLeft :: a -> Either a b -> a

-- | Return the contents of a Right-value or a default value
--   otherwise.
--   
--   Since: 4.10.0.0
--   
--   
Examples
--   
--   Basic usage:
--   
--   
--   >>> fromRight 1 (Right 3)
--   3
--   
--   >>> fromRight 1 (Left "foo")
--   1
--   
fromRight :: b -> Either a b -> b

module Data.Complex.Compat

module Data.Bool.Compat

-- | Case analysis for the Bool type. bool x y p
--   evaluates to x when p is False, and evaluates
--   to y when p is True.
--   
--   This is equivalent to if p then y else x; that is, one can
--   think of it as an if-then-else construct with its arguments reordered.
--   
--   
Examples
--   
--   Basic usage:
--   
--   
--   >>> bool "foo" "bar" True
--   "bar"
--   
--   >>> bool "foo" "bar" False
--   "foo"
--   
--   
--   Confirm that bool x y p and if p then y else
--   x are equivalent:
--   
--   
--   >>> let p = True; x = "bar"; y = "foo"
--   
--   >>> bool x y p == if p then y else x
--   True
--   
--   >>> let p = False
--   
--   >>> bool x y p == if p then y else x
--   True
--   
bool :: a -> a -> Bool -> a

module Data.Bits.Compat

-- | Default implementation for bit.
--   
--   Note that: bitDefault i = 1 shiftL i
bitDefault :: (Bits a, Num a) => Int -> a

-- | Default implementation for testBit.
--   
--   Note that: testBitDefault x i = (x .&. bit i) /= 0
testBitDefault :: (Bits a, Num a) => a -> Int -> Bool

-- | Default implementation for popCount.
--   
--   This implementation is intentionally naive. Instances are expected to
--   provide an optimized implementation for their size.
popCountDefault :: (Bits a, Num a) => a -> Int

-- | Attempt to convert an Integral type a to an
--   Integral type b using the size of the types as
--   measured by Bits methods.
--   
--   A simpler version of this function is:
--   
--   
--   toIntegral :: (Integral a, Integral b) => a -> Maybe b
--   toIntegral x
--     | toInteger x == y = Just (fromInteger y)
--     | otherwise        = Nothing
--     where
--       y = toInteger x
--   
--   
--   This version requires going through Integer, which can be
--   inefficient. However, toIntegralSized is optimized to allow
--   GHC to statically determine the relative type sizes (as measured by
--   bitSizeMaybe and isSigned) and avoid going through
--   Integer for many types. (The implementation uses
--   fromIntegral, which is itself optimized with rules for
--   base types but may go through Integer for some type
--   pairs.)
toIntegralSized :: (Integral a, Integral b, Bits a, Bits b) => a -> Maybe b

module Control.Monad.ST.Unsafe.Compat
unsafeInterleaveST :: ST s a -> ST s a
unsafeIOToST :: IO a -> ST s a
unsafeSTToIO :: ST s a -> IO a

module Control.Monad.ST.Lazy.Unsafe.Compat
unsafeInterleaveST :: ST s a -> ST s a
unsafeIOToST :: IO a -> ST s a

module Control.Monad.Compat

-- | The Monad class defines the basic operations over a
--   monad, a concept from a branch of mathematics known as
--   category theory. From the perspective of a Haskell programmer,
--   however, it is best to think of a monad as an abstract datatype
--   of actions. Haskell's do expressions provide a convenient
--   syntax for writing monadic expressions.
--   
--   Instances of Monad should satisfy the following laws:
--   
--   
--   
- 
return a >>= k = k a

--   
- 
m >>= return = m

--   
- 
m >>= (\x -> k x >>= h) = (m
--   >>= k) >>= h

--   
--   
--   Furthermore, the Monad and Applicative operations should
--   relate as follows:
--   
--   
--   
- 
pure = return

--   
- 
(<*>) = ap

--   
--   
--   The above laws imply:
--   
--   
--   
- 
fmap f xs = xs >>= return .
--   f

--   
- 
(>>) = (*>)

--   
--   
--   and that pure and (<*>) satisfy the applicative
--   functor laws.
--   
--   The instances of Monad for lists, Maybe and IO
--   defined in the Prelude satisfy these laws.
class Applicative m => Monad (m :: * -> *)

-- | Sequentially compose two actions, passing any value produced by the
--   first as an argument to the second.
(>>=) :: Monad m => m a -> (a -> m b) -> m b

-- | Sequentially compose two actions, discarding any value produced by the
--   first, like sequencing operators (such as the semicolon) in imperative
--   languages.
(>>) :: Monad m => m a -> m b -> m b

-- | Inject a value into the monadic type.
return :: Monad m => a -> m a

-- | Fail with a message. This operation is not part of the mathematical
--   definition of a monad, but is invoked on pattern-match failure in a
--   do expression.
--   
--   As part of the MonadFail proposal (MFP), this function is moved to its
--   own class MonadFail (see Control.Monad.Fail for more
--   details). The definition here will be removed in a future release.
fail :: Monad m => String -> m a

-- | Monads that also support choice and failure.
class (Alternative m, Monad m) => MonadPlus (m :: * -> *)

-- | the identity of mplus. It should also satisfy the equations
--   
--   
--   mzero >>= f  =  mzero
--   v >> mzero   =  mzero
--   
mzero :: MonadPlus m => m a

-- | an associative operation
mplus :: MonadPlus m => m a -> m a -> m a

module Control.Concurrent.MVar.Compat

-- | Like withMVar, but the IO action in the second
--   argument is executed with asynchronous exceptions masked.
withMVarMasked :: MVar a -> (a -> IO b) -> IO b

module Control.Concurrent.Compat

-- | Fork a thread and call the supplied function when the thread is about
--   to terminate, with an exception or a returned value. The function is
--   called with asynchronous exceptions masked.
--   
--   
--   forkFinally action and_then =
--     mask $ \restore ->
--       forkIO $ try (restore action) >>= and_then
--   
--   
--   This function is useful for informing the parent when a child
--   terminates, for example.
forkFinally :: IO a -> (Either SomeException a -> IO ()) -> IO ThreadId

-- | Like forkIOWithUnmask, but the child thread is a bound thread,
--   as with forkOS.
forkOSWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO ThreadId
