Created
October 13, 2015 00:20
-
-
Save andresilva/8234407595f4735240b0 to your computer and use it in GitHub Desktop.
Finger Tree
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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