 
       reverse: -> this
     }
+
+    empty = new Instance Empty
 
 
     # A finger tree with a single element.


  intersect: (other) -> resolve intersect @empty(), this, other

  plus: (x) -> @insert x

SortedSeq = new FingerTreeType OrderMeasure, SortedExtensions (a, b) -> a < b


  before: (x) -> if x == undefined then @ else new @constructor @data.before x
  concat: (t) -> if not t? then this else new @constructor @data.concat t.data
  reverse: -> new @constructor @data.reverse()
  @::plus = @::before


class FingerTreeType
  constructor: (measure, extensions = DefaultExtensions) ->
    @build = -> Sequence.reduce arguments, empty, (s, a) -> s.plus a

    single = (x) -> if x == Empty or x.constructor in internal
        x.measure()
