aboutsummaryrefslogtreecommitdiff
path: root/algebraic-structures.private.stream.monad.scm
blob: e2cb5800f252b1d6daf2affcb1998bbb4e5e656d (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(module (algebraic-structures private stream monad) (>>=)
  (import (except scheme map apply)
          (chicken module)
          (srfi 41)
          (only (algebraic-structures stream applicative)))
  (reexport (algebraic-structures stream applicative))

  (define-stream (stream-append-map f strm)
    (if (stream-null? strm)
        stream-null
        (stream-append (f (stream-car strm))
                       (stream-append-map f (stream-cdr strm)))))

  (define (>>= xs f)
    (stream-append-map f xs)))