Package hydra
Interface Environment
-
public interface EnvironmentGraph to type environment conversions
-
-
Method Summary
Static Methods Modifier and Type Method Description static Either<Error_,TypeApplicationTerm>definitionAsTypeApplicationTerm(Binding el)Convert a definition to a typed termstatic LetgraphAsLet(java.util.List<Binding> bindings, Term body)Convert bindings and a body to a let expressionstatic TermgraphAsTerm(java.util.List<Binding> bindings, Term body)Convert bindings and a body to a term, using let-term dualitystatic Either<DecodingError,java.util.Map<Name,Type>>graphAsTypes(Graph graph, java.util.List<Binding> els)Decode a list of type-encoding bindings into a map of named typesstatic Pair<java.util.List<TypeDefinition>,java.util.List<TermDefinition>>partitionDefinitions(java.util.List<Definition> defs)Partition a list of definitions into type definitions and term definitionsstatic java.util.List<Definition>reorderDefs(java.util.List<Definition> defs)Reorder definitions: types first (with hydra.core.Name first among types), then topologically sorted termsstatic Either<Error_,java.util.Map<Name,TypeScheme>>schemaGraphToTypingEnvironment(Graph g)Convert a schema graph to a typing environment (Either version)static java.util.List<Binding>termAsBindings(Term term)Extract the bindings from a let term, or return an empty list for other termsstatic java.util.List<Binding>typesToDefinitions(java.util.Map<Name,Type> typeMap)Encode a map of named types to a list of bindingsstatic <T0,T1,T2>
T2withLambdaContext(java.util.function.Function<T0,Graph> getContext, java.util.function.Function<Graph,java.util.function.Function<T0,T1>> setContext, T0 env, Lambda lam, java.util.function.Function<T1,T2> body)Execute a computation in the context of a lambda body, extending the type context with the lambda parameterstatic <T0,T1,T2>
T2withLetContext(java.util.function.Function<T0,Graph> getContext, java.util.function.Function<Graph,java.util.function.Function<T0,T1>> setContext, java.util.function.Function<Graph,java.util.function.Function<Binding,Optional<Term>>> forBinding, T0 env, Let letrec, java.util.function.Function<T1,T2> body)Execute a computation in the context of a let body, extending the type context with the let bindingsstatic <T0,T1,T2>
T2withTypeLambdaContext(java.util.function.Function<T0,Graph> getContext, java.util.function.Function<Graph,java.util.function.Function<T0,T1>> setContext, T0 env, TypeLambda tlam, java.util.function.Function<T1,T2> body)Execute a computation in the context of a type lambda body, extending the type context with the type parameter
-
-
-
Method Detail
-
definitionAsTypeApplicationTerm
static Either<Error_,TypeApplicationTerm> definitionAsTypeApplicationTerm(Binding el)
Convert a definition to a typed term
-
graphAsLet
static Let graphAsLet(java.util.List<Binding> bindings, Term body)
Convert bindings and a body to a let expression
-
graphAsTerm
static Term graphAsTerm(java.util.List<Binding> bindings, Term body)
Convert bindings and a body to a term, using let-term duality
-
graphAsTypes
static Either<DecodingError,java.util.Map<Name,Type>> graphAsTypes(Graph graph, java.util.List<Binding> els)
Decode a list of type-encoding bindings into a map of named types
-
partitionDefinitions
static Pair<java.util.List<TypeDefinition>,java.util.List<TermDefinition>> partitionDefinitions(java.util.List<Definition> defs)
Partition a list of definitions into type definitions and term definitions
-
reorderDefs
static java.util.List<Definition> reorderDefs(java.util.List<Definition> defs)
Reorder definitions: types first (with hydra.core.Name first among types), then topologically sorted terms
-
schemaGraphToTypingEnvironment
static Either<Error_,java.util.Map<Name,TypeScheme>> schemaGraphToTypingEnvironment(Graph g)
Convert a schema graph to a typing environment (Either version)
-
termAsBindings
static java.util.List<Binding> termAsBindings(Term term)
Extract the bindings from a let term, or return an empty list for other terms
-
typesToDefinitions
static java.util.List<Binding> typesToDefinitions(java.util.Map<Name,Type> typeMap)
Encode a map of named types to a list of bindings
-
withLambdaContext
static <T0,T1,T2> T2 withLambdaContext(java.util.function.Function<T0,Graph> getContext, java.util.function.Function<Graph,java.util.function.Function<T0,T1>> setContext, T0 env, Lambda lam, java.util.function.Function<T1,T2> body)
Execute a computation in the context of a lambda body, extending the type context with the lambda parameter
-
withLetContext
static <T0,T1,T2> T2 withLetContext(java.util.function.Function<T0,Graph> getContext, java.util.function.Function<Graph,java.util.function.Function<T0,T1>> setContext, java.util.function.Function<Graph,java.util.function.Function<Binding,Optional<Term>>> forBinding, T0 env, Let letrec, java.util.function.Function<T1,T2> body)
Execute a computation in the context of a let body, extending the type context with the let bindings
-
withTypeLambdaContext
static <T0,T1,T2> T2 withTypeLambdaContext(java.util.function.Function<T0,Graph> getContext, java.util.function.Function<Graph,java.util.function.Function<T0,T1>> setContext, T0 env, TypeLambda tlam, java.util.function.Function<T1,T2> body)
Execute a computation in the context of a type lambda body, extending the type context with the type parameter
-
-