Skip to content

Instantly share code, notes, and snippets.

@andresilva
Created October 13, 2015 00:20
Show Gist options
  • Save andresilva/8234407595f4735240b0 to your computer and use it in GitHub Desktop.
Save andresilva/8234407595f4735240b0 to your computer and use it in GitHub Desktop.
Finger Tree
use std::rc::Rc;
pub enum FingerTree<A> {
Empty,
Single(A),
Deep(Rc<Digit<A>>, Rc<FingerTree<Node<A>>>, Rc<Digit<A>>)
}
pub enum Digit<A> {
One(A),
Two(A, A),
Three(A, A, A),
Four(A, A, A, A)
}
pub enum Node<A> {
Node2(A, A),
Node3(A, A, A)
}
fn main() {
let t: FingerTree<()> = FingerTree::Empty;
// error: the type `Digit<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<()>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` is too big for the current architecture
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment