ki-effectful: Adaptation of the ki library for the effectful ecosystem.

[ concurrency, library, mit ] [ Propose Tags ]

Adaptation of the ki library for the effectful ecosystem.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.1.0
Change log CHANGELOG.md
Dependencies base (<5), effectful-core (>=1.0 && <3.0), ki (>=1.0 && <1.1), stm (>=2.5 && <2.6) [details]
License MIT
Copyright 2022 Red Hat
Author Tristan de Cacqueray
Maintainer tdecacqu@redhat.com
Category Concurrency
Home page https://github.com/TristanCacqueray/ki-effectful#readme
Bug tracker https://github.com/TristanCacqueray/ki-effectful/issues
Source repo head: git clone https://github.com/TristanCacqueray/ki-effectful
Uploaded by TristanCacqueray at 2023-01-06T14:06:59Z
Distributions NixOS:0.1.1.0
Downloads 137 total (2 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-01-06 [all 1 reports]

Readme for ki-effectful-0.1.0.0

[back to package description]

ki-effectful

Build Status Hackage License: MIT

Description

A StructuredConcurrency effect for the effectful ecosystem.

How to use

This library exposes the following elements:

  • StructuredConcurrency — The type-level effect that you can declare in your type signatures.

example:

runStructuredConcurrency :: IOE :> es => Eff (StructuredConcurrency : es) a -> Eff es a
  • The ki api lifted to Eff using the effect local rep to store the scope:

example:

scoped :: StructuredConcurrency :> es => Eff es a -> Eff es a
fork :: StructuredConcurrency :> es =>   Eff es a -> Eff es (Thread a)
  • Helper function to access the current scope:
testScopeLifting :: StructuredConcurrency :> es => Eff es Int
testScopeLifting = withCurrentScope $ \runInScope -> do
    child <- scoped $ do
        runInScope $ fork $ pure 42
    atomically $ await child