freer-simple-catching: Checked runtime exceptions with freer-simple

[ control, library, mit ] [ Propose Tags ]

Please see the README on Gitlab at

[Skip to Readme]
Versions [faq]
Change log
Dependencies base (>=4.7 && <5), freer-simple (==1.1.*) [details]
License MIT
Copyright 2018 Ben Weitzman, Co-Star Astrology
Author Ben Weitzman
Category Control
Source repo head: git clone
Uploaded by benweitzman at Mon Nov 12 01:18:03 UTC 2018
Distributions NixOS:
Downloads 62 total (22 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2018-11-12 [all 1 reports]


[Index] [Quick Jump]


Maintainer's Corner

For package maintainers and hackage trustees

Readme for freer-simple-catching-

[back to package description]


This is library for working with exceptions that are thrown during interpreation of free monad effects, at call time.

How to use

This library exposes one effect:

catching :: forall e f a r
          . (Exception e, Member (Catching f e) r)
         => Eff '[f] a
         -> Eff r (Either e a)

We take an effectful function over one effect f and we turn it into an effectful computation of a new effect which denotes that we have an obligation to catch exceptions when we interpret this effect.

We can then discharge this obligation by interpretting the effect f and and any Catching effects built on f by interpretting them both at the same time:

runCatching :: forall e r v f
             . (Member IO r, Member IO (f ': r))
            => (forall a q . Member IO q => Eff (f ': q) a -> Eff q a)
            -> Eff (Catching f e : f : r) v
            -> Eff r v

We can also interpret a Catching f e effect by way of another effect g:

runCatching2 :: forall e r v f g
             . (Member IO r, Member IO (f : r), Member IO (f : g : r))
            => (forall a q. Member g q => Eff (f : q) a -> Eff q a)
            -> (forall a q. Member IO q => Eff (g : q) a -> Eff q a)
            -> Eff (Catching f e : f : g : r) v
            -> Eff r v