{-# LANGUAGE CPP #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
module ClassyPrelude
(
module CorePrelude
, undefined
, (++)
, Semigroup (..)
, WrappedMonoid
, module Data.Functor
, module Control.Applicative
, (<&&>)
, (<||>)
, module Control.Monad
, whenM
, unlessM
, module UnliftIO
, orElseSTM
, module Data.Mutable
, module Control.Concurrent.STM.TBChan
, module Control.Concurrent.STM.TBMChan
, module Control.Concurrent.STM.TBMQueue
, module Control.Concurrent.STM.TMChan
, module Control.Concurrent.STM.TMQueue
, primToPrim
, primToIO
, primToST
, module Data.Primitive.MutVar
, trace
, traceShow
, traceId
, traceM
, traceShowId
, traceShowM
, module Data.Time
#if MIN_VERSION_time(1,10,0)
, parseTime
#endif
, Generic
, Identity (..)
, MonadReader
, ask
, asks
, ReaderT (..)
, Reader
, module Data.Foldable
, module Data.Traversable
, module Data.Bifunctor
, module Data.MonoTraversable
, module Data.MonoTraversable.Unprefixed
, module Data.Sequences
, module Data.Containers
, module Data.Builder
, module Data.NonNull
, toByteVector
, fromByteVector
, module Say
, yieldThread
, waitAsync
, pollAsync
, waitCatchAsync
, linkAsync
, link2Async
, map
, readMay
, zip, zip3, zip4, zip5, zip6, zip7
, unzip, unzip3, unzip4, unzip5, unzip6, unzip7
, zipWith, zipWith3, zipWith4, zipWith5, zipWith6, zipWith7
, hashNub
, ordNub
, ordNubBy
, sortWith
, Prelude.repeat
, (\\)
, intersect
, Show (..)
, tshow
, tlshow
, charToLower
, charToUpper
, readFile
, readFileUtf8
, writeFile
, writeFileUtf8
, hGetContents
, hPut
, hGetChunk
, print
, putChar
, putStr
, putStrLn
, getChar
, getLine
, getContents
, interact
, DList
, asDList
, applyDList
, module Control.DeepSeq
, asByteString
, asLByteString
, asHashMap
, asHashSet
, asText
, asLText
, asList
, asMap
, asIntMap
, asMaybe
, asSet
, asIntSet
, asVector
, asUVector
, asSVector
, asString
) where
import qualified Prelude
import Control.Applicative ((<**>),liftA,liftA2,liftA3,Alternative (..), optional)
import Data.Functor hiding (unzip)
import Control.Exception (assert)
import Control.DeepSeq (deepseq, ($!!), force, NFData (..))
import Control.Monad (when, unless, void, liftM, ap, forever, join, replicateM_, guard, MonadPlus (..), (=<<), (>=>), (<=<), liftM2, liftM3, liftM4, liftM5)
import qualified Control.Concurrent.STM as STM
import Data.Mutable
import Data.Traversable (Traversable (..), for, forM)
import Data.Foldable (Foldable)
import UnliftIO
import Data.Vector.Instances ()
import CorePrelude hiding
( putStr, putStrLn, print, undefined, (<>), catMaybes, first, second
, catchIOError
)
import Data.ChunkedZip
import qualified Data.Char as Char
import Data.Sequences
import Data.MonoTraversable
import Data.MonoTraversable.Unprefixed
import Data.MonoTraversable.Instances ()
import Data.Containers
import Data.Builder
import Data.NonNull
import qualified Data.ByteString
import qualified Data.Text.IO as TextIO
import qualified Data.Text.Lazy.IO as LTextIO
import Data.ByteString.Internal (ByteString (PS))
import Data.ByteString.Lazy.Internal (defaultChunkSize)
import Data.Vector.Storable (unsafeToForeignPtr, unsafeFromForeignPtr)
import qualified Debug.Trace as Trace
import Data.Semigroup (Semigroup (..), WrappedMonoid (..))
import Prelude (Show (..))
import Data.Time
( UTCTime (..)
, Day (..)
, toGregorian
, fromGregorian
, formatTime
#if !MIN_VERSION_time(1,10,0)
, parseTime
#endif
, parseTimeM
, getCurrentTime
, defaultTimeLocale
)
import qualified Data.Time as Time
import qualified Data.Set as Set
import qualified Data.Map as Map
import qualified Data.HashSet as HashSet
import GHC.Generics (Generic)
import GHC.Stack (HasCallStack)
import Control.Monad.Primitive (primToPrim, primToIO, primToST)
import Data.Primitive.MutVar
import Data.Functor.Identity (Identity (..))
import Control.Monad.Reader (MonadReader, ask, asks, ReaderT (..), Reader)
import Data.Bifunctor
import Data.DList (DList)
import qualified Data.DList as DList
import Say
import Control.Concurrent.STM.TBChan
import Control.Concurrent.STM.TBMChan
import Control.Concurrent.STM.TBMQueue
import Control.Concurrent.STM.TMChan
import Control.Concurrent.STM.TMQueue
import qualified Control.Concurrent
tshow :: Show a => a -> Text
tshow :: forall a. Show a => a -> Text
tshow = forall seq. IsSequence seq => [Element seq] -> seq
fromList forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall a. Show a => a -> String
Prelude.show
tlshow :: Show a => a -> LText
tlshow :: forall a. Show a => a -> LText
tlshow = forall seq. IsSequence seq => [Element seq] -> seq
fromList forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall a. Show a => a -> String
Prelude.show
charToLower :: Char -> Char
charToLower :: Char -> Char
charToLower = Char -> Char
Char.toLower
charToUpper :: Char -> Char
charToUpper :: Char -> Char
charToUpper = Char -> Char
Char.toUpper
readMay :: (Element c ~ Char, MonoFoldable c, Read a) => c -> Maybe a
readMay :: forall c a.
(Element c ~ Char, MonoFoldable c, Read a) =>
c -> Maybe a
readMay c
a =
case [a
x | (a
x, String
t) <- forall a. Read a => ReadS a
Prelude.reads (forall mono. MonoFoldable mono => mono -> [Element mono]
otoList c
a :: String), forall mono. MonoFoldable mono => mono -> Bool
onull String
t] of
[a
x] -> forall a. a -> Maybe a
Just a
x
[a]
_ -> forall a. Maybe a
Nothing
map :: Functor f => (a -> b) -> f a -> f b
map :: forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
map = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap
infixr 5 ++
(++) :: Monoid m => m -> m -> m
++ :: forall m. Monoid m => m -> m -> m
(++) = forall m. Monoid m => m -> m -> m
mappend
{-# INLINE (++) #-}
infixl 9 \\
(\\) :: SetContainer a => a -> a -> a
\\ :: forall a. SetContainer a => a -> a -> a
(\\) = forall a. SetContainer a => a -> a -> a
difference
{-# INLINE (\\) #-}
intersect :: SetContainer a => a -> a -> a
intersect :: forall a. SetContainer a => a -> a -> a
intersect = forall a. SetContainer a => a -> a -> a
intersection
{-# INLINE intersect #-}
asByteString :: ByteString -> ByteString
asByteString :: ByteString -> ByteString
asByteString = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
asLByteString :: LByteString -> LByteString
asLByteString :: LByteString -> LByteString
asLByteString = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
asHashMap :: HashMap k v -> HashMap k v
asHashMap :: forall k v. HashMap k v -> HashMap k v
asHashMap = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
asHashSet :: HashSet a -> HashSet a
asHashSet :: forall a. HashSet a -> HashSet a
asHashSet = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
asText :: Text -> Text
asText :: Text -> Text
asText = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
asLText :: LText -> LText
asLText :: LText -> LText
asLText = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
asList :: [a] -> [a]
asList :: forall a. [a] -> [a]
asList = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
asMap :: Map k v -> Map k v
asMap :: forall k v. Map k v -> Map k v
asMap = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
asIntMap :: IntMap v -> IntMap v
asIntMap :: forall v. IntMap v -> IntMap v
asIntMap = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
asMaybe :: Maybe a -> Maybe a
asMaybe :: forall a. Maybe a -> Maybe a
asMaybe = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
asSet :: Set a -> Set a
asSet :: forall a. Set a -> Set a
asSet = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
asIntSet :: IntSet -> IntSet
asIntSet :: IntSet -> IntSet
asIntSet = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
asVector :: Vector a -> Vector a
asVector :: forall a. Vector a -> Vector a
asVector = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
asUVector :: UVector a -> UVector a
asUVector :: forall a. UVector a -> UVector a
asUVector = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
asSVector :: SVector a -> SVector a
asSVector :: forall a. SVector a -> SVector a
asSVector = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
asString :: [Char] -> [Char]
asString :: String -> String
asString = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
print :: (Show a, MonadIO m) => a -> m ()
print :: forall a (m :: * -> *). (Show a, MonadIO m) => a -> m ()
print = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall a. Show a => a -> IO ()
Prelude.print
sortWith :: (Ord a, IsSequence c) => (Element c -> a) -> c -> c
sortWith :: forall a c. (Ord a, IsSequence c) => (Element c -> a) -> c -> c
sortWith Element c -> a
f = forall seq.
SemiSequence seq =>
(Element seq -> Element seq -> Ordering) -> seq -> seq
sortBy forall a b. (a -> b) -> a -> b
$ forall a b. Ord a => (b -> a) -> b -> b -> Ordering
comparing Element c -> a
f
undefined :: HasCallStack => a
undefined :: forall a. HasCallStack => a
undefined = forall a. HasCallStack => String -> a
error String
"ClassyPrelude.undefined"
{-# DEPRECATED undefined "It is highly recommended that you either avoid partial functions or provide meaningful error messages" #-}
{-# WARNING trace "Leaving traces in the code" #-}
trace :: String -> a -> a
trace :: forall a. String -> a -> a
trace = forall a. String -> a -> a
Trace.trace
{-# WARNING traceShow "Leaving traces in the code" #-}
traceShow :: Show a => a -> b -> b
traceShow :: forall a b. Show a => a -> b -> b
traceShow = forall a b. Show a => a -> b -> b
Trace.traceShow
{-# WARNING traceId "Leaving traces in the code" #-}
traceId :: String -> String
traceId :: String -> String
traceId String
a = forall a. String -> a -> a
Trace.trace String
a String
a
{-# WARNING traceM "Leaving traces in the code" #-}
traceM :: (Monad m) => String -> m ()
traceM :: forall (m :: * -> *). Monad m => String -> m ()
traceM String
string = forall a. String -> a -> a
Trace.trace String
string forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. Monad m => a -> m a
return ()
{-# WARNING traceShowId "Leaving traces in the code" #-}
traceShowId :: (Show a) => a -> a
traceShowId :: forall a. Show a => a -> a
traceShowId a
a = forall a. String -> a -> a
Trace.trace (forall a. Show a => a -> String
show a
a) a
a
{-# WARNING traceShowM "Leaving traces in the code" #-}
traceShowM :: (Show a, Monad m) => a -> m ()
traceShowM :: forall a (m :: * -> *). (Show a, Monad m) => a -> m ()
traceShowM = forall (m :: * -> *). Monad m => String -> m ()
traceM forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall a. Show a => a -> String
show
yieldThread :: MonadIO m => m ()
yieldThread :: forall (m :: * -> *). MonadIO m => m ()
yieldThread = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO ()
Control.Concurrent.yield
{-# INLINE yieldThread #-}
hashNub :: (Hashable a, Eq a) => [a] -> [a]
hashNub :: forall a. (Hashable a, Eq a) => [a] -> [a]
hashNub = forall {a}. Hashable a => HashSet a -> [a] -> [a]
go forall a. HashSet a
HashSet.empty
where
go :: HashSet a -> [a] -> [a]
go HashSet a
_ [] = []
go HashSet a
s (a
x:[a]
xs) | a
x forall a. (Eq a, Hashable a) => a -> HashSet a -> Bool
`HashSet.member` HashSet a
s = HashSet a -> [a] -> [a]
go HashSet a
s [a]
xs
| Bool
otherwise = a
x forall a. a -> [a] -> [a]
: HashSet a -> [a] -> [a]
go (forall a. (Eq a, Hashable a) => a -> HashSet a -> HashSet a
HashSet.insert a
x HashSet a
s) [a]
xs
ordNub :: (Ord a) => [a] -> [a]
ordNub :: forall a. Ord a => [a] -> [a]
ordNub = forall {a}. Ord a => Set a -> [a] -> [a]
go forall a. Set a
Set.empty
where
go :: Set a -> [a] -> [a]
go Set a
_ [] = []
go Set a
s (a
x:[a]
xs) | a
x forall a. Ord a => a -> Set a -> Bool
`Set.member` Set a
s = Set a -> [a] -> [a]
go Set a
s [a]
xs
| Bool
otherwise = a
x forall a. a -> [a] -> [a]
: Set a -> [a] -> [a]
go (forall a. Ord a => a -> Set a -> Set a
Set.insert a
x Set a
s) [a]
xs
ordNubBy :: (Ord b) => (a -> b) -> (a -> a -> Bool) -> [a] -> [a]
ordNubBy :: forall b a. Ord b => (a -> b) -> (a -> a -> Bool) -> [a] -> [a]
ordNubBy a -> b
p a -> a -> Bool
f = Map b [a] -> [a] -> [a]
go forall k a. Map k a
Map.empty
where
go :: Map b [a] -> [a] -> [a]
go Map b [a]
_ [] = []
go Map b [a]
m (a
x:[a]
xs) = let b :: b
b = a -> b
p a
x in case b
b forall k a. Ord k => k -> Map k a -> Maybe a
`Map.lookup` Map b [a]
m of
Maybe [a]
Nothing -> a
x forall a. a -> [a] -> [a]
: Map b [a] -> [a] -> [a]
go (forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert b
b [a
x] Map b [a]
m) [a]
xs
Just [a]
bucket
| forall a. (a -> a -> Bool) -> a -> [a] -> Bool
elem_by a -> a -> Bool
f a
x [a]
bucket -> Map b [a] -> [a] -> [a]
go Map b [a]
m [a]
xs
| Bool
otherwise -> a
x forall a. a -> [a] -> [a]
: Map b [a] -> [a] -> [a]
go (forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert b
b (a
xforall a. a -> [a] -> [a]
:[a]
bucket) Map b [a]
m) [a]
xs
elem_by :: (a -> a -> Bool) -> a -> [a] -> Bool
elem_by :: forall a. (a -> a -> Bool) -> a -> [a] -> Bool
elem_by a -> a -> Bool
_ a
_ [] = Bool
False
elem_by a -> a -> Bool
eq a
y (a
x:[a]
xs) = a
y a -> a -> Bool
`eq` a
x Bool -> Bool -> Bool
|| forall a. (a -> a -> Bool) -> a -> [a] -> Bool
elem_by a -> a -> Bool
eq a
y [a]
xs
orElseSTM :: STM a -> STM a -> STM a
orElseSTM :: forall a. STM a -> STM a -> STM a
orElseSTM = forall a. STM a -> STM a -> STM a
STM.orElse
{-# INLINE orElseSTM #-}
whenM :: Monad m => m Bool -> m () -> m ()
whenM :: forall (m :: * -> *). Monad m => m Bool -> m () -> m ()
whenM m Bool
mbool m ()
action = m Bool
mbool forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall a b c. (a -> b -> c) -> b -> a -> c
flip forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when m ()
action
unlessM :: Monad m => m Bool -> m () -> m ()
unlessM :: forall (m :: * -> *). Monad m => m Bool -> m () -> m ()
unlessM m Bool
mbool m ()
action = m Bool
mbool forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall a b c. (a -> b -> c) -> b -> a -> c
flip forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless m ()
action
asDList :: DList a -> DList a
asDList :: forall a. DList a -> DList a
asDList = forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
{-# INLINE asDList #-}
applyDList :: DList a -> [a] -> [a]
applyDList :: forall a. DList a -> [a] -> [a]
applyDList = forall a. DList a -> [a] -> [a]
DList.apply
{-# INLINE applyDList #-}
infixr 3 <&&>
(<&&>) :: Applicative a => a Bool -> a Bool -> a Bool
<&&> :: forall (a :: * -> *). Applicative a => a Bool -> a Bool -> a Bool
(<&&>) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Bool -> Bool -> Bool
(&&)
{-# INLINE (<&&>) #-}
infixr 2 <||>
(<||>) :: Applicative a => a Bool -> a Bool -> a Bool
<||> :: forall (a :: * -> *). Applicative a => a Bool -> a Bool -> a Bool
(<||>) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Bool -> Bool -> Bool
(||)
{-# INLINE (<||>) #-}
toByteVector :: ByteString -> SVector Word8
toByteVector :: ByteString -> SVector Word8
toByteVector (PS ForeignPtr Word8
fptr Int
offset Int
idx) = forall a. Storable a => ForeignPtr a -> Int -> Int -> Vector a
unsafeFromForeignPtr ForeignPtr Word8
fptr Int
offset Int
idx
{-# INLINE toByteVector #-}
fromByteVector :: SVector Word8 -> ByteString
fromByteVector :: SVector Word8 -> ByteString
fromByteVector SVector Word8
v =
ForeignPtr Word8 -> Int -> Int -> ByteString
PS ForeignPtr Word8
fptr Int
offset Int
idx
where
(ForeignPtr Word8
fptr, Int
offset, Int
idx) = forall a. Vector a -> (ForeignPtr a, Int, Int)
unsafeToForeignPtr SVector Word8
v
{-# INLINE fromByteVector #-}
waitAsync :: MonadIO m => Async a -> m a
waitAsync :: forall (m :: * -> *) a. MonadIO m => Async a -> m a
waitAsync = forall (m :: * -> *) a. MonadIO m => STM a -> m a
atomically forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall a. Async a -> STM a
waitSTM
pollAsync :: MonadIO m => Async a -> m (Maybe (Either SomeException a))
pollAsync :: forall (m :: * -> *) a.
MonadIO m =>
Async a -> m (Maybe (Either SomeException a))
pollAsync = forall (m :: * -> *) a. MonadIO m => STM a -> m a
atomically forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall a. Async a -> STM (Maybe (Either SomeException a))
pollSTM
waitCatchAsync :: MonadIO m => Async a -> m (Either SomeException a)
waitCatchAsync :: forall (m :: * -> *) a.
MonadIO m =>
Async a -> m (Either SomeException a)
waitCatchAsync = forall (m :: * -> *) a.
MonadIO m =>
Async a -> m (Either SomeException a)
waitCatch
linkAsync :: MonadIO m => Async a -> m ()
linkAsync :: forall (m :: * -> *) a. MonadIO m => Async a -> m ()
linkAsync = forall (m :: * -> *) a. MonadIO m => Async a -> m ()
UnliftIO.link
link2Async :: MonadIO m => Async a -> Async b -> m ()
link2Async :: forall (m :: * -> *) a b. MonadIO m => Async a -> Async b -> m ()
link2Async Async a
a = forall (m :: * -> *) a b. MonadIO m => Async a -> Async b -> m ()
UnliftIO.link2 Async a
a
readFile :: MonadIO m => FilePath -> m ByteString
readFile :: forall (m :: * -> *). MonadIO m => String -> m ByteString
readFile = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> IO ByteString
Data.ByteString.readFile
readFileUtf8 :: MonadIO m => FilePath -> m Text
readFileUtf8 :: forall (m :: * -> *). MonadIO m => String -> m Text
readFileUtf8 = forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM forall textual binary. Utf8 textual binary => binary -> textual
decodeUtf8 forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall (m :: * -> *). MonadIO m => String -> m ByteString
readFile
writeFile :: MonadIO m => FilePath -> ByteString -> m ()
writeFile :: forall (m :: * -> *). MonadIO m => String -> ByteString -> m ()
writeFile String
fp = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> ByteString -> IO ()
Data.ByteString.writeFile String
fp
writeFileUtf8 :: MonadIO m => FilePath -> Text -> m ()
writeFileUtf8 :: forall (m :: * -> *). MonadIO m => String -> Text -> m ()
writeFileUtf8 String
fp = forall (m :: * -> *). MonadIO m => String -> ByteString -> m ()
writeFile String
fp forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall textual binary. Utf8 textual binary => textual -> binary
encodeUtf8
hGetContents :: MonadIO m => Handle -> m ByteString
hGetContents :: forall (m :: * -> *). MonadIO m => Handle -> m ByteString
hGetContents = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Handle -> IO ByteString
Data.ByteString.hGetContents
hPut :: MonadIO m => Handle -> ByteString -> m ()
hPut :: forall (m :: * -> *). MonadIO m => Handle -> ByteString -> m ()
hPut Handle
h = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Handle -> ByteString -> IO ()
Data.ByteString.hPut Handle
h
hGetChunk :: MonadIO m => Handle -> m ByteString
hGetChunk :: forall (m :: * -> *). MonadIO m => Handle -> m ByteString
hGetChunk = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall a b c. (a -> b -> c) -> b -> a -> c
flip Handle -> Int -> IO ByteString
Data.ByteString.hGetSome Int
defaultChunkSize
putChar :: MonadIO m => Char -> m ()
putChar :: forall (m :: * -> *). MonadIO m => Char -> m ()
putChar = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Char -> IO ()
Prelude.putChar
putStr :: MonadIO m => Text -> m ()
putStr :: forall (m :: * -> *). MonadIO m => Text -> m ()
putStr = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Text -> IO ()
TextIO.putStr
putStrLn :: MonadIO m => Text -> m ()
putStrLn :: forall (m :: * -> *). MonadIO m => Text -> m ()
putStrLn = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Text -> IO ()
TextIO.putStrLn
getChar :: MonadIO m => m Char
getChar :: forall (m :: * -> *). MonadIO m => m Char
getChar = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO Char
Prelude.getChar
getLine :: MonadIO m => m Text
getLine :: forall (m :: * -> *). MonadIO m => m Text
getLine = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO Text
TextIO.getLine
getContents :: MonadIO m => m LText
getContents :: forall (m :: * -> *). MonadIO m => m LText
getContents = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO LText
LTextIO.getContents
interact :: MonadIO m => (LText -> LText) -> m ()
interact :: forall (m :: * -> *). MonadIO m => (LText -> LText) -> m ()
interact = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (LText -> LText) -> IO ()
LTextIO.interact
#if MIN_VERSION_time(1,10,0)
parseTime
:: Time.ParseTime t
=> Time.TimeLocale
-> String
-> String
-> Maybe t
parseTime :: forall t. ParseTime t => TimeLocale -> String -> String -> Maybe t
parseTime = forall (m :: * -> *) t.
(MonadFail m, ParseTime t) =>
Bool -> TimeLocale -> String -> String -> m t
parseTimeM Bool
True
#endif