Module aya.base

Class Normalizer

java.lang.Object
org.aya.normalize.Normalizer
All Implemented Interfaces:
Function<org.aya.syntax.core.term.Term,org.aya.syntax.core.term.Term>, UnaryOperator<org.aya.syntax.core.term.Term>

public final class Normalizer extends Object implements UnaryOperator<org.aya.syntax.core.term.Term>
Unlike in pre-v0.30 Aya, we use only one normalizer, only doing head reduction, and we merge conservative normalizer and the whnf normalizer.

Even though it has a field state, do not make it extend Stateful, because there is a method called whnf in it, which clashes with the one here.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    @NotNull kala.collection.immutable.ImmutableSet<org.aya.syntax.ref.AnyVar>
     
    final @NotNull TyckState
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Normalizer(@NotNull TyckState state)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.aya.syntax.core.term.Term
    apply(org.aya.syntax.core.term.Term term)
     
    @NotNull org.aya.syntax.core.term.Term
    normalize(org.aya.syntax.core.term.Term term, org.aya.syntax.literate.CodeOptions.NormalizeMode mode)
    Do NOT use this in the type checker.
    @NotNull kala.control.Option<org.aya.syntax.core.term.Term>
    tryUnfoldClauses(@NotNull kala.collection.immutable.ImmutableSeq<org.aya.syntax.core.term.Term.Matching> clauses, @NotNull kala.collection.immutable.ImmutableSeq<org.aya.syntax.core.term.Term> args, int ulift, boolean orderIndependent)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.function.Function

    andThen, compose
  • Field Details

    • state

      @NotNull public final @NotNull TyckState state
    • opaque

      @NotNull public @NotNull kala.collection.immutable.ImmutableSet<org.aya.syntax.ref.AnyVar> opaque
  • Constructor Details

    • Normalizer

      public Normalizer(@NotNull @NotNull TyckState state)
  • Method Details

    • apply

      public org.aya.syntax.core.term.Term apply(org.aya.syntax.core.term.Term term)
      Specified by:
      apply in interface Function<org.aya.syntax.core.term.Term,org.aya.syntax.core.term.Term>
    • tryUnfoldClauses

      @NotNull public @NotNull kala.control.Option<org.aya.syntax.core.term.Term> tryUnfoldClauses(@NotNull @NotNull kala.collection.immutable.ImmutableSeq<org.aya.syntax.core.term.Term.Matching> clauses, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<org.aya.syntax.core.term.Term> args, int ulift, boolean orderIndependent)
    • normalize

      @NotNull public @NotNull org.aya.syntax.core.term.Term normalize(org.aya.syntax.core.term.Term term, org.aya.syntax.literate.CodeOptions.NormalizeMode mode)
      Do NOT use this in the type checker. This is for REPL/literate mode and testing.