Safe Haskell | None |
---|
The main compiler module
- compile :: Options -> [Module] -> Either String (String, String, Environment)
- compile' :: Environment -> Options -> [Module] -> Either String (String, String, Environment)
- class MonadMake m where
- getTimestamp :: FilePath -> m (Maybe UTCTime)
- readTextFile :: FilePath -> m String
- writeTextFile :: FilePath -> String -> m ()
- liftError :: Either String a -> m a
- progress :: String -> m ()
- make :: (Functor m, Monad m, MonadMake m) => FilePath -> Options -> [(FilePath, Module)] -> m Environment
Documentation
compile :: Options -> [Module] -> Either String (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' :: Environment -> Options -> [Module] -> Either String (String, String, Environment)Source
A type class which collects the IO actions we need to be able to run in make mode
getTimestamp :: FilePath -> m (Maybe UTCTime)Source
Get a file timestamp
readTextFile :: FilePath -> m StringSource
Read a file as a string
writeTextFile :: FilePath -> String -> m ()Source
Write a text file
liftError :: Either String a -> m aSource
Report an error
progress :: String -> m ()Source
Respond to a progress update
make :: (Functor m, Monad m, MonadMake m) => FilePath -> Options -> [(FilePath, Module)] -> m EnvironmentSource
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.