Skip to content

Instantly share code, notes, and snippets.

@apaleslimghost
Last active December 21, 2015 01:49
Show Gist options
  • Save apaleslimghost/6230956 to your computer and use it in GitHub Desktop.
Save apaleslimghost/6230956 to your computer and use it in GitHub Desktop.
# semigroup
Readable::concat = (b)->
a = this
new class extends Readable
->
super ...
@read-from = a
_read: (size)->
if (@read-from.read size)?
@push that
else if @read-from is a
@read-from = b
@push ""
else
@push null
# monoid
Readable.empty = -> Readable.of ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment