lambda_types/
lib.rs

1#![cfg_attr(any(doc, feature = "const-numeral"), feature(generic_const_exprs))]
2
3/*!
4lambda-types
5===
6*/
7#![doc = concat!("![
8    Lambda calculus? In *my* type system? _(It's more likely than you think.)_
9](", include_str!("../assets/image_data_url.txt"), ")")]
10/*!
11---
12
13Implements [the Lambda Calculus](https://en.wikipedia.org/wiki/Lambda_calculus) in Rust's type system.
14
15There is **zero** runtime functionality _or_ procedural macros in this crate - it's all done using generics, traits, and associated types.
16
17If you want to toy around with this, check out the [`prelude`].
18
19If you want to write your own function types, check out the [Macros](#macros).
20
21**The Y combinator is left unimplemented, as Rust evaluates types greedily, making it unusable.**
22*/
23
24
25pub trait Function<Input> {
26    type Output;
27}
28
29
30/// Helper macros for easier definition and usage of function types.
31pub mod macros;
32/// Primitive constructs that are often useful.
33pub mod primitives;
34/// Function types relating to boolean algebra.
35pub mod boolean;
36/// Function types relating to church numerals and mathematics.
37/// 
38/// The `const-numeral` feature flag, off by default, adds a wrapper to allow converting any church numeral to a number.
39/// This flag requires `#![feature(generic_const_exprs)]`.
40pub mod math;
41/// Function types relating to the "pair" datatype, and singly linked lists made out of them.
42pub mod datatypes;
43
44/// A module you can glob import to get many useful things in scope.
45pub mod prelude {
46    pub use crate::{define, call, chained};
47    pub use crate::primitives::*;
48    pub use crate::boolean::*;
49    pub use crate::math::*;
50    pub use crate::datatypes::*;
51}