I'm trying to use the do-notation
together with IO
from agda-stdlib
, but, strangely, the type of _>>_
uses ∞
: {B : Set a} (m₁ : ∞ (IO B)) (m₂ : ∞ (IO A)) → IO A
. Because of that, I need to interleave ♯
s between applications, but this makes the usage awkward. For example, ♯
s are necessary to build a program that prints a line:
main : IO ⊤
main = do
♯ (putStrLn "hi")
♯ (return tt)
Moreover, extending it with more lines fail to check. I have to abandon the do-notation
, like this:
main : IO ⊤
main =
♯ (♯ putStrLn "hi" >>
♯ putStrLn "ho") >>
♯ return tt
Which looks terrible. I could redefine _>>_
and _>>=_
:
_>>_ : {A : Set} {B : Set} (m₁ : (IO B)) (m₂ : (IO A)) → IO A
_>>_ a b = (♯ a) IO.>> (♯ b)
But I'm assuming that's not what I'm expected to do. So, am I missing something? What is the proper way to use it?