0.3 Release (#115)
* Add total ConvertText alternative to Conv * Explain ConvertText's meaning * Rename convertText to toS for compatibility * 0.3.0 Refactor (#111) * Begin work on 0.3 refactor * Remove old docs folder * Fix dodgy exports * 4.8 constraint for null and length * Guards for Semigroup export for base<4.9 * Fix Data.Bits exports * Guards for typeable exports * Remove unused pragmas * Update hlint.yaml * Use liftM because of pre-AMP quirkk * Data.Char exports * Rework Exception exports * Fix bounds * Adding Monad.Fail shim * Fix displayException export * Explicit GHC.Prim import for ancient ghc * Explicit raise# for base-4.7 * Flush legacy testing infrastructure * Update git location * Update README * Add Partial module * Add concurrency exports * Explicit GHC.Float exports * Bounds for threadWaitReadSTM, threadWaitWriteSTM, forkOSWithUnmask * Fix for weird undocumented underflowError weirdness * forkOSWithUnask for base>4.8 * Fix GHC.Real exports pre base-4.7 * Fix withMVarMasked for base-4.7 * Update nix derivation * Update derivation * Update derivation * Explicit functor exports * <$ export * Overwrite binary * Fix some missing exports * Update Changelog * Minor export fixes base<4.9 * Explicit exports * Export handler * Generate export lists for multiple versions (#114) * Generate export lists for #112 * Make export lists format OccName uniformly * Make compile on ancient GHC * Use Foldable.concat * Hacks to make ghc-7.6 API happy * liftIO shim * Fix sortOn warning * Update ChangeLog * Update base bounds * Export conventions * Update Haddocks * Document GHC magic
This commit is contained in:
+502
-135
@@ -1,50 +1,158 @@
|
||||
{-# LANGUAGE BangPatterns #-}
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE Trustworthy #-}
|
||||
{-# LANGUAGE BangPatterns #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE NoImplicitPrelude #-}
|
||||
{-# LANGUAGE ExplicitNamespaces #-}
|
||||
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
|
||||
|
||||
module Protolude (
|
||||
module X,
|
||||
-- * Base functions
|
||||
module Base,
|
||||
identity,
|
||||
map,
|
||||
uncons,
|
||||
unsnoc,
|
||||
applyN,
|
||||
print,
|
||||
throwIO,
|
||||
throwTo,
|
||||
show,
|
||||
pass,
|
||||
guarded,
|
||||
guardedA,
|
||||
LText,
|
||||
LByteString,
|
||||
liftIO1,
|
||||
liftIO2,
|
||||
#if !MIN_VERSION_base(4,8,0)
|
||||
(&),
|
||||
scanl',
|
||||
#endif
|
||||
-- * Function functions
|
||||
module Function,
|
||||
applyN,
|
||||
-- * List functions
|
||||
module List,
|
||||
map,
|
||||
uncons,
|
||||
unsnoc,
|
||||
-- * Data Structures
|
||||
module DataStructures,
|
||||
-- * Show functions
|
||||
module Show,
|
||||
show,
|
||||
print,
|
||||
-- * Bool functions
|
||||
module Bool,
|
||||
-- * Monad functions
|
||||
module Monad,
|
||||
liftIO1,
|
||||
liftIO2,
|
||||
-- * Functor functions
|
||||
module Functor,
|
||||
-- * Either functions
|
||||
module Either,
|
||||
-- * Applicative functions
|
||||
module Applicative,
|
||||
guarded,
|
||||
guardedA,
|
||||
-- * String conversion
|
||||
module ConvertText,
|
||||
-- * Debug functions
|
||||
module Debug,
|
||||
|
||||
-- * Panic functions
|
||||
module Panic,
|
||||
-- * Exception functions
|
||||
module Exception,
|
||||
Protolude.throwIO,
|
||||
Protolude.throwTo,
|
||||
-- * Semiring functions
|
||||
module Semiring,
|
||||
|
||||
-- * String functions
|
||||
module String,
|
||||
-- * Safe functions
|
||||
module Safe,
|
||||
-- * Eq functions
|
||||
module Eq,
|
||||
-- * Ord functions
|
||||
module Ord,
|
||||
-- * Traversable functions
|
||||
module Traversable,
|
||||
-- * Foldable functions
|
||||
module Foldable,
|
||||
-- * Semigroup functions
|
||||
#if MIN_VERSION_base(4,9,0)
|
||||
module Semigroup,
|
||||
#endif
|
||||
-- * Monoid functions
|
||||
module Monoid,
|
||||
-- * Bifunctor functions
|
||||
module Bifunctor,
|
||||
-- * Bifunctor functions
|
||||
module Hashable,
|
||||
|
||||
-- * Deepseq functions
|
||||
module DeepSeq,
|
||||
|
||||
-- * Tuple functions
|
||||
module Tuple,
|
||||
|
||||
module Typeable,
|
||||
|
||||
#if MIN_VERSION_base(4,7,0)
|
||||
-- * Typelevel programming
|
||||
module Typelevel,
|
||||
#endif
|
||||
|
||||
-- * Monads
|
||||
module Fail,
|
||||
module State,
|
||||
module Reader,
|
||||
module Except,
|
||||
module Trans,
|
||||
module ST,
|
||||
module STM,
|
||||
|
||||
-- * Integers
|
||||
module Int,
|
||||
module Bits,
|
||||
|
||||
-- * Complex functions
|
||||
module Complex,
|
||||
|
||||
-- * Char functions
|
||||
module Char,
|
||||
|
||||
-- * Maybe functions
|
||||
module Maybe,
|
||||
|
||||
-- * Generics functions
|
||||
module Generics,
|
||||
|
||||
-- * ByteString functions
|
||||
module ByteString,
|
||||
LByteString,
|
||||
|
||||
-- * Text functions
|
||||
module Text,
|
||||
LText,
|
||||
|
||||
-- * Read functions
|
||||
module Read,
|
||||
|
||||
-- * System functions
|
||||
module System,
|
||||
die,
|
||||
|
||||
-- * Concurrency functions
|
||||
module Concurrency,
|
||||
|
||||
-- * Foreign functions
|
||||
module Foreign,
|
||||
) where
|
||||
|
||||
-- Protolude module exports.
|
||||
import Debug as X
|
||||
import Protolude.List as X
|
||||
import Protolude.Show as X
|
||||
import Protolude.Bool as X
|
||||
import Protolude.Monad as X
|
||||
import Protolude.Functor as X
|
||||
import Protolude.Either as X
|
||||
import Protolude.Applicative as X
|
||||
import Protolude.Conv as X
|
||||
import Protolude.Panic as X
|
||||
import Protolude.Exceptions as X
|
||||
import Protolude.Semiring as X
|
||||
import Protolude.Debug as Debug
|
||||
import Protolude.List as List
|
||||
import Protolude.Show as Show
|
||||
import Protolude.Bool as Bool
|
||||
import Protolude.Monad as Monad
|
||||
import Protolude.Functor as Functor
|
||||
import Protolude.Either as Either
|
||||
import Protolude.Applicative as Applicative
|
||||
import Protolude.ConvertText as ConvertText
|
||||
import Protolude.Panic as Panic
|
||||
import Protolude.Exceptions as Exception
|
||||
import Protolude.Semiring as Semiring
|
||||
|
||||
import Protolude.Base as Base hiding (
|
||||
putStr -- Overriden by Show.putStr
|
||||
@@ -61,10 +169,10 @@ import qualified Protolude.Base as PBase
|
||||
|
||||
-- Used for 'show', not exported.
|
||||
import Data.String (String)
|
||||
import Data.String as X (IsString)
|
||||
import Data.String as String (IsString)
|
||||
|
||||
-- Maybe'ized version of partial functions
|
||||
import Protolude.Safe as X (
|
||||
import Protolude.Safe as Safe (
|
||||
headMay
|
||||
, headDef
|
||||
, initMay
|
||||
@@ -87,11 +195,11 @@ import Protolude.Safe as X (
|
||||
)
|
||||
|
||||
-- Applicatives
|
||||
import Control.Applicative as X (
|
||||
import Control.Applicative as Applicative (
|
||||
Applicative(..)
|
||||
, Alternative(..)
|
||||
, Const(..)
|
||||
, ZipList(..)
|
||||
, Const(Const,getConst)
|
||||
, ZipList(ZipList,getZipList)
|
||||
, (<**>)
|
||||
, liftA
|
||||
, liftA2
|
||||
@@ -100,32 +208,63 @@ import Control.Applicative as X (
|
||||
)
|
||||
|
||||
-- Base typeclasses
|
||||
import Data.Eq as X (
|
||||
import Data.Eq as Eq (
|
||||
Eq(..)
|
||||
)
|
||||
import Data.Ord as X (
|
||||
import Data.Ord as Ord (
|
||||
Ord(..)
|
||||
, Ordering(..)
|
||||
, Down(..)
|
||||
, Ordering(LT,EQ,GT)
|
||||
, Down(Down)
|
||||
, comparing
|
||||
)
|
||||
import Data.Traversable as X
|
||||
import Data.Foldable as X hiding (
|
||||
foldr1
|
||||
, foldl1
|
||||
, product
|
||||
, sum
|
||||
import Data.Traversable as Traversable
|
||||
import Data.Foldable as Foldable (
|
||||
Foldable,
|
||||
fold,
|
||||
foldMap,
|
||||
foldr,
|
||||
foldr',
|
||||
foldl,
|
||||
foldl',
|
||||
toList,
|
||||
#if MIN_VERSION_base(4,8,0)
|
||||
null,
|
||||
length,
|
||||
#endif
|
||||
elem,
|
||||
maximum,
|
||||
minimum,
|
||||
foldrM,
|
||||
foldlM,
|
||||
traverse_,
|
||||
for_,
|
||||
mapM_,
|
||||
forM_,
|
||||
sequence_,
|
||||
sequenceA_,
|
||||
asum,
|
||||
msum,
|
||||
concat,
|
||||
concatMap,
|
||||
and,
|
||||
or,
|
||||
any,
|
||||
all,
|
||||
maximumBy,
|
||||
minimumBy,
|
||||
notElem,
|
||||
find,
|
||||
)
|
||||
import Data.Functor.Identity as X (
|
||||
Identity(..)
|
||||
import Data.Functor.Identity as Functor (
|
||||
Identity(Identity, runIdentity)
|
||||
)
|
||||
|
||||
#if MIN_VERSION_base(4,9,0)
|
||||
import Data.List.NonEmpty as X (
|
||||
NonEmpty(..)
|
||||
import Data.List.NonEmpty as List (
|
||||
NonEmpty((:|))
|
||||
, nonEmpty
|
||||
)
|
||||
import Data.Semigroup as X (
|
||||
import Data.Semigroup as Semigroup (
|
||||
Semigroup(sconcat, stimes)
|
||||
, WrappedMonoid
|
||||
, Option(..)
|
||||
@@ -139,16 +278,16 @@ import Data.Semigroup as X (
|
||||
)
|
||||
#endif
|
||||
|
||||
import Data.Monoid as X
|
||||
import Data.Monoid as Monoid
|
||||
|
||||
#if !MIN_VERSION_base(4,8,0)
|
||||
import Protolude.Bifunctor as X (Bifunctor(..))
|
||||
import Protolude.Bifunctor as Bifunctor (Bifunctor(bimap, first, second))
|
||||
#else
|
||||
import Data.Bifunctor as X (Bifunctor(..))
|
||||
import Data.Bifunctor as Bifunctor (Bifunctor(bimap, first, second))
|
||||
#endif
|
||||
|
||||
-- Deepseq
|
||||
import Control.DeepSeq as X (
|
||||
import Control.DeepSeq as DeepSeq (
|
||||
NFData(..)
|
||||
, ($!!)
|
||||
, deepseq
|
||||
@@ -156,7 +295,7 @@ import Control.DeepSeq as X (
|
||||
)
|
||||
|
||||
-- Data structures
|
||||
import Data.Tuple as X (
|
||||
import Data.Tuple as Tuple (
|
||||
fst
|
||||
, snd
|
||||
, curry
|
||||
@@ -164,7 +303,7 @@ import Data.Tuple as X (
|
||||
, swap
|
||||
)
|
||||
|
||||
import Data.List as X (
|
||||
import Data.List as List (
|
||||
splitAt
|
||||
, break
|
||||
, intercalate
|
||||
@@ -211,39 +350,43 @@ import Data.List (tail)
|
||||
#endif
|
||||
|
||||
-- Hashing
|
||||
import Data.Hashable as X (
|
||||
import Data.Hashable as Hashable (
|
||||
Hashable
|
||||
, hash
|
||||
, hashWithSalt
|
||||
, hashUsing
|
||||
)
|
||||
|
||||
import Data.Map as X (Map)
|
||||
import Data.Set as X (Set)
|
||||
import Data.Sequence as X (Seq)
|
||||
import Data.IntMap as X (IntMap)
|
||||
import Data.IntSet as X (IntSet)
|
||||
import Data.Map as DataStructures (Map)
|
||||
import Data.Set as DataStructures (Set)
|
||||
import Data.Sequence as DataStructures (Seq)
|
||||
import Data.IntMap as DataStructures (IntMap)
|
||||
import Data.IntSet as DataStructures (IntSet)
|
||||
|
||||
import Data.Typeable as Typeable (
|
||||
TypeRep
|
||||
, Typeable
|
||||
, typeOf
|
||||
, cast
|
||||
, gcast
|
||||
#if MIN_VERSION_base(4,7,0)
|
||||
, typeRep
|
||||
, eqT
|
||||
#endif
|
||||
)
|
||||
|
||||
#if MIN_VERSION_base(4,7,0)
|
||||
import Data.Proxy as X (
|
||||
import Data.Proxy as Typelevel (
|
||||
Proxy(..)
|
||||
)
|
||||
|
||||
import Data.Typeable as X (
|
||||
TypeRep
|
||||
, Typeable
|
||||
, typeRep
|
||||
, cast
|
||||
, eqT
|
||||
)
|
||||
|
||||
import Data.Type.Coercion as X (
|
||||
import Data.Type.Coercion as Typelevel (
|
||||
Coercion(..)
|
||||
, coerceWith
|
||||
, repr
|
||||
)
|
||||
|
||||
import Data.Type.Equality as X (
|
||||
import Data.Type.Equality as Typelevel (
|
||||
(:~:)(..)
|
||||
, type (==)
|
||||
, sym
|
||||
@@ -255,15 +398,19 @@ import Data.Type.Equality as X (
|
||||
#endif
|
||||
|
||||
#if MIN_VERSION_base(4,8,0)
|
||||
import Data.Void as X (
|
||||
import Data.Void as Typelevel (
|
||||
Void
|
||||
, absurd
|
||||
, vacuous
|
||||
)
|
||||
#endif
|
||||
|
||||
import Control.Monad.Fail as Fail (
|
||||
MonadFail
|
||||
)
|
||||
|
||||
-- Monad transformers
|
||||
import Control.Monad.State as X (
|
||||
import Control.Monad.State as State (
|
||||
MonadState
|
||||
, State
|
||||
, StateT(StateT)
|
||||
@@ -283,7 +430,7 @@ import Control.Monad.State as X (
|
||||
, evalStateT
|
||||
)
|
||||
|
||||
import Control.Monad.Reader as X (
|
||||
import Control.Monad.Reader as Reader (
|
||||
MonadReader
|
||||
, Reader
|
||||
, ReaderT(ReaderT)
|
||||
@@ -295,12 +442,12 @@ import Control.Monad.Reader as X (
|
||||
, runReaderT
|
||||
)
|
||||
|
||||
import Control.Monad.Trans.Except as X (
|
||||
import Control.Monad.Trans.Except as Except (
|
||||
throwE
|
||||
, catchE
|
||||
)
|
||||
|
||||
import Control.Monad.Except as X (
|
||||
import Control.Monad.Except as Except (
|
||||
MonadError
|
||||
, Except
|
||||
, ExceptT(ExceptT)
|
||||
@@ -314,25 +461,60 @@ import Control.Monad.Except as X (
|
||||
, withExceptT
|
||||
)
|
||||
|
||||
import Control.Monad.Trans as X (
|
||||
import Control.Monad.Trans as Trans (
|
||||
MonadIO
|
||||
, lift
|
||||
, liftIO
|
||||
)
|
||||
|
||||
-- Base types
|
||||
import Data.Int as X (
|
||||
import Data.Int as Int (
|
||||
Int
|
||||
, Int8
|
||||
, Int16
|
||||
, Int32
|
||||
, Int64
|
||||
)
|
||||
import Data.Bits as X hiding (
|
||||
unsafeShiftL
|
||||
, unsafeShiftR
|
||||
import Data.Bits as Bits (
|
||||
Bits,
|
||||
(.&.),
|
||||
(.|.),
|
||||
xor,
|
||||
complement,
|
||||
shift,
|
||||
rotate,
|
||||
#if MIN_VERSION_base(4,7,0)
|
||||
zeroBits,
|
||||
#endif
|
||||
bit,
|
||||
setBit,
|
||||
clearBit,
|
||||
complementBit,
|
||||
testBit,
|
||||
#if MIN_VERSION_base(4,7,0)
|
||||
bitSizeMaybe,
|
||||
#endif
|
||||
bitSize,
|
||||
isSigned,
|
||||
shiftL,
|
||||
shiftR,
|
||||
rotateL,
|
||||
rotateR,
|
||||
popCount,
|
||||
#if MIN_VERSION_base(4,7,0)
|
||||
FiniteBits,
|
||||
finiteBitSize,
|
||||
bitDefault,
|
||||
testBitDefault,
|
||||
popCountDefault,
|
||||
#endif
|
||||
#if MIN_VERSION_base(4,8,0)
|
||||
toIntegralSized,
|
||||
countLeadingZeros,
|
||||
countTrailingZeros,
|
||||
#endif
|
||||
)
|
||||
import Data.Word as X (
|
||||
import Data.Word as Bits (
|
||||
Word
|
||||
, Word8
|
||||
, Word16
|
||||
@@ -345,8 +527,8 @@ import Data.Word as X (
|
||||
#endif
|
||||
)
|
||||
|
||||
import Data.Either as X (
|
||||
Either(..)
|
||||
import Data.Either as Either (
|
||||
Either(Left,Right)
|
||||
, either
|
||||
, lefts
|
||||
, rights
|
||||
@@ -357,8 +539,8 @@ import Data.Either as X (
|
||||
#endif
|
||||
)
|
||||
|
||||
import Data.Complex as X (
|
||||
Complex(..)
|
||||
import Data.Complex as Complex (
|
||||
Complex((:+))
|
||||
, realPart
|
||||
, imagPart
|
||||
, mkPolar
|
||||
@@ -368,11 +550,47 @@ import Data.Complex as X (
|
||||
, phase
|
||||
, conjugate
|
||||
)
|
||||
import Data.Char as X (chr)
|
||||
import Data.Bool as X hiding (bool)
|
||||
import Data.Maybe as X hiding (fromJust)
|
||||
import Data.Char as Char (
|
||||
Char
|
||||
, ord
|
||||
, chr
|
||||
, digitToInt
|
||||
, intToDigit
|
||||
, toUpper
|
||||
, toLower
|
||||
, toTitle
|
||||
, isAscii
|
||||
, isLetter
|
||||
, isDigit
|
||||
, isHexDigit
|
||||
, isPrint
|
||||
, isAlpha
|
||||
, isAlphaNum
|
||||
, isUpper
|
||||
, isLower
|
||||
, isSpace
|
||||
, isControl
|
||||
)
|
||||
import Data.Bool as Bool (
|
||||
Bool(True, False),
|
||||
(&&),
|
||||
(||),
|
||||
not,
|
||||
otherwise
|
||||
)
|
||||
import Data.Maybe as Maybe (
|
||||
Maybe(Nothing, Just)
|
||||
, maybe
|
||||
, isJust
|
||||
, isNothing
|
||||
, fromMaybe
|
||||
, listToMaybe
|
||||
, maybeToList
|
||||
, catMaybes
|
||||
, mapMaybe
|
||||
)
|
||||
|
||||
import Data.Function as X (
|
||||
import Data.Function as Function (
|
||||
const
|
||||
, (.)
|
||||
, ($)
|
||||
@@ -385,7 +603,7 @@ import Data.Function as X (
|
||||
)
|
||||
|
||||
-- Genericss
|
||||
import GHC.Generics as X (
|
||||
import GHC.Generics as Generics (
|
||||
Generic(..)
|
||||
, Generic1
|
||||
, Rep
|
||||
@@ -414,10 +632,10 @@ import GHC.Generics as X (
|
||||
|
||||
-- ByteString
|
||||
import qualified Data.ByteString.Lazy
|
||||
import Data.ByteString as X (ByteString)
|
||||
import Data.ByteString as ByteString (ByteString)
|
||||
|
||||
-- Text
|
||||
import Data.Text as X (
|
||||
import Data.Text as Text (
|
||||
Text
|
||||
, lines
|
||||
, words
|
||||
@@ -426,7 +644,7 @@ import Data.Text as X (
|
||||
)
|
||||
import qualified Data.Text.Lazy
|
||||
|
||||
import Data.Text.IO as X (
|
||||
import Data.Text.IO as Text (
|
||||
getLine
|
||||
, getContents
|
||||
, interact
|
||||
@@ -435,19 +653,19 @@ import Data.Text.IO as X (
|
||||
, appendFile
|
||||
)
|
||||
|
||||
import Data.Text.Lazy as X (
|
||||
import Data.Text.Lazy as Text (
|
||||
toStrict
|
||||
, fromStrict
|
||||
)
|
||||
|
||||
import Data.Text.Encoding as X (
|
||||
import Data.Text.Encoding as Text (
|
||||
encodeUtf8
|
||||
, decodeUtf8
|
||||
, decodeUtf8'
|
||||
, decodeUtf8With
|
||||
)
|
||||
|
||||
import Data.Text.Encoding.Error as X (
|
||||
import Data.Text.Encoding.Error as Text (
|
||||
OnDecodeError
|
||||
, OnError
|
||||
, UnicodeException
|
||||
@@ -458,15 +676,15 @@ import Data.Text.Encoding.Error as X (
|
||||
)
|
||||
|
||||
-- IO
|
||||
import System.Environment as X (getArgs)
|
||||
import System.Environment as System (getArgs)
|
||||
import qualified System.Exit
|
||||
import System.Exit as X (
|
||||
import System.Exit as System (
|
||||
ExitCode(..)
|
||||
, exitWith
|
||||
, exitFailure
|
||||
, exitSuccess
|
||||
)
|
||||
import System.IO as X (
|
||||
import System.IO as System (
|
||||
Handle
|
||||
, FilePath
|
||||
, IOMode(..)
|
||||
@@ -478,24 +696,92 @@ import System.IO as X (
|
||||
)
|
||||
|
||||
-- ST
|
||||
import Control.Monad.ST as X (
|
||||
import Control.Monad.ST as ST (
|
||||
ST
|
||||
, runST
|
||||
, fixST
|
||||
)
|
||||
|
||||
-- Concurrency and Parallelism
|
||||
import Control.Exception as X hiding (
|
||||
throw -- Impure throw is forbidden.
|
||||
, throwIO
|
||||
, throwTo
|
||||
, assert
|
||||
, Handler(..)
|
||||
import Control.Exception as Exception (
|
||||
Exception,
|
||||
toException,
|
||||
fromException,
|
||||
#if MIN_VERSION_base(4,8,0)
|
||||
displayException,
|
||||
#endif
|
||||
SomeException(SomeException)
|
||||
, IOException
|
||||
, ArithException(
|
||||
Overflow,
|
||||
Underflow,
|
||||
LossOfPrecision,
|
||||
DivideByZero,
|
||||
Denormal,
|
||||
RatioZeroDenominator
|
||||
)
|
||||
, ArrayException(IndexOutOfBounds, UndefinedElement)
|
||||
, AssertionFailed(AssertionFailed)
|
||||
#if MIN_VERSION_base(4,7,0)
|
||||
, SomeAsyncException(SomeAsyncException)
|
||||
, asyncExceptionToException
|
||||
, asyncExceptionFromException
|
||||
#endif
|
||||
, AsyncException(StackOverflow, HeapOverflow, ThreadKilled, UserInterrupt)
|
||||
, NonTermination(NonTermination)
|
||||
, NestedAtomically(NestedAtomically)
|
||||
, BlockedIndefinitelyOnMVar(BlockedIndefinitelyOnMVar)
|
||||
, BlockedIndefinitelyOnSTM(BlockedIndefinitelyOnSTM)
|
||||
#if MIN_VERSION_base(4,8,0)
|
||||
, AllocationLimitExceeded(AllocationLimitExceeded)
|
||||
#endif
|
||||
#if MIN_VERSION_base(4,10,0)
|
||||
, CompactionFailed(CompactionFailed)
|
||||
#endif
|
||||
, Deadlock(Deadlock)
|
||||
, NoMethodError(NoMethodError)
|
||||
, PatternMatchFail(PatternMatchFail)
|
||||
, RecConError(RecConError)
|
||||
, RecSelError(RecSelError)
|
||||
, RecUpdError(RecUpdError)
|
||||
#if MIN_VERSION_base(4,9,0)
|
||||
, ErrorCall(ErrorCall, ErrorCallWithLocation)
|
||||
#else
|
||||
, ErrorCall(ErrorCall)
|
||||
#endif
|
||||
#if MIN_VERSION_base(4,9,0)
|
||||
, TypeError(TypeError)
|
||||
#endif
|
||||
, ioError
|
||||
, catch
|
||||
, catches
|
||||
, Handler(Handler)
|
||||
, catchJust
|
||||
, handle
|
||||
, handleJust
|
||||
, try
|
||||
, tryJust
|
||||
, evaluate
|
||||
, mapException
|
||||
, mask
|
||||
, mask_
|
||||
, uninterruptibleMask
|
||||
, uninterruptibleMask_
|
||||
, MaskingState(..)
|
||||
, getMaskingState
|
||||
#if MIN_VERSION_base(4,9,0)
|
||||
, interruptible
|
||||
#endif
|
||||
, allowInterrupt
|
||||
, bracket
|
||||
, bracket_
|
||||
, bracketOnError
|
||||
, finally
|
||||
, onException
|
||||
)
|
||||
import qualified Control.Exception as PException
|
||||
|
||||
import qualified Control.Exception
|
||||
|
||||
import Control.Monad.STM as X (
|
||||
import Control.Monad.STM as STM (
|
||||
STM
|
||||
, atomically
|
||||
#if !(MIN_VERSION_stm(2,5,0))
|
||||
@@ -508,11 +794,84 @@ import Control.Monad.STM as X (
|
||||
, throwSTM
|
||||
, catchSTM
|
||||
)
|
||||
import Control.Concurrent as X hiding (
|
||||
throwTo
|
||||
, yield
|
||||
|
||||
import Control.Concurrent.MVar as Concurrency (
|
||||
MVar
|
||||
, newEmptyMVar
|
||||
, newMVar
|
||||
, takeMVar
|
||||
, putMVar
|
||||
, readMVar
|
||||
, swapMVar
|
||||
, tryTakeMVar
|
||||
, tryPutMVar
|
||||
, isEmptyMVar
|
||||
, withMVar
|
||||
#if MIN_VERSION_base(4,7,0)
|
||||
, withMVarMasked
|
||||
#endif
|
||||
, modifyMVar_
|
||||
, modifyMVar
|
||||
, modifyMVarMasked_
|
||||
, modifyMVarMasked
|
||||
#if MIN_VERSION_base(4,7,0)
|
||||
, tryReadMVar
|
||||
, mkWeakMVar
|
||||
#endif
|
||||
, addMVarFinalizer
|
||||
)
|
||||
import Control.Concurrent.Async as X (
|
||||
import Control.Concurrent.Chan as Concurrency (
|
||||
Chan
|
||||
, newChan
|
||||
, writeChan
|
||||
, readChan
|
||||
, dupChan
|
||||
, getChanContents
|
||||
, writeList2Chan
|
||||
)
|
||||
import Control.Concurrent.QSem as Concurrency (
|
||||
QSem
|
||||
, newQSem
|
||||
, waitQSem
|
||||
, signalQSem
|
||||
)
|
||||
import Control.Concurrent.QSemN as Concurrency (
|
||||
QSemN
|
||||
, newQSemN
|
||||
, waitQSemN
|
||||
, signalQSemN
|
||||
)
|
||||
import Control.Concurrent as Concurrency (
|
||||
ThreadId
|
||||
, forkIO
|
||||
, forkFinally
|
||||
, forkIOWithUnmask
|
||||
, killThread
|
||||
, forkOn
|
||||
, forkOnWithUnmask
|
||||
, getNumCapabilities
|
||||
, setNumCapabilities
|
||||
, threadCapability
|
||||
, yield
|
||||
, threadDelay
|
||||
, threadWaitRead
|
||||
, threadWaitWrite
|
||||
#if MIN_VERSION_base(4,7,0)
|
||||
, threadWaitReadSTM
|
||||
, threadWaitWriteSTM
|
||||
#endif
|
||||
, rtsSupportsBoundThreads
|
||||
, forkOS
|
||||
#if MIN_VERSION_base(4,9,0)
|
||||
, forkOSWithUnmask
|
||||
#endif
|
||||
, isCurrentThreadBound
|
||||
, runInBoundThread
|
||||
, runInUnboundThread
|
||||
, mkWeakThreadId
|
||||
, myThreadId
|
||||
)
|
||||
import Control.Concurrent.Async as Concurrency (
|
||||
Async(..)
|
||||
, Concurrently(..)
|
||||
, async
|
||||
@@ -544,12 +903,12 @@ import Control.Concurrent.Async as X (
|
||||
, concurrently
|
||||
)
|
||||
|
||||
import Foreign.Ptr as X (IntPtr, WordPtr)
|
||||
import Foreign.Storable as X (Storable)
|
||||
import Foreign.StablePtr as X (StablePtr)
|
||||
import Foreign.Ptr as Foreign (IntPtr, WordPtr)
|
||||
import Foreign.Storable as Foreign (Storable)
|
||||
import Foreign.StablePtr as Foreign (StablePtr)
|
||||
|
||||
-- Read instances hiding unsafe builtins (read)
|
||||
import Text.Read as X (
|
||||
import Text.Read as Read (
|
||||
Read
|
||||
, reads
|
||||
, readMaybe
|
||||
@@ -568,44 +927,52 @@ infixl 1 &
|
||||
x & f = f x
|
||||
#endif
|
||||
|
||||
-- | The identity function, returns the give value unchanged.
|
||||
identity :: a -> a
|
||||
identity x = x
|
||||
|
||||
map :: Functor f => (a -> b) -> f a -> f b
|
||||
map = fmap
|
||||
map :: Functor.Functor f => (a -> b) -> f a -> f b
|
||||
map = Functor.fmap
|
||||
|
||||
uncons :: [a] -> Maybe (a, [a])
|
||||
uncons [] = Nothing
|
||||
uncons (x:xs) = Just (x, xs)
|
||||
|
||||
unsnoc :: [x] -> Maybe ([x],x)
|
||||
unsnoc = foldr go Nothing
|
||||
unsnoc = Foldable.foldr go Nothing
|
||||
where
|
||||
go x mxs = Just (case mxs of
|
||||
Nothing -> ([], x)
|
||||
Just (xs, e) -> (x:xs, e))
|
||||
|
||||
-- | Apply a function n times to a given value
|
||||
applyN :: Int -> (a -> a) -> a -> a
|
||||
applyN n f = X.foldr (.) identity (X.replicate n f)
|
||||
applyN n f = Foldable.foldr (.) identity (List.replicate n f)
|
||||
|
||||
print :: (X.MonadIO m, PBase.Show a) => a -> m ()
|
||||
-- | 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.
|
||||
print :: (Trans.MonadIO m, PBase.Show a) => a -> m ()
|
||||
print = liftIO . PBase.print
|
||||
|
||||
throwIO :: (X.MonadIO m, Exception e) => e -> m a
|
||||
throwIO = liftIO . Control.Exception.throwIO
|
||||
-- | Lifted throwIO
|
||||
throwIO :: (Trans.MonadIO m, Exception e) => e -> m a
|
||||
throwIO = liftIO . PException.throwIO
|
||||
|
||||
throwTo :: (X.MonadIO m, Exception e) => ThreadId -> e -> m ()
|
||||
throwTo tid e = liftIO (Control.Exception.throwTo tid e)
|
||||
-- | Lifted throwTo
|
||||
throwTo :: (Trans.MonadIO m, Exception e) => ThreadId -> e -> m ()
|
||||
throwTo tid e = liftIO (PException.throwTo tid e)
|
||||
|
||||
-- | Do nothing returning unit inside applicative.
|
||||
pass :: Applicative f => f ()
|
||||
pass = pure ()
|
||||
|
||||
guarded :: (Alternative f) => (a -> Bool) -> a -> f a
|
||||
guarded p x = X.bool empty (pure x) (p x)
|
||||
guarded p x = Bool.bool empty (pure x) (p x)
|
||||
|
||||
guardedA :: (Functor f, Alternative t) => (a -> f Bool) -> a -> f (t a)
|
||||
guardedA p x = X.bool empty (pure x) <$> p x
|
||||
guardedA :: (Functor.Functor f, Alternative t) => (a -> f Bool) -> a -> f (t a)
|
||||
guardedA p x = Bool.bool empty (pure x) `Functor.fmap` p x
|
||||
|
||||
-- | Lift an 'IO' operation with 1 argument into another monad
|
||||
liftIO1 :: MonadIO m => (a -> IO b) -> a -> m b
|
||||
@@ -615,18 +982,18 @@ liftIO1 = (.) liftIO
|
||||
liftIO2 :: MonadIO m => (a -> b -> IO c) -> a -> b -> m c
|
||||
liftIO2 = ((.).(.)) liftIO
|
||||
|
||||
show :: (Show a, StringConv String b) => a -> b
|
||||
show x = toS (PBase.show x)
|
||||
show :: (Show a, ConvertText String b) => a -> b
|
||||
show x = ConvertText.toS (PBase.show x)
|
||||
{-# SPECIALIZE show :: Show a => a -> Text #-}
|
||||
{-# SPECIALIZE show :: Show a => a -> LText #-}
|
||||
{-# SPECIALIZE show :: Show a => a -> ByteString #-}
|
||||
{-# SPECIALIZE show :: Show a => a -> LByteString #-}
|
||||
{-# SPECIALIZE show :: Show a => a -> String #-}
|
||||
|
||||
#if MIN_VERSION_base(4,8,0)
|
||||
-- | Terminate main process with failure
|
||||
die :: Text -> IO a
|
||||
die err = System.Exit.die (toS err)
|
||||
die err = System.Exit.die (ConvertText.toS err)
|
||||
#else
|
||||
-- | Terminate main process with failure
|
||||
die :: Text -> IO a
|
||||
die err = hPutStrLn stderr err >> exitFailure
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user