> I dislike the concept of having a second, hidden, control flow that might get sprung up upon function callers, because it has side effects buried in the implementation of a callee that are not defined in the parameters or the returns
You might like my capability-based effect system for Haskell, Bluefin[1], then. If a Bluefin effectful function throws you can see it in the type system. If you want to have the capability to throw, you need to pass in an argument of type Throw. For example here "workWithThrow" can only throw an exception because it is passed the Throw capability.
workWithThrow ::
(e1 :> es) =>
Throw String e1 ->
Int ->
Int ->
Eff es Int
workWithThrow t x y = do
let result = x + y
when (result > 10) $ do
throw t "Too big"
pure result
-- ghci> example
-- Left "Too big"
example :: Either String Int
example = runPureEff $ try $ \t -> do
workWithThrow t 5 7
[1] https://hackage.haskell.org/package/bluefin