Agda-2.5.2: A dependently typed functional programming language and proof assistant

Safe Haskell | None
Language | Haskell2010

Agda.Syntax.Translation.ConcreteToAbstract

Description

Translation from Agda.Syntax.Concrete to Agda.Syntax.Abstract. Involves scope analysis, figuring out infix operator precedences and tidying up definitions.

Synopsis

- class ToAbstract concrete abstract | concrete -> abstract where
- localToAbstract :: ToAbstract c a => c -> (a -> ScopeM b) -> ScopeM b
- concreteToAbstract_ :: ToAbstract c a => c -> ScopeM a
- concreteToAbstract :: ToAbstract c a => ScopeInfo -> c -> ScopeM a
- newtype NewModuleQName = NewModuleQName QName
- newtype OldName a = OldName a
- data TopLevel a = TopLevel {
  - topLevelPath :: AbsolutePath
  - topLevelExpectedName :: TopLevelModuleName
  - topLevelTheThing :: a
  }
- data TopLevelInfo = TopLevelInfo {
  - topLevelDecls :: [Declaration]
  - topLevelScope :: ScopeInfo
  }
- topLevelModuleName :: TopLevelInfo -> ModuleName
- data AbstractRHS
- data NewModuleName
- data OldModuleName
- data NewName a
- data OldQName
- data LeftHandSide
- data RightHandSide
- data PatName
- data APatName
- data LetDef
- data LetDefs

# Documentation

class ToAbstract concrete abstract | concrete -> abstract where #

Things that can be translated to abstract syntax are instances of this class.

Minimal complete definition

toAbstract

Methods

toAbstract :: concrete -> ScopeM abstract #

Instances

ToAbstract RHS AbstractRHS # |
Methods toAbstract :: RHS -> ScopeM AbstractRHS #
ToAbstract TypedBinding TypedBinding # |
Methods toAbstract :: TypedBinding -> ScopeM TypedBinding #
ToAbstract TypedBindings TypedBindings # |
Methods toAbstract :: TypedBindings -> ScopeM TypedBindings #
ToAbstract LamBinding LamBinding # |
Methods toAbstract :: LamBinding -> ScopeM LamBinding #
ToAbstract Expr Expr # |
Methods toAbstract :: Expr -> ScopeM Expr #
ToAbstract Clause Clause # |
Methods toAbstract :: Clause -> ScopeM Clause #
ToAbstract NiceDeclaration Declaration # |
Methods toAbstract :: NiceDeclaration -> ScopeM Declaration #
ToAbstract LeftHandSide LHS # |
Methods toAbstract :: LeftHandSide -> ScopeM LHS #
ToAbstract AbstractRHS RHS # |
Methods toAbstract :: AbstractRHS -> ScopeM RHS #
ToAbstract RightHandSide AbstractRHS # |
Methods toAbstract :: RightHandSide -> ScopeM AbstractRHS #
ToAbstract OldModuleName ModuleName # |
Methods toAbstract :: OldModuleName -> ScopeM ModuleName #
ToAbstract NewModuleQName ModuleName # |
Methods toAbstract :: NewModuleQName -> ScopeM ModuleName #
ToAbstract NewModuleName ModuleName # |
Methods toAbstract :: NewModuleName -> ScopeM ModuleName #
ToAbstract PatName APatName # |
Methods toAbstract :: PatName -> ScopeM APatName #
ToAbstract OldQName Expr # |
Methods toAbstract :: OldQName -> ScopeM Expr #
ToAbstract Pragma [Pragma] # |
Methods toAbstract :: Pragma -> ScopeM [Pragma] #
ToAbstract LHSCore (LHSCore' Expr) # |
Methods toAbstract :: LHSCore -> ScopeM (LHSCore' Expr) #
ToAbstract Pattern (Pattern' Expr) # |
Methods toAbstract :: Pattern -> ScopeM (Pattern' Expr) #
ToAbstract LetDef [LetBinding] # |
Methods toAbstract :: LetDef -> ScopeM [LetBinding] #
ToAbstract LetDefs [LetBinding] # |
Methods toAbstract :: LetDefs -> ScopeM [LetBinding] #
ToAbstract ModuleAssignment (ModuleName, [LetBinding]) # |
Methods toAbstract :: ModuleAssignment -> ScopeM (ModuleName, [LetBinding]) #
ToAbstract (TopLevel [Declaration]) TopLevelInfo # | Top-level declarations are always `(import|open)* -- a bunch of possibly opened imports module ThisModule ... -- the top-level module of this file`
Methods toAbstract :: TopLevel [Declaration] -> ScopeM TopLevelInfo #
(Show a, ToQName a) => ToAbstract (OldName a) QName # |
Methods toAbstract :: OldName a -> ScopeM QName #
ToAbstract (NewName Name) Name # |
Methods toAbstract :: NewName Name -> ScopeM Name #
ToAbstract (NewName BoundName) Name # |
Methods toAbstract :: NewName BoundName -> ScopeM Name #
ToAbstract c a => ToAbstract [c] [a] # |
Methods toAbstract :: [c] -> ScopeM [a] #
ToAbstract [Declaration] [Declaration] # |
Methods toAbstract :: [Declaration] -> ScopeM [Declaration] #
ToAbstract c a => ToAbstract (Maybe c) (Maybe a) # |
Methods toAbstract :: Maybe c -> ScopeM (Maybe a) #
ToAbstract c a => ToAbstract (Arg c) (Arg a) # |
Methods toAbstract :: Arg c -> ScopeM (Arg a) #
ToAbstract c a => ToAbstract (WithHiding c) (WithHiding a) # |
Methods toAbstract :: WithHiding c -> ScopeM (WithHiding a) #
ToAbstract c a => ToAbstract (FieldAssignment' c) (FieldAssignment' a) # |
Methods toAbstract :: FieldAssignment' c -> ScopeM (FieldAssignment' a) #
ToAbstract (Pattern' Expr) (Pattern' Expr) # |
Methods toAbstract :: Pattern' Expr -> ScopeM (Pattern' Expr) #
ToAbstract (LHSCore' Expr) (LHSCore' Expr) # |
Methods toAbstract :: LHSCore' Expr -> ScopeM (LHSCore' Expr) #
(ToAbstract c1 a1, ToAbstract c2 a2) => ToAbstract (Either c1 c2) (Either a1 a2) # |
Methods toAbstract :: Either c1 c2 -> ScopeM (Either a1 a2) #
(ToAbstract c1 a1, ToAbstract c2 a2) => ToAbstract (c1, c2) (a1, a2) # |
Methods toAbstract :: (c1, c2) -> ScopeM (a1, a2) #
ToAbstract c a => ToAbstract (Named name c) (Named name a) # |
Methods toAbstract :: Named name c -> ScopeM (Named name a) #
(ToAbstract c1 a1, ToAbstract c2 a2, ToAbstract c3 a3) => ToAbstract (c1, c2, c3) (a1, a2, a3) # |
Methods toAbstract :: (c1, c2, c3) -> ScopeM (a1, a2, a3) #

localToAbstract :: ToAbstract c a => c -> (a -> ScopeM b) -> ScopeM b #

This operation does not affect the scope, i.e. the original scope is restored upon completion.

concreteToAbstract_ :: ToAbstract c a => c -> ScopeM a #

concreteToAbstract :: ToAbstract c a => ScopeInfo -> c -> ScopeM a #

newtype NewModuleQName #

Constructors

NewModuleQName QName |

Instances

ToAbstract NewModuleQName ModuleName # |
Methods toAbstract :: NewModuleQName -> ScopeM ModuleName #

newtype OldName a #

Constructors

OldName a |

Instances

(Show a, ToQName a) => ToAbstract (OldName a) QName # |
Methods toAbstract :: OldName a -> ScopeM QName #

data TopLevel a #

Temporary data type to scope check a file.

Constructors

TopLevel |
Fields topLevelPath :: AbsolutePath The file path from which we loaded this module. topLevelExpectedName :: TopLevelModuleName The expected module name (coming from the import statement that triggered scope checking this file). topLevelTheThing :: a The file content.

Instances

ToAbstract (TopLevel [Declaration]) TopLevelInfo # | Top-level declarations are always `(import|open)* -- a bunch of possibly opened imports module ThisModule ... -- the top-level module of this file`
Methods toAbstract :: TopLevel [Declaration] -> ScopeM TopLevelInfo #

data TopLevelInfo #

Constructors

TopLevelInfo |
Fields topLevelDecls :: [Declaration] topLevelScope :: ScopeInfo as seen from inside the module

Instances

ToAbstract (TopLevel [Declaration]) TopLevelInfo # | Top-level declarations are always `(import|open)* -- a bunch of possibly opened imports module ThisModule ... -- the top-level module of this file`
Methods toAbstract :: TopLevel [Declaration] -> ScopeM TopLevelInfo #

topLevelModuleName :: TopLevelInfo -> ModuleName #

The top-level module name.

data AbstractRHS #

Instances

ToAbstract RHS AbstractRHS # |
Methods toAbstract :: RHS -> ScopeM AbstractRHS #
ToAbstract AbstractRHS RHS # |
Methods toAbstract :: AbstractRHS -> ScopeM RHS #
ToAbstract RightHandSide AbstractRHS # |
Methods toAbstract :: RightHandSide -> ScopeM AbstractRHS #

data NewModuleName #

Instances

ToAbstract NewModuleName ModuleName # |
Methods toAbstract :: NewModuleName -> ScopeM ModuleName #

data OldModuleName #

Instances

ToAbstract OldModuleName ModuleName # |
Methods toAbstract :: OldModuleName -> ScopeM ModuleName #

data NewName a #

Instances

ToAbstract (NewName Name) Name # |
Methods toAbstract :: NewName Name -> ScopeM Name #
ToAbstract (NewName BoundName) Name # |
Methods toAbstract :: NewName BoundName -> ScopeM Name #

data OldQName #

Instances

ToAbstract OldQName Expr # |
Methods toAbstract :: OldQName -> ScopeM Expr #

data LeftHandSide #

Instances

ToAbstract LeftHandSide LHS # |
Methods toAbstract :: LeftHandSide -> ScopeM LHS #

data RightHandSide #

Instances

ToAbstract RightHandSide AbstractRHS # |
Methods toAbstract :: RightHandSide -> ScopeM AbstractRHS #

data PatName #

Instances

ToAbstract PatName APatName # |
Methods toAbstract :: PatName -> ScopeM APatName #

data APatName #

Instances

ToAbstract PatName APatName # |
Methods toAbstract :: PatName -> ScopeM APatName #

data LetDef #

Instances

ToAbstract LetDef [LetBinding] # |
Methods toAbstract :: LetDef -> ScopeM [LetBinding] #

data LetDefs #

Instances

ToAbstract LetDefs [LetBinding] # |
Methods toAbstract :: LetDefs -> ScopeM [LetBinding] #