Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Utilities and common types.
Synopsis
- newtype Var = Var Symbol
- type LocVar = Var
- type RegVar = Var
- fromVar :: Var -> String
- toVar :: String -> Var
- varAppend :: Var -> Var -> Var
- toEndV :: Var -> Var
- toSeqV :: Var -> Var
- cleanFunName :: Var -> Var
- data TyVar
- isUserTv :: TyVar -> Bool
- data Symbol
- intern :: String -> Symbol
- unintern :: Symbol -> String
- data SyM a
- gensym :: MonadState Int m => Var -> m Var
- gensym_tag :: MonadState Int m => Var -> String -> m Var
- genLetter :: MonadState Int m => m Var
- newUniq :: MonadState Int m => m Int
- runSyM :: Int -> SyM a -> (a, Int)
- data PassM a
- runPassM :: Config -> Int -> PassM a -> (a, Int)
- defaultRunPassM :: PassM a -> (a, Int)
- defaultPackedRunPassM :: PassM a -> (a, Int)
- getDynFlags :: MonadReader Config m => m DynFlags
- data Config = Config {}
- data Input
- = Haskell
- | SExpr
- | Unspecified
- data Mode
- data Backend
- defaultConfig :: Config
- data RunConfig = RunConfig {}
- getRunConfig :: [String] -> IO RunConfig
- defaultRunConfig :: RunConfig
- getGibbonConfig :: MonadReader Config m => m Config
- data SSModality
- (#) :: (Ord a, Out a, Out b, Show a, HasCallStack) => Map a b -> a -> b
- (!!!) :: (Out a, HasCallStack) => [a] -> Int -> a
- fragileZip :: (Show a, Show b, HasCallStack) => [a] -> [b] -> [(a, b)]
- fragileZip' :: (Show a, Show b, HasCallStack) => [a] -> [b] -> String -> [(a, b)]
- sdoc :: Out a => a -> String
- ndoc :: Out a => a -> String
- abbrv :: Out a => Int -> a -> String
- lookup3 :: (Eq k, Show k, Show a, Show b) => k -> [(k, a, b)] -> (k, a, b)
- fst3 :: (a, b, c) -> a
- snd3 :: (a, b, c) -> b
- thd3 :: (a, b, c) -> c
- cataM :: (Monad m, Traversable (Base t), Recursive t) => (Base t a -> m a) -> t -> m a
- dbgLvl :: Int
- dbgPrint :: Int -> String -> IO ()
- dbgPrintLn :: Int -> String -> IO ()
- dbgTrace :: Int -> String -> a -> a
- dbgTraceIt :: String -> a -> a
- minChatLvl :: Int
- internalError :: HasCallStack => String -> a
- dumpIfSet :: Config -> DebugFlag -> String -> IO ()
- truePrinted :: String
- falsePrinted :: String
Variables
Instances
Out Var Source # | |
IsString Var Source # | |
Defined in Gibbon.Common fromString :: String -> Var Source # | |
Read Var Source # | |
Show Var Source # | |
NFData Var Source # | |
Defined in Gibbon.Common | |
Eq Var Source # | |
Ord Var Source # | |
FreeVars LocExp Source # | |
FunctionTy Ty2 Source # | Function types know about locations and traversal effects. |
Renamable Var Source # | |
Pretty Var Source # | |
ToIdent Var Source # | |
Interp Store Exp2 Source # | |
InterpProg Store Exp2 Source # | |
InterpExt Store Exp2 (E2Ext LocVar Ty2) Source # | |
Out (ArrowTy2 Ty2) Source # | |
FreeVars a => FreeVars (TyEnv a) Source # | |
Pretty [Var] Source # | |
Typeable (PreExp E2Ext LocVar (UrTy LocVar)) Source # | The add1 :: Tree ... (add1 [loc1, loc2] tr1) .. in this case, we want the type of (add1 tr1) to be (Tree |
type ArrowTy Ty2 Source # | |
Defined in Gibbon.L2.Syntax |
cleanFunName :: Var -> Var Source #
Filter out non-C compatible characters. This naively assumes it will get no conflicts. Which may be correct if function names were gensym'd also....
Type variables that enable polymorphism.
Instances
Out TyVar Source # | |
Generic TyVar Source # | |
Read TyVar Source # | |
Show TyVar Source # | |
NFData TyVar Source # | |
Defined in Gibbon.Common | |
Eq TyVar Source # | |
Ord TyVar Source # | |
Defined in Gibbon.Common | |
Renamable TyVar Source # | |
Pretty TyVar Source # | |
type Rep TyVar Source # | |
Defined in Gibbon.Common type Rep TyVar = D1 ('MetaData "TyVar" "Gibbon.Common" "gibbon-0.3-inplace" 'False) (C1 ('MetaCons "BoundTv" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var)) :+: (C1 ('MetaCons "SkolemTv" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "UserTv" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var)))) |
Gensym monad
gensym :: MonadState Int m => Var -> m Var Source #
Generate a unique symbol by attaching a numeric suffix.
gensym_tag :: MonadState Int m => Var -> String -> m Var Source #
PassM monad
The monad used by core Gibbon passes to access Config
and other shared state.
defaultPackedRunPassM :: PassM a -> (a, Int) Source #
A convenient wrapper over runPassM
for running passes in packed mode.
getDynFlags :: MonadReader Config m => m DynFlags Source #
Gibbon configuration
Overall configuration of the compiler, as determined by command line arguments and possible environment variables.
Config | |
|
What input format to expect on disk.
Instances
Bounded Input Source # | |
Enum Input Source # | |
Defined in Gibbon.Common succ :: Input -> Input Source # pred :: Input -> Input Source # toEnum :: Int -> Input Source # fromEnum :: Input -> Int Source # enumFrom :: Input -> [Input] Source # enumFromThen :: Input -> Input -> [Input] Source # enumFromTo :: Input -> Input -> [Input] Source # enumFromThenTo :: Input -> Input -> Input -> [Input] Source # | |
Read Input Source # | |
Show Input Source # | |
Eq Input Source # | |
Ord Input Source # | |
Defined in Gibbon.Common |
How far to run the compiler/interpreter.
ToParse | Parse and then stop |
ToC | Compile to C |
ToExe | Compile to C then build a binary. |
RunExe | Compile to executable then run. |
Interp2 | Interp late in the compiler pipeline. |
Interp1 | Interp early. |
ToMPL | Compile to SML (mlton dialect) |
ToMPLExe | Compile to SML & compile with MPL |
RunMPL | Compile to SML & compile with MPL & run |
Bench Var | Benchmark a particular function applied to the packed data within an input file. |
BenchInput FilePath | Hardcode the input file to the benchmark in the C code. |
Compilation backend used
Instances
Read Backend Source # | |
Show Backend Source # | |
Eq Backend Source # | |
Ord Backend Source # | |
Runtime configuration for executing interpreters.
getRunConfig :: [String] -> IO RunConfig Source #
We currently use the hacky approach of using env vars OR command line args to set the two universal benchmark params: SIZE and ITERS.
This takes extra, optional command line args [Size, Iters] provided after the file to process on the command line. If these are not present it
getGibbonConfig :: MonadReader Config m => m Config Source #
Misc helpers
data SSModality Source #
Instances
Out SSModality Source # | |
Defined in Gibbon.Common | |
Generic SSModality Source # | |
Defined in Gibbon.Common from :: SSModality -> Rep SSModality x Source # to :: Rep SSModality x -> SSModality Source # | |
Read SSModality Source # | |
Defined in Gibbon.Common | |
Show SSModality Source # | |
Defined in Gibbon.Common | |
NFData SSModality Source # | |
Defined in Gibbon.Common rnf :: SSModality -> () Source # | |
Eq SSModality Source # | |
Defined in Gibbon.Common (==) :: SSModality -> SSModality -> Bool Source # (/=) :: SSModality -> SSModality -> Bool Source # | |
Ord SSModality Source # | |
Defined in Gibbon.Common compare :: SSModality -> SSModality -> Ordering Source # (<) :: SSModality -> SSModality -> Bool Source # (<=) :: SSModality -> SSModality -> Bool Source # (>) :: SSModality -> SSModality -> Bool Source # (>=) :: SSModality -> SSModality -> Bool Source # max :: SSModality -> SSModality -> SSModality Source # min :: SSModality -> SSModality -> SSModality Source # | |
type Rep SSModality Source # | |
fragileZip :: (Show a, Show b, HasCallStack) => [a] -> [b] -> [(a, b)] Source #
fragileZip' :: (Show a, Show b, HasCallStack) => [a] -> [b] -> String -> [(a, b)] Source #
Like fragileZip, but takes a custom error message.
abbrv :: Out a => Int -> a -> String Source #
Like ndoc/sdoc but cut it off with "..." after a char limit.
Debugging/logging:
Debugging flag shared by all modules. This is activated by setting the environment variable DEBUG=1..5
dbgTraceIt :: String -> a -> a Source #
Yo, trace this msg.
minChatLvl :: Int Source #
We should not create chatter below this level. DEBUG=1 is used for assertions only, not chatter.
internalError :: HasCallStack => String -> a Source #
An error that is OUR FAULT, i.e. an internal bug in the compiler.
dumpIfSet :: Config -> DebugFlag -> String -> IO () Source #
Dump some output if the flag is set. Otherwise, do nothing.
Establish conventions for the output of #lang gibbon:
truePrinted :: String Source #
For now this is designed to match the Racket output of "#lang gibbon" which itself should change once we implement a custom printer.