TypeApp

Trait TypeApp 

Source
pub trait TypeApp {
    type Applied<X>;
}
Expand description

A type constructor encoding via associated types.

Rust lacks higher-kinded types, so we encode F : Type → Type as:

  • A marker type F (the “tag”)
  • An associated type Applied<X> representing F(X)

§Example

use algebra_core::fix::TypeApp;

// Option as a type constructor
struct OptionTag;

impl TypeApp for OptionTag {
    type Applied<X> = Option<X>;
}

// Now OptionTag::Applied<i32> == Option<i32>
let x: <OptionTag as TypeApp>::Applied<i32> = Some(42);

Required Associated Types§

Source

type Applied<X>

The result of applying this type constructor to X.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§