blob: 5974d909636720f039fc122d3dc974f43508c01e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
//! This file defines the co-algebra trait.
//!
//! If F is an endo-functor, then an F-co-algebra is a natural
//! transformation from the identity functor to F.
use super::functor::Functor;
/// A co-algebra is a function from T to F(T).
///
/// This is a "trait alias". Since Rust does not support trait alias
/// yet, we define an empty trait with an automatic implementation.
pub trait Coalgebra<T, F: Functor<T>>: FnMut(T) -> F {}
impl<T, F: Functor<T>, C: FnMut(T) -> F> Coalgebra<T, F> for C {}
|