Module: Dhall::TypeChecker::Forall::FunctionKind

Defined in:
lib/dhall/typecheck.rb

Defined Under Namespace

Classes: Polymorphic, Term

Class Method Summary collapse

Class Method Details

.for(inkind, outkind) ⇒ Object

Raises:

  • (TypeError)


769
770
771
772
773
774
775
776
777
778
779
780
781
# File 'lib/dhall/typecheck.rb', line 769

def self.for(inkind, outkind)
  if inkind.nil? || outkind.nil?
    raise TypeError, "FunctionType part of this is a term"
  end

  raise TypeError, "Dependent types are not allowed" if outkind > inkind

  if outkind.zero?
    Term.new
  else
    Polymorphic.new(inkind, outkind)
  end
end