shithub: MicroHs

ref: b4a7a0d4c04ad0fb96d0b279d35da2658d58a0e1
dir: /lib/System/IO_Handle.hs/

View raw version
module System.IO_Handle(BFILE, Handle(..), HandleState(..)) where
import Prelude()
import Primitives
import Data.Bool
import Data.Eq
import Data.IORef

-- A handle is a ForeignPtr to a C BFILE transducer.
-- It needs to be a ForeignPtr so it can have a finalizer
-- that closes the underlying BFILE when the Handle is gc():ed.

data BFILE  -- tag used for C pointers to BFILE structs

data Handle = Handle (ForeignPtr BFILE) (IORef HandleState) [Char]

data HandleState = HRead | HWrite | HReadWrite | HSemiClosed | HClosed
  deriving (Eq)