Created
April 21, 2020 05:13
-
-
Save jpm61704/b2725b6535c5e23babd142c558fd7d5b to your computer and use it in GitHub Desktop.
This file contains 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
module Search where | |
import Agda.Syntax.Parser | |
-- import Agda.Syntax.Abstract as Abstract | |
import Agda.Syntax.Concrete as Concrete | |
-- import Agda.Syntax.Translation.ConcreteToAbstract | |
import Agda.Syntax.Scope.Monad | |
import Agda.Utils.FileName | |
import Data.Text.Lazy as T | |
import Agda.Utils.Pretty | |
{- | |
Extracting Definitions From a Library File | |
1. Open File and getContents | |
2. Parse the module | |
-} | |
testFile :: AbsolutePath | |
testFile = mkAbsolute "/home/jpm61704/Documents/Research/ProgramSearch/res/library.agda" | |
parseModule :: AbsolutePath -> PM Module | |
parseModule path = do f <- readFilePM path | |
fmap fst $ parseFile moduleParser path (T.unpack f) | |
withModule :: AbsolutePath -> (Module -> a) -> PM a | |
withModule path f = do mod <- parseModule path | |
return (f mod) | |
allTypeSigs :: Module -> [ Declaration ] | |
allTypeSigs (ps, ds) = Prelude.filter isTypeSig ds | |
isTypeSig :: Declaration -> Bool | |
isTypeSig (TypeSig _ _ _ _) = True | |
isTypeSig _ = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/agda/agda/blob/master/examples/Introduction/Basics.agda