 //
 
 /// An enum representing the possible values a list can match against.
-public enum ListMatcher<A> {
+public enum ListMatcher<Element> {
 	/// The empty list.
 	case Nil
 	/// A cons cell.
-	case Cons(A, List<A>)
+	case Cons(Element, List<Element>)
 }
 
 /// A lazy ordered sequence of homogenous values.

	/// Appends two lists together.
	///
	/// If the receiver is infinite, the result of this function will be the receiver itself.
	public func append(rhs : List<A>) -> List<A> {
		switch self.match {
		case .Nil:
			return rhs


	/// Takes a list and groups its arguments into sublists of duplicate elements found next to each
	/// other according to an equality predicate.
	public func groupBy(p : Element -> Element -> Bool) -> List<List<Element>> {
		switch self.match {
		case .Nil:
			return []
		case .Cons(let x, let xs):
			let (ys, zs) = xs.span(p(x))
			let l = List(x, ys)
			return List<List<Element>>(l, zs.groupBy(p))
		}
	}
	
	/// Takes a list and groups its arguments into sublists of duplicate elements found next to each
	/// other according to an equality predicate.
	public func groupBy(p : (Element, Element) -> Bool) -> List<List<Element>> {
		return self.groupBy(curry(p))
	}
	
