-- | Main module for the library module Language.ATS ( -- * Functions for working with syntax lex , parse , printATS , printATSCustom , printATSFast -- * Library functions , getDependencies -- * Syntax Tree , ATS (..) , Declaration (..) , Expression (..) , Type (..) , Function (..) , Implementation (..) , Pattern (..) , Name (..) , UnOp (..) , BinOp (..) , DataPropLeaf (..) , Leaf (..) , Arg (..) , Addendum (..) , LambdaType (..) , Universal (..) , Existential (..) , PreFunction (..) , StaticExpression (..) , StackFunction (..) , Paired (..) , Fixity (..) , SortArg (..) , Sort (..) , SortArgs -- * Lexical types , Token (..) , AlexPosn (..) , Keyword (..) -- * Error types , ATSError -- * Lenses , leaves , constructorUniversals , typeCall , typeCallArgs ) where import Data.Maybe (catMaybes) import Language.ATS.Lexer import Language.ATS.Parser import Language.ATS.PrettyPrint import Language.ATS.Types rewriteATS' :: ATS -> ATS rewriteATS' (ATS ds) = ATS (rewriteDecl <$> ds) -- | Parse a string containing ATS source. parse :: String -> Either (ATSError String) ATS parse = fmap rewriteATS' . parseATS . lexATS -- TODO use Language.C.Parser here? getDependencies :: ATS -> [FilePath] getDependencies (ATS ds) = catMaybes (g <$> ds) where g (Staload _ _ s) = Just s g (Include s) = Just s g _ = Nothing