Suppose we gave Control.Exception.bracket
(that is, the bracket
from base) the following signature:
bracket :: : IO a -> (a -> IO b) -> (a -> IO c) %1 -> IO c
That is: a signature that says that the “in-between” computation will only be used once.
This, to me, makes intuitive sense: bracket
doesn’t do strange things like executing the computation twice. True that it can throw exceptions, but in that case “anything goes”, we are outside normal flow of control anyway.
Would this new type for bracket
be unsound, or misleading? (I’m not proposing actually changing bracket
in base by the way.)