   constructor: ->
   isEnd: -> true
   fmap: -> this
+  apply: -> this
 
 class Observable
   onValue: (f) -> @subscribe (event) ->

Bacon.End = End

nop = ->
initial = (value) -> new Initial(value)
next = (value) -> new Next(value)
end = -> new End()

      unsubBoth

  toProperty: (initValue) ->
   @scan(initValue, latter)

  scan: (seed, f) -> 
    acc = seed
    handleEvent = (event) -> 
      acc = f(acc, event.value) unless event.isEnd()
      @push event.apply(acc)
    d = new Dispatcher(@subscribe, handleEvent)
    subscribe = (sink) ->
      sink initial(acc) if acc?
      d.subscribe(sink)
    new Property(subscribe)

  withHandler: (handler) ->
    new Dispatcher(@subscribe, handler).toEventStream()
