uhc-light-1.1.7.1: src/UHC/Light/Compiler/CoreRun/Prim.hs
module UHC.Light.Compiler.CoreRun.Prim
( RunPrim (..)
, showRunPrim
, allRunPrimMp )
where
import qualified Data.Map as Map
{-# LINE 21 "src/ehc/CoreRun/Prim.chs" #-}
-- | Primitives.
-- Assumption: name of primitive starts with 3 choosable char + exact name of prim
data RunPrim
=
-- Int arithmetic
RP_primAddInt
| RP_primSubInt
| RP_primMulInt
| RP_primDivInt
| RP_primEqInt
| RP_primLeInt
| RP_primNeInt
-- UHC.IOBase: Exception handling
| RP_primCatchException
-- UHC.MutVar
| RP_primNewMutVar
| RP_primReadMutVar
| RP_primWriteMutVar
| RP_primSameMutVar
-- UHC.Base
| RP_primPackedStringToInteger
| RP_primPackedStringNull -- :: PackedString -> Bool
| RP_primPackedStringHead -- :: PackedString -> Char
| RP_primPackedStringTail -- :: PackedString -> PackedString
| RP_primShowInteger
-- UHC.Base: Bounded
| RP_primMaxInt
| RP_primMinInt
-- UHC.Prims: conversion
| RP_primIntegerToInt32
| RP_primIntToInteger
| RP_primIntegerToInt
-- System.IO
--- * The IO monad
-- IO -- instance MonadFix
| RP_fixIO -- :: (a -> IO a) -> IO a
--- * Files and handles
-- FilePath -- :: String
-- Handle -- abstract, instance of: Eq, Show.
--- ** Standard handles
-- | Three handles are allocated during program initialisation,
-- and are initially open.
| RP_stdin
| RP_stdout
| RP_stderr -- :: Handle
--- * Opening and closing files
--- ** Opening files
| RP_withFile
| RP_openFile -- :: FilePath -> IOMode -> IO Handle
-- IOMode(ReadMode,WriteMode,AppendMode,ReadWriteMode),
--- ** Closing files
| RP_hClose -- :: Handle -> IO ()
--- ** Special cases
-- | These functions are also exported by the "Prelude".
| RP_readFile -- :: FilePath -> IO String
| RP_writeFile -- :: FilePath -> String -> IO ()
| RP_appendFile -- :: FilePath -> String -> IO ()
--- ** File locking
--- $locking
--- * Operations on handles
--- ** Determining and changing the size of a file
| RP_hFileSize -- :: Handle -> IO Integer
--- #ifdef __GLASGOW_HASKELL__
| RP_hSetFileSize -- :: Handle -> Integer -> IO ()
--- #endif
--- ** Detecting the end of input
| RP_hIsEOF -- :: Handle -> IO Bool
| RP_isEOF -- :: IO Bool
--- ** Buffering operations
-- BufferMode(NoBuffering,LineBuffering,BlockBuffering),
| RP_hSetBuffering -- :: Handle -> BufferMode -> IO ()
| RP_hGetBuffering -- :: Handle -> IO BufferMode
| RP_hFlush -- :: Handle -> IO ()
--- ** Repositioning handles
| RP_hGetPosn -- :: Handle -> IO HandlePosn
| RP_hSetPosn -- :: HandlePosn -> IO ()
-- HandlePosn, -- abstract, instance of: Eq, Show.
| RP_hSeek -- :: Handle -> SeekMode -> Integer -> IO ()
-- SeekMode(AbsoluteSeek,RelativeSeek,SeekFromEnd),
--- #if !defined(__NHC__)
| RP_hTell -- :: Handle -> IO Integer
--- #endif
--- ** Handle properties
| RP_hIsOpen
| RP_hIsClosed -- :: Handle -> IO Bool
| RP_hIsReadable
| RP_hIsWritable -- :: Handle -> IO Bool
| RP_hIsSeekable -- :: Handle -> IO Bool
--- ** Terminal operations (not portable: GHC\/Hugs only)
--- #if !defined(__NHC__)
| RP_hIsTerminalDevice -- :: Handle -> IO Bool
| RP_hSetEcho -- :: Handle -> Bool -> IO ()
| RP_hGetEcho -- :: Handle -> IO Bool
--- #endif
--- ** Showing handle state (not portable: GHC only)
--- #ifdef __GLASGOW_HASKELL__
| RP_hShow -- :: Handle -> IO String
--- #endif
--- * Text input and output
--- ** Text input
| RP_hWaitForInput -- :: Handle -> Int -> IO Bool
| RP_hReady -- :: Handle -> IO Bool
| RP_hGetChar -- :: Handle -> IO Char
| RP_hGetLine -- :: Handle -> IO [Char]
| RP_hLookAhead -- :: Handle -> IO Char
| RP_hGetContents -- :: Handle -> IO [Char]
--- ** Text output
| RP_hPutChar -- :: Handle -> Char -> IO ()
| RP_hPutStr -- :: Handle -> [Char] -> IO ()
| RP_hPutStrLn -- :: Handle -> [Char] -> IO ()
| RP_hPrint -- :: Show a => Handle -> a -> IO ()
--- ** Special cases for standard input and output
-- | These functions are also exported by the "Prelude".
| RP_interact -- :: (String -> String) -> IO ()
-- putChar -- :: Char -> IO ()
-- putStr -- :: String -> IO ()
-- putStrLn -- :: String -> IO ()
-- print -- :: Show a => a -> IO ()
-- getChar -- :: IO Char
-- getLine -- :: IO String
-- getContents -- :: IO String
| RP_readIO -- :: Read a => String -> IO a
| RP_readLn -- :: Read a => IO a
--- * Binary input and output
| RP_withBinaryFile
| RP_openBinaryFile -- :: FilePath -> IOMode -> IO Handle
| RP_hSetBinaryMode -- :: Handle -> Bool -> IO ()
| RP_hPutBuf -- :: Handle -> Ptr a -> Int -> IO ()
| RP_hGetBuf -- :: Handle -> Ptr a -> Int -> IO Int
--- #if !defined(__NHC__) && !defined(__HUGS__)
| RP_hPutBufNonBlocking -- :: Handle -> Ptr a -> Int -> IO Int
| RP_hGetBufNonBlocking -- :: Handle -> Ptr a -> Int -> IO Int
--- #endif
--- * Temporary files
| RP_openTempFile
| RP_openBinaryTempFile
--- * Additional ones
| RP_primShowHandle -- :: Handle -> String
| RP_primEqHandle -- :: Handle -> Handle -> Bool
deriving (Show, Eq, Ord, Enum, Bounded)
{-# LINE 214 "src/ehc/CoreRun/Prim.chs" #-}
-- | Show prim without initial 3 chars
showRunPrim :: RunPrim -> String
showRunPrim p = drop 3 $ show p
{-# LINE 220 "src/ehc/CoreRun/Prim.chs" #-}
allRunPrimMp :: Map.Map String RunPrim
allRunPrimMp = Map.fromList [ (showRunPrim p, p) | p <- [ minBound .. maxBound ] ]