ebf21d4a945812d85c63439ab2bbed1aa38e6080 — JoJo 1 year, 2 months ago 0ac8d34
std: Update io/{map,bind} to work with new IO newtype
1 files changed, 6 insertions(+), 4 deletions(-)

M std/io.carth
M std/io.carth => std/io.carth +6 -4
@@ 9,11 9,13 @@

(define (io/pure a) (IO (fun (real-world) [Unit real-world])))

(define (io/map f ma)
  (o> ma (map-car f)))
(define: (io/map f (IO ma))
    (forall (a b) (Fun (Fun a b) (IO a) (IO b)))
  (IO (o> ma (map-car f))))

(define (io/bind f ma)
  (o> ma (uncurry (o> f perform-io))))
(define: (io/bind f (IO ma))
    (forall (a b) (Fun (Fun a (IO b)) (IO a) (IO b)))
  (IO (o> ma (uncurry (o> f perform-io)))))

(define io/bindr (flip io/bind))