Here is the diagram of Effect
provided in the official tutorial of pipes
package.
type Effect = Proxy X () () X
Upstream | Downstream
+---------+
| |
X <== <== ()
| |
() ==> ==> X
| | |
+----|----+
v
r
Since Effect
doesn't have any flow of data, I was expecting it to be just Proxy X X X X
, sealing all flows. But instead, it allows the two in-flows. Is there a particular reason for that? If I just write what a Effect
normally does, with signature Proxy X X X X
, it can pass the compiler perfectly fine:
myMonad :: Proxy X X X X IO ()
myMonad = do
a <- lift $ getLine
lift $ print a
return ()
Why can't we run
something like this?