2020-07-05 00:59:48 +03:00
|
|
|
namespace MyDo
|
|
|
|
export
|
|
|
|
(>>=) : a -> (a -> IO b) -> IO b
|
|
|
|
(>>=) val k = k val
|
|
|
|
|
2021-02-24 14:07:16 +03:00
|
|
|
export
|
|
|
|
(>>) : a -> IO b -> IO b
|
|
|
|
a >> f = a >>= const f
|
|
|
|
|
2020-07-05 00:59:48 +03:00
|
|
|
foo : IO ()
|
|
|
|
foo = MyDo.do
|
|
|
|
x <- "Silly"
|
|
|
|
putStrLn x
|
2020-08-30 20:52:27 +03:00
|
|
|
|
|
|
|
namespace A
|
|
|
|
namespace B
|
|
|
|
export
|
|
|
|
(>>=) : Nat -> (() -> Nat) -> Nat
|
|
|
|
(>>=) x fy = x + (fy ())
|
|
|
|
|
2021-02-24 14:07:16 +03:00
|
|
|
export
|
|
|
|
(>>) : Nat -> Nat -> Nat
|
|
|
|
a >> f = a >>= const f
|
|
|
|
|
2020-08-30 20:52:27 +03:00
|
|
|
test : Nat
|
|
|
|
test = B.A.do
|
|
|
|
5
|
2021-02-24 14:07:16 +03:00
|
|
|
_ <- 6
|
2020-08-30 20:52:27 +03:00
|
|
|
7
|
2021-01-16 10:03:45 +03:00
|
|
|
|
2020-08-30 20:52:27 +03:00
|
|
|
test2 : Nat
|
|
|
|
test2 = A.B.do
|
|
|
|
5
|
2021-02-24 14:07:16 +03:00
|
|
|
_ <- 6
|
2020-08-30 20:52:27 +03:00
|
|
|
7
|