Safe Haskell | None |
---|---|
Language | Haskell98 |
The main compiler module
- compile :: (Functor m, Applicative m, MonadError String m, MonadReader (Options Compile) m) => [Module] -> [String] -> m (String, String, Environment)
- compile' :: (Functor m, Applicative m, MonadError String m, MonadReader (Options Compile) m) => Environment -> [Module] -> [String] -> m (String, String, Environment)
- data RebuildPolicy
- class (MonadReader (Options Make) m, MonadError String m) => MonadMake m where
- getTimestamp :: FilePath -> m (Maybe UTCTime)
- readTextFile :: FilePath -> m String
- writeTextFile :: FilePath -> String -> m ()
- progress :: String -> m ()
- make :: forall m. (Functor m, Applicative m, Monad m, MonadMake m) => FilePath -> [(Either RebuildPolicy FilePath, Module)] -> [String] -> m Environment
- prelude :: String
- version :: Version
Documentation
compile :: (Functor m, Applicative m, MonadError String m, MonadReader (Options Compile) m) => [Module] -> [String] -> m (String, String, Environment) Source
Compile a collection of modules
The compilation pipeline proceeds as follows:
- Sort the modules based on module dependencies, checking for cyclic dependencies.
- Perform a set of desugaring passes.
- Type check, and elaborate values to include type annotations and type class dictionaries.
- Regroup values to take into account new value dependencies introduced by elaboration.
- Eliminate dead code.
- Generate Javascript, and perform optimization passes.
- Pretty-print the generated Javascript
compile' :: (Functor m, Applicative m, MonadError String m, MonadReader (Options Compile) m) => Environment -> [Module] -> [String] -> m (String, String, Environment) Source
data RebuildPolicy Source
Determines when to rebuild a module
RebuildNever | Never rebuild this module |
RebuildAlways | Always rebuild this module |
class (MonadReader (Options Make) m, MonadError String m) => MonadMake m where Source
A type class which collects the IO actions we need to be able to run in "make" mode
make :: forall m. (Functor m, Applicative m, Monad m, MonadMake m) => FilePath -> [(Either RebuildPolicy FilePath, Module)] -> [String] -> m Environment Source
Compiles in "make" mode, compiling each module separately to a js files and an externs file
If timestamps have not changed, the externs file can be used to provide the module's types without having to typecheck the module again.