STrans : (m : Type -> Type) ->
(result : Type) ->
(inRes : Resources) ->
(outRes : result -> Resources) ->
Type
You see that the input resources don't depend on the result of a computation, but the output resources do. Now, let's say we have
MyResultType : Type
myResult : MyResultType
What's the type of pure myResult
? It is STrans m MyResultType (f myResult) f
. What are the input resources? f myResult
, which could be anything. What are the output resources? Well, that depends on the result. But, this is pure
, so the result is always myResult
, and so the output resources are also f myResult
. You see that the signature of pure
is saying that the input and output resources can be anything, and that "anything" depends on f
and myResult
, but they have to be the same "anything"s no matter what.
I believe an equivalent way to see the type of pure
is
pure' : (result : ty) -> STrans m ty resources (const resources)
Which is probably clearer. I don't know why this signature is not used.