The catchJust and handleJust functions seem a bit weird and unidiomatic.
catchJust
:: Exception e
=> (e -> Maybe b) -- ^ Predicate to select exceptions
-> IO a -- ^ Computation to run
-> (b -> IO a) -- ^ Handler
-> IO a
catchJust p a handler = catch a handler'
where handler' e = case p e of
Nothing -> throwIO e
Just b -> handler bThis takes two functions and then puts them together. I would think the more natural API would be
catchMaybe :: Exception e => IO a -> (e -> Maybe (IO a)) -> IO a
catchMaybe m handler = catch m handler' where
handler' e = fromMaybe (throwIO e) (handler e)