A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://hackage.haskell.org/packages/archive/base/4.6.0.0/doc/html/src/GHC-IO-Device.html below:

GHC/IO/Device.hs


















module GHC.IO.Device (
        RawIO(..),
        IODevice(..),
        IODeviceType(..),
        SeekMode(..)
    ) where  

#ifdef __GLASGOW_HASKELL__
import GHC.Base
import GHC.Word
import GHC.Arr
import GHC.Enum
import GHC.Read
import GHC.Show
import GHC.Ptr
import Data.Maybe
import GHC.Num
import GHC.IO
import  GHC.IO.Exception ( unsupportedOperation )
#endif
#ifdef __NHC__
import Foreign
import Ix
import Control.Exception.Base
unsupportedOperation = userError "unsupported operation"
#endif


class RawIO a where
  
  
  
  
  
  
  read                :: a -> Ptr Word8 -> Int -> IO Int

  
  
  
  readNonBlocking     :: a -> Ptr Word8 -> Int -> IO (Maybe Int)

  
  write               :: a -> Ptr Word8 -> Int -> IO ()

  
  
  writeNonBlocking    :: a -> Ptr Word8 -> Int -> IO Int



class IODevice a where
  
  
  
  
  
  ready :: a -> Bool -> Int -> IO Bool

  
  
  close :: a -> IO ()

  
  isTerminal :: a -> IO Bool
  isTerminal _ = return False

  
  isSeekable :: a -> IO Bool
  isSeekable _ = return False

  
  seek :: a -> SeekMode -> Integer -> IO ()
  seek _ _ _ = ioe_unsupportedOperation

  
  tell :: a -> IO Integer
  tell _ = ioe_unsupportedOperation

  
  getSize :: a -> IO Integer
  getSize _ = ioe_unsupportedOperation

  
  setSize :: a -> Integer -> IO () 
  setSize _ _ = ioe_unsupportedOperation

  
  
  setEcho :: a -> Bool -> IO ()
  setEcho _ _ = ioe_unsupportedOperation

  
  getEcho :: a -> IO Bool
  getEcho _ = ioe_unsupportedOperation

  
  
  
  setRaw :: a -> Bool -> IO ()
  setRaw _ _ = ioe_unsupportedOperation

  
  devType :: a -> IO IODeviceType

  
  
  dup :: a -> IO a
  dup _ = ioe_unsupportedOperation

  
  
  
  dup2 :: a -> a -> IO a
  dup2 _ _ = ioe_unsupportedOperation

ioe_unsupportedOperation :: IO a
ioe_unsupportedOperation = throwIO unsupportedOperation











data IODeviceType
  = Directory 
              
              
              
              
              
              
              
  | Stream    
              
              
              
  | RegularFile 
                
  | RawDevice 
              
              
              
  deriving (Eq)





data SeekMode
  = AbsoluteSeek        
  | RelativeSeek        
                        
  | SeekFromEnd         
                        
    deriving (Eq, Ord, Ix, Enum, Read, Show)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4