Safe Haskell | None |
---|---|
Language | Haskell2010 |
The translation of abstract syntax to concrete syntax has two purposes. First it allows us to pretty print abstract syntax values without having to write a dedicated pretty printer, and second it serves as a sanity check for the concrete to abstract translation: translating from concrete to abstract and then back again should be (more or less) the identity.
Synopsis
- class ToConcrete a where
- type ConOfAbs a
- toConcrete :: a -> AbsToCon (ConOfAbs a)
- bindToConcrete :: a -> (ConOfAbs a -> AbsToCon b) -> AbsToCon b
- toConcreteCtx :: ToConcrete a => Precedence -> a -> AbsToCon (ConOfAbs a)
- abstractToConcrete_ :: (ToConcrete a, MonadAbsToCon m) => a -> m (ConOfAbs a)
- abstractToConcreteScope :: (ToConcrete a, MonadAbsToCon m) => ScopeInfo -> a -> m (ConOfAbs a)
- abstractToConcreteHiding :: (LensHiding i, ToConcrete a, MonadAbsToCon m) => i -> a -> m (ConOfAbs a)
- runAbsToCon :: MonadAbsToCon m => AbsToCon c -> m c
- data RangeAndPragma = RangeAndPragma Range Pragma
- abstractToConcreteCtx :: (ToConcrete a, MonadAbsToCon m) => Precedence -> a -> m (ConOfAbs a)
- withScope :: ScopeInfo -> AbsToCon a -> AbsToCon a
- preserveInteractionIds :: AbsToCon a -> AbsToCon a
- type MonadAbsToCon (m :: Type -> Type) = (MonadFresh NameId m, MonadInteractionPoints m, MonadStConcreteNames m, HasOptions m, PureTCM m, IsString (m Doc), Null (m Doc), Semigroup (m Doc))
- data AbsToCon a
- data Env
- noTakenNames :: AbsToCon a -> AbsToCon a
- lookupQName :: AllowAmbiguousNames -> QName -> AbsToCon QName
Documentation
class ToConcrete a where Source #
Nothing
toConcrete :: a -> AbsToCon (ConOfAbs a) Source #
bindToConcrete :: a -> (ConOfAbs a -> AbsToCon b) -> AbsToCon b Source #
Instances
toConcreteCtx :: ToConcrete a => Precedence -> a -> AbsToCon (ConOfAbs a) Source #
Translate something in a context of the given precedence.
abstractToConcrete_ :: (ToConcrete a, MonadAbsToCon m) => a -> m (ConOfAbs a) Source #
abstractToConcreteScope :: (ToConcrete a, MonadAbsToCon m) => ScopeInfo -> a -> m (ConOfAbs a) Source #
abstractToConcreteHiding :: (LensHiding i, ToConcrete a, MonadAbsToCon m) => i -> a -> m (ConOfAbs a) Source #
runAbsToCon :: MonadAbsToCon m => AbsToCon c -> m c Source #
data RangeAndPragma Source #
Instances
ToConcrete RangeAndPragma Source # | |||||
Defined in Agda.Syntax.Translation.AbstractToConcrete
toConcrete :: RangeAndPragma -> AbsToCon (ConOfAbs RangeAndPragma) Source # bindToConcrete :: RangeAndPragma -> (ConOfAbs RangeAndPragma -> AbsToCon b) -> AbsToCon b Source # | |||||
type ConOfAbs RangeAndPragma Source # | |||||
Defined in Agda.Syntax.Translation.AbstractToConcrete |
abstractToConcreteCtx :: (ToConcrete a, MonadAbsToCon m) => Precedence -> a -> m (ConOfAbs a) Source #
preserveInteractionIds :: AbsToCon a -> AbsToCon a Source #
type MonadAbsToCon (m :: Type -> Type) = (MonadFresh NameId m, MonadInteractionPoints m, MonadStConcreteNames m, HasOptions m, PureTCM m, IsString (m Doc), Null (m Doc), Semigroup (m Doc)) Source #
The function runAbsToCon
can target any monad that satisfies
the constraints of MonadAbsToCon
.
Instances
HasOptions AbsToCon Source # | |
MonadReduce AbsToCon Source # | |
Defined in Agda.Syntax.Translation.AbstractToConcrete liftReduce :: ReduceM a -> AbsToCon a Source # | |
MonadStConcreteNames AbsToCon Source # | |
Defined in Agda.Syntax.Translation.AbstractToConcrete runStConcreteNames :: StateT ConcreteNames AbsToCon a -> AbsToCon a Source # useConcreteNames :: AbsToCon ConcreteNames Source # modifyConcreteNames :: (ConcreteNames -> ConcreteNames) -> AbsToCon () Source # | |
MonadTCEnv AbsToCon Source # | |
ReadTCState AbsToCon Source # | |
Defined in Agda.Syntax.Translation.AbstractToConcrete | |
HasBuiltins AbsToCon Source # | |
Defined in Agda.Syntax.Translation.AbstractToConcrete getBuiltinThing :: SomeBuiltin -> AbsToCon (Maybe (Builtin PrimFun)) Source # | |
MonadAddContext AbsToCon Source # | |
Defined in Agda.Syntax.Translation.AbstractToConcrete addCtx :: Name -> Dom Type -> AbsToCon a -> AbsToCon a Source # addLetBinding' :: Origin -> Name -> Term -> Dom Type -> AbsToCon a -> AbsToCon a Source # updateContext :: Substitution -> (Context -> Context) -> AbsToCon a -> AbsToCon a Source # withFreshName :: Range -> ArgName -> (Name -> AbsToCon a) -> AbsToCon a Source # | |
MonadDebug AbsToCon Source # | |
Defined in Agda.Syntax.Translation.AbstractToConcrete formatDebugMessage :: VerboseKey -> VerboseLevel -> TCM Doc -> AbsToCon String Source # traceDebugMessage :: VerboseKey -> VerboseLevel -> String -> AbsToCon a -> AbsToCon a Source # verboseBracket :: VerboseKey -> VerboseLevel -> String -> AbsToCon a -> AbsToCon a Source # getVerbosity :: AbsToCon Verbosity Source # getProfileOptions :: AbsToCon ProfileOptions Source # isDebugPrinting :: AbsToCon Bool Source # nowDebugPrinting :: AbsToCon a -> AbsToCon a Source # | |
MonadInteractionPoints AbsToCon Source # | |
PureTCM AbsToCon Source # | |
Defined in Agda.Syntax.Translation.AbstractToConcrete | |
HasConstInfo AbsToCon Source # | |
Defined in Agda.Syntax.Translation.AbstractToConcrete getConstInfo :: QName -> AbsToCon Definition Source # getConstInfo' :: QName -> AbsToCon (Either SigError Definition) Source # getRewriteRulesFor :: QName -> AbsToCon RewriteRules Source # | |
Applicative AbsToCon Source # | |
Functor AbsToCon Source # | |
Monad AbsToCon Source # | |
MonadFail AbsToCon Source # | |
Defined in Agda.Syntax.Translation.AbstractToConcrete | |
MonadFresh NameId AbsToCon Source # | |
MonadReader Env AbsToCon Source # | |
Null (AbsToCon Doc) Source # | |
Semigroup (AbsToCon Doc) Source # | |
IsString (AbsToCon Doc) Source # | |
Defined in Agda.Syntax.Translation.AbstractToConcrete fromString :: String -> AbsToCon Doc |
noTakenNames :: AbsToCon a -> AbsToCon a Source #
lookupQName :: AllowAmbiguousNames -> QName -> AbsToCon QName Source #