Skip to content

Instantly share code, notes, and snippets.

@aturon
Last active August 29, 2015 14:05
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save aturon/e5813687e90be860d02c to your computer and use it in GitHub Desktop.
An updated HKT encoding
trait StarToStar<Input> {
type Output;
}
type Apply<Name, Elt> where Name: StarToStar<Elt> = Name::Output;
struct Vec_;
struct DList_;
impl<T> StarToStar<T> for Vec_ {
type Output = Vec<T>;
}
impl<T> StarToStar<T> for DList_ {
type Output = DList<T>;
}
trait Mappable
{
type E;
type HKT where Apply<HKT, E> = Self;
fn map<F>(self, f: E -> F) -> Apply<HKT, F>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment