Created
February 29, 2016 15:28
-
-
Save chadaustin/5f534171b3e40a250bf0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type ModuleLoader = AST.ModuleName -> IO (Either Error.Error AST.ParsedModule) | |
| newChainedModuleLoader :: [ModuleLoader] -> ModuleLoader | |
| newChainedModuleLoader [] moduleName = return $ Left $ Error.ModuleNotFound moduleName | |
| newChainedModuleLoader (loader:rest) moduleName = do | |
| loader moduleName >>= \case | |
| Left (Error.ModuleNotFound _) -> newChainedModuleLoader rest moduleName | |
| Left e -> return $ Left e | |
| Right m -> return $ Right m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment