Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- establishScopingParams :: [ TyVarDecl TyName ann] -> Quote [ TyVarDecl TyName NameAnn ]
- establishScopingConstrTy :: ( TyName -> NameAnn ) -> TyName -> [ TyVarDecl TyName NameAnn ] -> Type TyName uni ann -> Quote ( Type TyName uni NameAnn )
- establishScopingConstrs :: ( TyName -> NameAnn ) -> ann -> TyName -> [ TyVarDecl TyName NameAnn ] -> [ VarDecl TyName Name uni fun ann] -> Quote [ VarDecl TyName Name uni fun NameAnn ]
- establishScopingBinding :: ( forall name. ToScopedName name => name -> NameAnn ) -> Binding TyName Name uni fun ann -> Quote ( Binding TyName Name uni fun NameAnn )
- referenceViaBindings :: ( forall name. ToScopedName name => name -> NameAnn ) -> NonEmpty ( Binding TyName Name uni fun NameAnn ) -> NonEmpty ( Binding TyName Name uni fun NameAnn )
- referenceBindingsBothWays :: ( forall name. ToScopedName name => name -> NameAnn ) -> NonEmpty ( Binding TyName Name uni fun NameAnn ) -> NonEmpty ( Binding TyName Name uni fun NameAnn )
- establishScopingBindings :: ( forall name. ToScopedName name => name -> NameAnn ) -> NonEmpty ( Binding TyName Name uni fun ann) -> Quote ( NonEmpty ( Binding TyName Name uni fun NameAnn ))
- registerByRecursivity :: ToScopedName name => Recursivity -> name -> NameAnn
Documentation
establishScopingParams :: [ TyVarDecl TyName ann] -> Quote [ TyVarDecl TyName NameAnn ] Source #
Establish scoping for each of the parameters of a datatype by only annotating every parameter
with
introduceBound
.
establishScopingConstrTy :: ( TyName -> NameAnn ) -> TyName -> [ TyVarDecl TyName NameAnn ] -> Type TyName uni ann -> Quote ( Type TyName uni NameAnn ) Source #
Establish scoping for the type of a constructor. The updated constructor expects an argument of the "the data type applied to all its parameters" type (that argument is the last one) and always returns that exact type as a result. For example, this functions turns the following generated type of constructor
integer -> a -> a_non_- _type>
into
integer -> a -> D a b -> D a b
assuming the constructor is supposed to construct a data type
D
parameterized by two parameters
a
and
b
. Note that
a_non_-
_type>
can be anything as the generator is allowed to generate
mess such as a constructor not actually constructing a value of the data type.
Whether the name of the data type is referenced as in-scope or out-of-scope one in the types of arguments of constructors is controlled by the first argument, which ultimately depends on the recursivity of the data type.
establishScopingConstrs :: ( TyName -> NameAnn ) -> ann -> TyName -> [ TyVarDecl TyName NameAnn ] -> [ VarDecl TyName Name uni fun ann] -> Quote [ VarDecl TyName Name uni fun NameAnn ] Source #
Establish scoping for all constructors of a data type by establishing scoping for each of them individually. If there are no constructors, then a dummy one is added, because we need to maintain the invariant that every binding is referenced as an in-scope one somewhere and the only place where parameters of a data type can be referenced this way is a constructor of that data type.
establishScopingBinding :: ( forall name. ToScopedName name => name -> NameAnn ) -> Binding TyName Name uni fun ann -> Quote ( Binding TyName Name uni fun NameAnn ) Source #
Establish scoping of a binding. Each bindings gets referenced in its own body either as an in-scope or out-of-scope one, which is controlled by the first argument and ultimately depends on the recursivity of the binding.
referenceViaBindings :: ( forall name. ToScopedName name => name -> NameAnn ) -> NonEmpty ( Binding TyName Name uni fun NameAnn ) -> NonEmpty ( Binding TyName Name uni fun NameAnn ) Source #
Reference each binding in the last one apart from itself.
referenceBindingsBothWays :: ( forall name. ToScopedName name => name -> NameAnn ) -> NonEmpty ( Binding TyName Name uni fun NameAnn ) -> NonEmpty ( Binding TyName Name uni fun NameAnn ) Source #
Reference each binding in the first one apart from itself and in the last one also apart from itself. Former bindings are always visible in latter ones and whether latter bindings are visible in former ones is controlled by the first argument and ultimately depends on the recursivity of the family of bindings.
establishScopingBindings :: ( forall name. ToScopedName name => name -> NameAnn ) -> NonEmpty ( Binding TyName Name uni fun ann) -> Quote ( NonEmpty ( Binding TyName Name uni fun NameAnn )) Source #
Establish scoping for a family of bindings.
registerByRecursivity :: ToScopedName name => Recursivity -> name -> NameAnn Source #
Return a registering function depending on the recursivity.
Orphan instances
tyname ~ TyName => Reference TyName ( Term tyname name uni fun) Source # | |
referenceVia :: ( forall name0. ToScopedName name0 => name0 -> NameAnn ) -> TyName -> Term tyname name uni fun NameAnn -> Term tyname name uni fun NameAnn Source # |
|
tyname ~ TyName => Reference TyName ( Binding tyname name uni fun) Source # | |
referenceVia :: ( forall name0. ToScopedName name0 => name0 -> NameAnn ) -> TyName -> Binding tyname name uni fun NameAnn -> Binding tyname name uni fun NameAnn Source # |
|
tyname ~ TyName => Reference TyName ( Datatype tyname name uni fun) Source # |
Scoping for data types is hard, so we employ some extra paranoia and reference the provided
|
referenceVia :: ( forall name0. ToScopedName name0 => name0 -> NameAnn ) -> TyName -> Datatype tyname name uni fun NameAnn -> Datatype tyname name uni fun NameAnn Source # |
|
name ~ Name => Reference Name ( Term tyname name uni fun) Source # | |
referenceVia :: ( forall name0. ToScopedName name0 => name0 -> NameAnn ) -> Name -> Term tyname name uni fun NameAnn -> Term tyname name uni fun NameAnn Source # |
|
name ~ Name => Reference Name ( Binding tyname name uni fun) Source # |
Unlike other
|
referenceVia :: ( forall name0. ToScopedName name0 => name0 -> NameAnn ) -> Name -> Binding tyname name uni fun NameAnn -> Binding tyname name uni fun NameAnn Source # |
|
tyname ~ TyName => Reference TyName ( VarDecl tyname name uni fun) Source # | |
referenceVia :: ( forall name0. ToScopedName name0 => name0 -> NameAnn ) -> TyName -> VarDecl tyname name uni fun NameAnn -> VarDecl tyname name uni fun NameAnn Source # |
|
tyname ~ TyName => CollectScopeInfo ( TyVarDecl tyname) Source # | |
collectScopeInfo :: TyVarDecl tyname NameAnn -> ScopeErrorOrInfo Source # |
|
Reference tyname t => Reference ( TyVarDecl tyname ann) t Source # | |
referenceVia :: ( forall name. ToScopedName name => name -> NameAnn ) -> TyVarDecl tyname ann -> t NameAnn -> t NameAnn Source # |
|
(tyname ~ TyName , name ~ Name ) => CollectScopeInfo ( Program tyname name uni fun) Source # | |
collectScopeInfo :: Program tyname name uni fun NameAnn -> ScopeErrorOrInfo Source # |
|
(tyname ~ TyName , name ~ Name ) => CollectScopeInfo ( Term tyname name uni fun) Source # | |
collectScopeInfo :: Term tyname name uni fun NameAnn -> ScopeErrorOrInfo Source # |
|
(tyname ~ TyName , name ~ Name ) => CollectScopeInfo ( Binding tyname name uni fun) Source # | |
collectScopeInfo :: Binding tyname name uni fun NameAnn -> ScopeErrorOrInfo Source # |
|
(tyname ~ TyName , name ~ Name ) => CollectScopeInfo ( Datatype tyname name uni fun) Source # | |
collectScopeInfo :: Datatype tyname name uni fun NameAnn -> ScopeErrorOrInfo Source # |
|
(tyname ~ TyName , name ~ Name ) => EstablishScoping ( Program tyname name uni fun) Source # | |
(tyname ~ TyName , name ~ Name ) => EstablishScoping ( Term tyname name uni fun) Source # | |
(tyname ~ TyName , name ~ Name ) => CollectScopeInfo ( VarDecl tyname name uni fun) Source # | |
collectScopeInfo :: VarDecl tyname name uni fun NameAnn -> ScopeErrorOrInfo Source # |
|
( Reference TyName t, Reference Name t) => Reference ( Binding TyName Name uni fun ann) t Source # | |
referenceVia :: ( forall name. ToScopedName name => name -> NameAnn ) -> Binding TyName Name uni fun ann -> t NameAnn -> t NameAnn Source # |
|
( Reference TyName t, Reference Name t) => Reference ( Datatype TyName Name uni fun ann) t Source # | |
referenceVia :: ( forall name. ToScopedName name => name -> NameAnn ) -> Datatype TyName Name uni fun ann -> t NameAnn -> t NameAnn Source # |
|
Reference name t => Reference ( VarDecl tyname name uni fun ann) t Source # | |
referenceVia :: ( forall name0. ToScopedName name0 => name0 -> NameAnn ) -> VarDecl tyname name uni fun ann -> t NameAnn -> t NameAnn Source # |