Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eric-corumdigital/04d0a2589ec92bd4046c210bbaab9b80 to your computer and use it in GitHub Desktop.
Save eric-corumdigital/04d0a2589ec92bd4046c210bbaab9b80 to your computer and use it in GitHub Desktop.
newtype Catch e r a = Catch forall x
. ( forall n e s
. IsSymbol n
=> Row.Cons n (FProxy (Except e)) r s
=> SProxy n
-> Run s a
-> (e -> Run r a)
-> x
)
-> x
--
@eric-corumdigital
Copy link
Author

eric-corumdigital commented Jul 30, 2018

catch :: forall n e s t r a
  .   IsSymbol n
  =>  Row.Cons n (FProxy (Catch e r)) r t
  =>  Row.Cons n (FProxy (Except e)) r s
  =>  SProxy n
  ->  Run s a
  ->  (e -> Run r a)
  ->  Run t a
catch sym x h = Run.lift sym (Catch (\f -> f sym x h))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment