From 31404364e1b0b05aa854abe436a38a44b902d7f7 Mon Sep 17 00:00:00 2001
From: Erick Tryzelaar <erick.tryzelaar@gmail.com>
Date: Wed, 30 Jan 2013 09:54:13 -0800
Subject: [PATCH 1/3] core: sort each prelude.rs section

---
 src/libcore/prelude.rs | 34 +++++++++++++++-------------------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs
index 6bd319a15d2..43217228bd1 100644
--- a/src/libcore/prelude.rs
+++ b/src/libcore/prelude.rs
@@ -13,39 +13,35 @@
 /* Reexported core operators */
 
 pub use kinds::{Const, Copy, Owned, Durable};
-pub use ops::{Drop};
 pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
 pub use ops::{BitAnd, BitOr, BitXor};
+pub use ops::{Drop};
 pub use ops::{Shl, Shr, Index};
 pub use option::{Option, Some, None};
 pub use result::{Result, Ok, Err};
 
 /* Reexported types and traits */
 
-pub use path::Path;
+pub use clone::Clone;
+pub use cmp::{Eq, Ord};
+pub use container::{Container, Mutable, Map, Set};
+pub use hash::Hash;
+pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
+pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
+pub use num::Num;
 pub use path::GenericPath;
-pub use path::WindowsPath;
+pub use path::Path;
 pub use path::PosixPath;
-
-pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
+pub use path::WindowsPath;
+pub use pipes::{GenericChan, GenericPort};
+pub use ptr::Ptr;
 pub use str::{StrSlice, Trimmable};
-pub use container::{Container, Mutable};
+pub use to_bytes::IterBytes;
+pub use to_str::ToStr;
+pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
 pub use vec::{CopyableVector, ImmutableVector};
 pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
 pub use vec::{OwnedVector, OwnedCopyableVector};
-pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
-pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
-pub use container::{Container, Mutable, Map, Set};
-pub use pipes::{GenericChan, GenericPort};
-
-pub use num::Num;
-pub use ptr::Ptr;
-pub use to_str::ToStr;
-pub use clone::Clone;
-
-pub use cmp::{Eq, Ord};
-pub use hash::Hash;
-pub use to_bytes::IterBytes;
 
 /* Reexported modules */
 

From f4ed7d9b6ee0f254c8f1a760373cf8d6f1f8682c Mon Sep 17 00:00:00 2001
From: Erick Tryzelaar <erick.tryzelaar@gmail.com>
Date: Wed, 30 Jan 2013 09:55:33 -0800
Subject: [PATCH 2/3] core: export either::{Either,Left,Right} from the prelude

---
 src/libcore/prelude.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs
index 43217228bd1..4e6f209e79e 100644
--- a/src/libcore/prelude.rs
+++ b/src/libcore/prelude.rs
@@ -12,6 +12,7 @@
 
 /* Reexported core operators */
 
+pub use either::{Either, Left, Right};
 pub use kinds::{Const, Copy, Owned, Durable};
 pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
 pub use ops::{BitAnd, BitOr, BitXor};

From 159568eab51313490ca9faabd67b0e05bc129460 Mon Sep 17 00:00:00 2001
From: Erick Tryzelaar <erick.tryzelaar@gmail.com>
Date: Fri, 1 Feb 2013 16:37:38 -0800
Subject: [PATCH 3/3] core: Flesh out the either traits

---
 src/libcore/either.rs | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/libcore/either.rs b/src/libcore/either.rs
index 6b327b919e5..5e9ccd84195 100644
--- a/src/libcore/either.rs
+++ b/src/libcore/either.rs
@@ -150,6 +150,23 @@ pub pure fn unwrap_right<T,U>(eith: Either<T,U>) -> U {
 }
 
 impl<T, U> Either<T, U> {
+    #[inline(always)]
+    fn either<V>(&self, f_left: fn(&T) -> V, f_right: fn(&U) -> V) -> V {
+        either(f_left, f_right, self)
+    }
+
+    #[inline(always)]
+    fn flip(self) -> Either<U, T> { flip(self) }
+
+    #[inline(always)]
+    fn to_result(self) -> Result<U, T> { to_result(self) }
+
+    #[inline(always)]
+    fn is_left(&self) -> bool { is_left(self) }
+
+    #[inline(always)]
+    fn is_right(&self) -> bool { is_right(self) }
+
     #[inline(always)]
     fn unwrap_left(self) -> T { unwrap_left(self) }