Mercerenies / tfactor

0 stars 0 forks source link

Functors #1

Closed Mercerenies closed 4 years ago

Mercerenies commented 4 years ago

Parameterized modules, a la OCaml. This is going to be our primary means of ad hoc polymorphism.

Syntax:

trait Eq { X : Type }
  val == ( X X -- Bool )
end

mod IntIsEq
  require Eq { Int }

  fun == ( Int Int -- Bool )
    Prelude.=
  end

end

Some notes:

Mercerenies commented 4 years ago

Updated note on syntax

trait Eq
  type t
  val == ( Self.t Self.t -- Bool )
end

mod IntIsEq
  type t = Int
  require Eq

  fun == ( Int Int -- Bool )
    Prelude.=
  end

end
Mercerenies commented 4 years ago

Functors are nearly completely implemented. Still unresolved are:

Mercerenies commented 4 years ago

The initial implementation is complete, and all remaining concerns have been split into other, smaller issues. So I'm closing this one.