Skip to content

Instantly share code, notes, and snippets.

@chadaustin
Created January 20, 2016 16:44
Show Gist options
  • Save chadaustin/38a792b60374ff9f5efc to your computer and use it in GitHub Desktop.
Save chadaustin/38a792b60374ff9f5efc to your computer and use it in GitHub Desktop.
run :: HashMap ModuleName LoadedModule -> Module UnresolvedReference Pos -> IO (Either Error.Error LoadedModule)
run loadedModules modul = runEitherT $ do
env <- EitherT $ (try $ buildTypeEnvironment loadedModules modul) >>= \case
Left err -> return $ Left $ Error.TypeError err
Right result -> return result
decls <- forM (mDecls modul) $ \decl -> do
(lift $ try $ checkDecl env decl) >>= \case
Left err -> left $ Error.TypeError err
Right d -> return d
lift $ freezeModule modul
{ mDecls=decls
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment