1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
//! Higher-kinded types for Rust standard library types. //! //! This module provides the type cosntructors needed to use the types //! in the Rust standard library in a higher-kinded way. use super::{Kind1, Kind2, K2P1_1, K2P1_2}; /// An `Option<*>` type constructor. /// /// The `Option<*>` type constructor has kind `* -> *`. pub struct OptionC; impl<T> Kind1<T> for OptionC { type Inner = Option<T>; } /// A `Vec<*>` type constructor. /// /// The `Vec<*>` type constructor has kind `* -> *`. pub struct VecC; impl<T> Kind1<T> for VecC { type Inner = Vec<T>; } /// A `Result<*, *>` type constructor. /// /// The `Result<*, *>` type constructor has kind `* -> * -> *`. pub struct ResultC; impl<T, E> Kind2<T, E> for ResultC { type Inner = Result<T, E>; } /// A `Result<T, *>` type constructor. /// /// The `Result<T, *>` type constructor has kind `* -> *`. pub type ResultLeft<T> = K2P1_1<ResultC, T>; /// A `Result<*, T>` type constructor. /// /// The `Result<*, T>` type constructor has kind `* -> *`. pub type ResultRight<T> = K2P1_2<ResultC, T>; /// A `(*, *)` type constructor. /// /// The `(*, *)` type constructor has kind `* -> * -> *`. pub struct PairC; impl<T, U> Kind2<T, U> for PairC { type Inner = (T, U); } /// A `(T, *)` type constructor. /// /// The `(T, *)` type constructor has kind `* -> *`. pub type PairLeft<T> = K2P1_1<PairC, T>; /// A `(*, T)` type constructor. /// /// The `(*, T)` type constructor has kind `* -> *`. pub type PairRight<T> = K2P1_2<PairC, T>;