Go to the first, previous, next, last section, table of contents.

Access to the `PrimIO' monad

In what we have implemented, `PrimIO' is the handle-the-errors-yourself monad (NB: used for C-calls and such); whereas `IO' is the 1.3-ish we-handle-errors-for-you monad.

Should you may need to play with the `PrimIO' monad directly, you can import `PreludeGlaST'.

NB: You used to get this stuff from the `PreludePrimIO' interface, which is now deceased. As of 0.26, you get all things state-transforming from the `PreludeGlaST' interface.

The usual monadic stuff for `PrimIO':

returnPrimIO    :: a -> PrimIO a
thenPrimIO      :: PrimIO a -> (a -> PrimIO b) -> PrimIO b
seqPrimIO       :: PrimIO a -> PrimIO b -> PrimIO b
fixPrimIO       :: (a -> PrimIO a) -> PrimIO a
foldrPrimIO     :: (a -> b -> PrimIO b) -> PrimIO b -> [a] -> PrimIO b
listPrimIO      :: [PrimIO a] -> PrimIO [a]
mapPrimIO       :: (a -> PrimIO b) -> [a] -> PrimIO [b]
mapAndUnzipPrimIO :: (a -> PrimIO (b,c)) -> [a] -> PrimIO ([b],[c])
forkPrimIO      :: PrimIO a -> PrimIO a

unsafePerformPrimIO     :: PrimIO a -> a
unsafeInterleavePrimIO  :: PrimIO a -> PrimIO a
  -- and they are not called "unsafe" for nothing!

And some other stuff:

data _FILE  -- corresponds to a "FILE *" in C
            -- in classes Eq, _CCallable, and _CReturnable

fclose  :: _FILE -> PrimIO Int
fdopen  :: Int -> String -> PrimIO _FILE
fflush  :: _FILE -> PrimIO Int
fopen   :: String -> String -> PrimIO _FILE
fread   :: Int -> Int -> _FILE -> PrimIO (Int, _ByteArray Int)
freopen :: String -> String -> _FILE -> PrimIO _FILE
fwrite  :: _ByteArray Int -> Int -> Int -> _FILE -> PrimIO Int

-- please AVOID using these (They will probably die)
appendChanPrimIO :: String -> String -> PrimIO ()
appendFilePrimIO :: String -> String -> PrimIO ()
getArgsPrimIO    :: PrimIO [String]
readChanPrimIO   :: String -> PrimIO String


Go to the first, previous, next, last section, table of contents.