 
 if typeof(require) != 'undefined'
   require.paths.unshift('#{__dirname}/../lib')
-  { Sequence } = require('sequence')
-  { suspend }  = require('functional')
+  { Sequence }                = require('sequence')
+  { recur, resolve, suspend } = require('functional')
 else
-  { Sequence, suspend } = pazy
+  { Sequence, recur, resolve, suspend } = pazy
 
 
 class FingerTreeType

      [l, r] = split @data, x
      new Instance l.concat r.dropUntil (m) -> m > x

    merge = (t1, t2) ->
      if t2.isEmpty()
        t1
      else
        k = t2.first()
        [l, x, r] = t1.split (m) -> m > k
        l.before(k).concat merge(t2.rest(), r.after(x))

    merge: (other) -> new Instance merge this.data, other.data

    toString: -> @data.toString()


  Empty = new Instance Tree.buildLeft()

  { build: -> Sequence.reduce arguments, Empty, (s, a) -> s.insert a }
)()

class SortedExtensions

SortedSeq = (->
  class Instance
    constructor: (@data) ->

