{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude #-}
module GHC.IO.Device (
RawIO(..),
IODevice(..),
IODeviceType(..),
SeekMode(..)
) where
import GHC.Base
import GHC.Word
import GHC.Arr
import GHC.Enum
import GHC.Read
import GHC.Show
import GHC.Ptr
import GHC.Num
import GHC.IO
import {-# SOURCE #-} GHC.IO.Exception ( unsupportedOperation )
class RawIO a where
read :: a -> Ptr Word8 -> Word64 -> Int -> IO Int
readNonBlocking :: a -> Ptr Word8 -> Word64 -> Int -> IO (Maybe Int)
write :: a -> Ptr Word8 -> Word64 -> Int -> IO ()
writeNonBlocking :: a -> Ptr Word8 -> Word64 -> Int -> IO Int
class IODevice a where
ready :: a -> Bool -> Int -> IO Bool
close :: a -> IO ()
isTerminal :: a -> IO Bool
isTerminal a
_ = Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
False
isSeekable :: a -> IO Bool
isSeekable a
_ = Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
False
seek :: a -> SeekMode -> Integer -> IO Integer
seek a
_ SeekMode
_ Integer
_ = IO Integer
forall a. IO a
ioe_unsupportedOperation
tell :: a -> IO Integer
tell a
_ = IO Integer
forall a. IO a
ioe_unsupportedOperation
getSize :: a -> IO Integer
getSize a
_ = IO Integer
forall a. IO a
ioe_unsupportedOperation
setSize :: a -> Integer -> IO ()
setSize a
_ Integer
_ = IO ()
forall a. IO a
ioe_unsupportedOperation
setEcho :: a -> Bool -> IO ()
setEcho a
_ Bool
_ = IO ()
forall a. IO a
ioe_unsupportedOperation
getEcho :: a -> IO Bool
getEcho a
_ = IO Bool
forall a. IO a
ioe_unsupportedOperation
setRaw :: a -> Bool -> IO ()
setRaw a
_ Bool
_ = IO ()
forall a. IO a
ioe_unsupportedOperation
devType :: a -> IO IODeviceType
dup :: a -> IO a
dup a
_ = IO a
forall a. IO a
ioe_unsupportedOperation
dup2 :: a -> a -> IO a
dup2 a
_ a
_ = IO a
forall a. IO a
ioe_unsupportedOperation
ioe_unsupportedOperation :: IO a
ioe_unsupportedOperation :: forall a. IO a
ioe_unsupportedOperation = IOError -> IO a
forall e a. Exception e => e -> IO a
throwIO IOError
unsupportedOperation
data IODeviceType
= Directory
| Stream
| RegularFile
| RawDevice
deriving ( IODeviceType -> IODeviceType -> Bool
(IODeviceType -> IODeviceType -> Bool)
-> (IODeviceType -> IODeviceType -> Bool) -> Eq IODeviceType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: IODeviceType -> IODeviceType -> Bool
== :: IODeviceType -> IODeviceType -> Bool
$c/= :: IODeviceType -> IODeviceType -> Bool
/= :: IODeviceType -> IODeviceType -> Bool
Eq
)
data SeekMode
= AbsoluteSeek
| RelativeSeek
| SeekFromEnd
deriving ( SeekMode -> SeekMode -> Bool
(SeekMode -> SeekMode -> Bool)
-> (SeekMode -> SeekMode -> Bool) -> Eq SeekMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SeekMode -> SeekMode -> Bool
== :: SeekMode -> SeekMode -> Bool
$c/= :: SeekMode -> SeekMode -> Bool
/= :: SeekMode -> SeekMode -> Bool
Eq
, Eq SeekMode
Eq SeekMode
-> (SeekMode -> SeekMode -> Ordering)
-> (SeekMode -> SeekMode -> Bool)
-> (SeekMode -> SeekMode -> Bool)
-> (SeekMode -> SeekMode -> Bool)
-> (SeekMode -> SeekMode -> Bool)
-> (SeekMode -> SeekMode -> SeekMode)
-> (SeekMode -> SeekMode -> SeekMode)
-> Ord SeekMode
SeekMode -> SeekMode -> Bool
SeekMode -> SeekMode -> Ordering
SeekMode -> SeekMode -> SeekMode
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: SeekMode -> SeekMode -> Ordering
compare :: SeekMode -> SeekMode -> Ordering
$c< :: SeekMode -> SeekMode -> Bool
< :: SeekMode -> SeekMode -> Bool
$c<= :: SeekMode -> SeekMode -> Bool
<= :: SeekMode -> SeekMode -> Bool
$c> :: SeekMode -> SeekMode -> Bool
> :: SeekMode -> SeekMode -> Bool
$c>= :: SeekMode -> SeekMode -> Bool
>= :: SeekMode -> SeekMode -> Bool
$cmax :: SeekMode -> SeekMode -> SeekMode
max :: SeekMode -> SeekMode -> SeekMode
$cmin :: SeekMode -> SeekMode -> SeekMode
min :: SeekMode -> SeekMode -> SeekMode
Ord
, Ord SeekMode
Ord SeekMode
-> ((SeekMode, SeekMode) -> [SeekMode])
-> ((SeekMode, SeekMode) -> SeekMode -> Int)
-> ((SeekMode, SeekMode) -> SeekMode -> Int)
-> ((SeekMode, SeekMode) -> SeekMode -> Bool)
-> ((SeekMode, SeekMode) -> Int)
-> ((SeekMode, SeekMode) -> Int)
-> Ix SeekMode
(SeekMode, SeekMode) -> Int
(SeekMode, SeekMode) -> [SeekMode]
(SeekMode, SeekMode) -> SeekMode -> Bool
(SeekMode, SeekMode) -> SeekMode -> Int
forall a.
Ord a
-> ((a, a) -> [a])
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Bool)
-> ((a, a) -> Int)
-> ((a, a) -> Int)
-> Ix a
$crange :: (SeekMode, SeekMode) -> [SeekMode]
range :: (SeekMode, SeekMode) -> [SeekMode]
$cindex :: (SeekMode, SeekMode) -> SeekMode -> Int
index :: (SeekMode, SeekMode) -> SeekMode -> Int
$cunsafeIndex :: (SeekMode, SeekMode) -> SeekMode -> Int
unsafeIndex :: (SeekMode, SeekMode) -> SeekMode -> Int
$cinRange :: (SeekMode, SeekMode) -> SeekMode -> Bool
inRange :: (SeekMode, SeekMode) -> SeekMode -> Bool
$crangeSize :: (SeekMode, SeekMode) -> Int
rangeSize :: (SeekMode, SeekMode) -> Int
$cunsafeRangeSize :: (SeekMode, SeekMode) -> Int
unsafeRangeSize :: (SeekMode, SeekMode) -> Int
Ix
, Int -> SeekMode
SeekMode -> Int
SeekMode -> [SeekMode]
SeekMode -> SeekMode
SeekMode -> SeekMode -> [SeekMode]
SeekMode -> SeekMode -> SeekMode -> [SeekMode]
(SeekMode -> SeekMode)
-> (SeekMode -> SeekMode)
-> (Int -> SeekMode)
-> (SeekMode -> Int)
-> (SeekMode -> [SeekMode])
-> (SeekMode -> SeekMode -> [SeekMode])
-> (SeekMode -> SeekMode -> [SeekMode])
-> (SeekMode -> SeekMode -> SeekMode -> [SeekMode])
-> Enum SeekMode
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: SeekMode -> SeekMode
succ :: SeekMode -> SeekMode
$cpred :: SeekMode -> SeekMode
pred :: SeekMode -> SeekMode
$ctoEnum :: Int -> SeekMode
toEnum :: Int -> SeekMode
$cfromEnum :: SeekMode -> Int
fromEnum :: SeekMode -> Int
$cenumFrom :: SeekMode -> [SeekMode]
enumFrom :: SeekMode -> [SeekMode]
$cenumFromThen :: SeekMode -> SeekMode -> [SeekMode]
enumFromThen :: SeekMode -> SeekMode -> [SeekMode]
$cenumFromTo :: SeekMode -> SeekMode -> [SeekMode]
enumFromTo :: SeekMode -> SeekMode -> [SeekMode]
$cenumFromThenTo :: SeekMode -> SeekMode -> SeekMode -> [SeekMode]
enumFromThenTo :: SeekMode -> SeekMode -> SeekMode -> [SeekMode]
Enum
, ReadPrec [SeekMode]
ReadPrec SeekMode
Int -> ReadS SeekMode
ReadS [SeekMode]
(Int -> ReadS SeekMode)
-> ReadS [SeekMode]
-> ReadPrec SeekMode
-> ReadPrec [SeekMode]
-> Read SeekMode
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS SeekMode
readsPrec :: Int -> ReadS SeekMode
$creadList :: ReadS [SeekMode]
readList :: ReadS [SeekMode]
$creadPrec :: ReadPrec SeekMode
readPrec :: ReadPrec SeekMode
$creadListPrec :: ReadPrec [SeekMode]
readListPrec :: ReadPrec [SeekMode]
Read
, Int -> SeekMode -> ShowS
[SeekMode] -> ShowS
SeekMode -> String
(Int -> SeekMode -> ShowS)
-> (SeekMode -> String) -> ([SeekMode] -> ShowS) -> Show SeekMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SeekMode -> ShowS
showsPrec :: Int -> SeekMode -> ShowS
$cshow :: SeekMode -> String
show :: SeekMode -> String
$cshowList :: [SeekMode] -> ShowS
showList :: [SeekMode] -> ShowS
Show
)