 	switch destruct(l) {
 		case .Empty:
 			assert(false, "Cannot take the head of an empty list.")
-		case .Destructure(let x, _):
+		case .Cons(let x, _):
 			return x
 	}
 }


public enum ArrayD<A> {
	case Empty
	case Destructure(A, [A])
}

public func destruct<T>(l : [T]) -> ArrayD<T> {
	if l.count == 0 {
		return .Empty
	} else if l.count == 1 {
		return .Destructure(l[0], [])
	}
	let hd = l[0]
	let tl = Array<T>(l[1..<l.count])
	return .Destructure(hd, tl)
}

//extension Array : Functor {

	switch destruct(l) {
		case .Empty:
			assert(false, "Cannot take the tail of an empty list.")
		case .Cons(_, let xs):
			return xs
	}
}
