Skip to content

Commit

Permalink
use incipit
Browse files Browse the repository at this point in the history
  • Loading branch information
tek committed Feb 23, 2022
1 parent cd60c36 commit df67e4e
Show file tree
Hide file tree
Showing 56 changed files with 225 additions and 341 deletions.
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 16 additions & 9 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,36 @@
outputs = { hix, ... }:
let

ghc884 = { hackage, ... }: {
polysemy-test = hackage "0.3.1.7" "0j33f5zh6gyhl86w8kqh6nm02915b4n32xikxc4hwcy7p5l7cl34";
polysemy-time = hackage "0.1.4.0" "0hwx89cilmsdjs3gb5w6by87ysy24scgj5zg77vbfnqpzr3ifrwh";
ghc921 = { hackage, jailbreak, notest, ... }: {
polysemy = hackage "1.7.1.0" "0qwli1kx3hk68hqsgw65mk81bx0djw1wlk17v8ggym7mf3lailyc";
polysemy-plugin = hackage "0.4.3.0" "1r7j1ffsd6z2q2fgpg78brl2gb0dg8r5ywfiwdrsjd2fxkinjcg1";
type-errors = notest;
};

ghc902 = { hackage, ... }: {
relude = hackage "1.0.0.1" "164p21334c3pyfzs839cv90438naxq9pmpyvy87113mwy51gm6xn";
};
# ghc884 = { hackage, ... }: {
# polysemy-test = hackage "0.3.1.7" "0j33f5zh6gyhl86w8kqh6nm02915b4n32xikxc4hwcy7p5l7cl34";
# polysemy-time = hackage "0.1.4.0" "0hwx89cilmsdjs3gb5w6by87ysy24scgj5zg77vbfnqpzr3ifrwh";
# };

all = { hackage, unbreak, ... }: {
polysemy = hackage "1.6.0.0" "15k51ysrfcbkww1562g8zvrlzymlk2rxhcsz9ipsb0q6h571qgvf";
polysemy-plugin = hackage "0.4.1.0" "117g92l1ppsqd3w0rqjrxfk0lx6yndd54rpymgxljilnv43zg29s";
polysemy-resume = hackage "0.2.0.0" "0kh7cwqkr5w69zkm68l6q4d8nkai7fc29n48p3f8skqw638x4w9p";
polysemy-resume = hackage "0.3.0.0" "0kv8x41cxrdwxh7xw8vrywl7sgjkigl84xl7gv038gijh7pvd358";
polysemy-test = hackage "0.4.0.1" "038n31xxid72vrckr3afgkvbsvqhf9q4b912agg24ppjzckq2s15";
polysemy-time = hackage "0.3.0.0" "0mgiq70b35q7ymfwvb8fv291l3f8v7k0z7w6909h922d6jgl4jgp";
incipit-base = hackage "0.1.0.1" "0bcygln28zhrp0jqsm1z8p45k7faas5yamwddz2narsgpkzirx4y";
incipit-core = hackage "0.1.0.1" "1bdkw0q4db3k73i3jjhil96p3rz3gw7mq9jcpcphamld72f4f5ni";
};

in hix.lib.flake {
base = ./.;
overrides = { inherit ghc884 ghc902 all; };
overrides = { inherit all ghc921; };
packages = {
polysemy-conc = ./packages/conc;
polysemy-process = ./packages/process;
};
main = "polysemy-process";
versionFile = "ops/hpack/shared/meta.yaml";
hackage.versionFile = "ops/hpack/shared/meta.yaml";
ghci.preludePackage = "incipit-core";
};
}
28 changes: 13 additions & 15 deletions ops/hpack/packages/polysemy-conc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,22 @@ defaults:

library:
source-dirs: lib
other-modules:
- Prelude
generated-other-modules:
- Paths_polysemy_conc
dependencies:
- async
- containers
- data-default >= 0.2
- incipit-core >= 0.1.0.1
- polysemy >= 1.6
- polysemy-resume >= 0.2
- polysemy-time >= 0.1.4
- relude >= 0.7
- polysemy-resume >= 0.3
- polysemy-time >= 0.3
- stm
- stm-chans >= 2
- template-haskell
- text
- time
- torsor >= 0.1
- unagi-chan >= 0.4
- unix
when:
condition: false
generated-other-modules:
- Paths_polysemy_conc

tests:
polysemy-conc-unit:
Expand All @@ -37,11 +33,9 @@ tests:
- -rtsopts
- -with-rtsopts=-N
dependencies:
- name: polysemy-conc
mixin:
- hiding (Prelude)
- (Polysemy.Conc.Prelude as Prelude)
- polysemy-conc
- async
- incipit-core
- polysemy
- polysemy-plugin
- polysemy-resume
Expand All @@ -52,3 +46,7 @@ tests:
- time
- unagi-chan
- unix
when:
condition: false
generated-other-modules:
- Paths_polysemy_conc
26 changes: 13 additions & 13 deletions ops/hpack/packages/polysemy-process.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,22 @@ defaults:

library:
source-dirs: lib
generated-other-modules:
- Paths_polysemy_process
dependencies:
- name: polysemy-conc
mixin:
- hiding (Prelude)
- (Polysemy.Conc.Prelude as Prelude)
- bytestring
- polysemy-conc
- incipit-core >= 0.1.0.1
- path >= 0.7
- path-io >= 1.6.2
- polysemy >= 1.6
- polysemy-resume >= 0.2
- polysemy-resume >= 0.3
- posix-pty >= 0.2
- process
- relude >= 0.7
- stm-chans >= 2
- typed-process >= 0.2.6
- unix
when:
condition: false
generated-other-modules:
- Paths_polysemy_process

tests:
polysemy-process-unit:
Expand All @@ -35,14 +33,16 @@ tests:
- -rtsopts
- -with-rtsopts=-N
dependencies:
- name: polysemy-conc
mixin:
- hiding (Prelude)
- (Polysemy.Conc.Prelude as Prelude)
- incipit-core
- polysemy-conc
- polysemy
- polysemy-plugin
- polysemy-process
- polysemy-resume
- polysemy-test
- tasty
- typed-process
when:
condition: false
generated-other-modules:
- Paths_polysemy_process
6 changes: 3 additions & 3 deletions packages/conc/lib/Polysemy/Conc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ import Polysemy.Conc.Interpreter.Scoped (
interpretScoped,
interpretScopedAs,
interpretScopedH,
runScoped,
runScopedAs,
interpretScopedResumable,
interpretScopedResumableH,
runScoped,
runScopedAs,
)
import Polysemy.Conc.Interpreter.Stack (ConcStack, runConc)
import Polysemy.Conc.Interpreter.Sync (interpretScopedSync, interpretScopedSyncAs, interpretSync, interpretSyncAs)
Expand All @@ -209,7 +209,7 @@ import Polysemy.Conc.Sync (lock, withSync)

-- $mvar
-- #mvar#
-- An 'MVar' is abstracted as 'Sync' since it can be used to synchronize threads.
-- An 'Control.Concurrent.MVar' is abstracted as 'Sync' since it can be used to synchronize threads.

-- $race
-- #race#
Expand Down
4 changes: 1 addition & 3 deletions packages/conc/lib/Polysemy/Conc/Async.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
module Polysemy.Conc.Async where

import qualified Control.Concurrent.Async as Base
import Polysemy.Async (Async, async, cancel)
import Polysemy.Resource (Resource, bracket)
import Polysemy.Time (MilliSeconds (MilliSeconds), TimeUnit)

import Polysemy.Conc.Effect.Race (Race)
Expand Down Expand Up @@ -92,7 +90,7 @@ scheduleAsync mb f =
raise mb
f h (Sync.putBlock ())

-- |Variant of 'scheduleAsync' that directly interprets the 'MVar' used for signalling.
-- |Variant of 'scheduleAsync' that directly interprets the 'Control.Concurrent.MVar' used for signalling.
scheduleAsyncIO ::
b r a .
Members [Resource, Async, Race, Embed IO] r =>
Expand Down
4 changes: 2 additions & 2 deletions packages/conc/lib/Polysemy/Conc/AtomicState.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- |Description: AtomicState Interpreters
module Polysemy.Conc.AtomicState where

import Polysemy.AtomicState (runAtomicStateTVar)
import Control.Concurrent.STM (newTVarIO)

-- |Convenience wrapper around 'runAtomicStateTVar' that creates a new 'TVar'.
interpretAtomic ::
Expand All @@ -10,6 +10,6 @@ interpretAtomic ::
a ->
InterpreterFor (AtomicState a) r
interpretAtomic initial sem = do
tv <- newTVarIO initial
tv <- embed (newTVarIO initial)
runAtomicStateTVar tv sem
{-# inline interpretAtomic #-}
3 changes: 3 additions & 0 deletions packages/conc/lib/Polysemy/Conc/Effect/Critical.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{-# options_haddock prune #-}

-- |Description: Critical effect
module Polysemy.Conc.Effect.Critical where

import Prelude hiding (catch, run)

-- |An effect that catches exceptions.
--
-- Provides the exact functionality of `Polysemy.Error.fromExceptionSem`, but pushes the dependency on @Final IO@ to the
Expand Down
2 changes: 1 addition & 1 deletion packages/conc/lib/Polysemy/Conc/Effect/Events.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{-# options_haddock prune #-}

-- |Description: Events/Consume Effects, Internal
module Polysemy.Conc.Effect.Events where

import Polysemy (makeSem_)
import Polysemy.Conc.Effect.Scoped (Scoped, scoped)

-- |Marker for the 'Scoped' resource for 'Events'.
Expand Down
3 changes: 1 addition & 2 deletions packages/conc/lib/Polysemy/Conc/Effect/Mask.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{-# options_haddock prune #-}

-- |Description: Mask Effect, Internal
module Polysemy.Conc.Effect.Mask where

import Polysemy (makeSem_)

import Polysemy.Conc.Effect.Scoped (Scoped, scoped)

-- |Part of an effect abstracting 'Control.Exception.mask'.
Expand Down
3 changes: 2 additions & 1 deletion packages/conc/lib/Polysemy/Conc/Effect/Monitor.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{-# options_haddock prune #-}

-- |Description: Monitor Effect, Internal
module Polysemy.Conc.Effect.Monitor where

import Polysemy (makeSem_)
import Control.Concurrent (MVar)
import Polysemy.Time (NanoSeconds)

import Polysemy.Conc.Effect.Scoped (Scoped, scoped)
Expand Down
3 changes: 1 addition & 2 deletions packages/conc/lib/Polysemy/Conc/Effect/Race.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{-# options_haddock prune #-}

-- |Description: Race effect
module Polysemy.Conc.Effect.Race where

import Polysemy (makeSem_)

import Polysemy.Time (TimeUnit)

-- |Abstract the concept of running two programs concurrently, aborting the other when one terminates.
Expand Down
3 changes: 0 additions & 3 deletions packages/conc/lib/Polysemy/Conc/Effect/Scoped.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
-- |Description: Scoped Effect, Internal
module Polysemy.Conc.Effect.Scoped where

import Polysemy (transform)
import Polysemy.Internal (send)

-- |@Scoped@ transforms a program so that @effect@ is associated with a @resource@ within that program.
-- This requires the interpreter for @effect@ to be parameterized by @resource@ and constructed for every program using
-- @Scoped@ separately.
Expand Down
2 changes: 1 addition & 1 deletion packages/conc/lib/Polysemy/Conc/Effect/Sync.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Polysemy.Conc.Effect.Sync where
import Polysemy.Time (TimeUnit)
import Polysemy.Conc.Effect.Scoped (Scoped)

-- |Abstracts an 'MVar'.
-- |Abstracts an 'Control.Concurrent.MVar'.
--
-- For documentation on the constructors, see the module "Polysemy.Conc.Effect.Sync".
--
Expand Down
6 changes: 3 additions & 3 deletions packages/conc/lib/Polysemy/Conc/Interpreter/Critical.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
module Polysemy.Conc.Interpreter.Critical where

import qualified Control.Exception as Exception
import Polysemy (runT)
import Polysemy.Final (getInitialStateS, interpretFinal, runS)
import Prelude hiding (Catch)

import Polysemy.Conc.Effect.Critical (Critical (..))

Expand All @@ -16,9 +16,9 @@ interpretCritical =
Catch ma -> do
s <- getInitialStateS
o <- runS ma
pure (run o s)
pure (go o s)
where
run ma' s =
go ma' s =
Exception.catch (fmap Right <$> ma') \ se -> pure (Left se <$ s)
{-# inline interpretCritical #-}

Expand Down
4 changes: 1 addition & 3 deletions packages/conc/lib/Polysemy/Conc/Interpreter/Events.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{-# options_haddock prune #-}

-- |Description: Events/Consume Interpreters, Internal
module Polysemy.Conc.Interpreter.Events where

import Control.Concurrent.Chan.Unagi.Bounded (InChan, OutChan, dupChan, newChan, readChan, tryWriteChan)
import Polysemy (InterpretersFor)
import Polysemy.Async (Async)
import Polysemy.Resource (Resource)

import Polysemy.Conc.Async (withAsync_)
import qualified Polysemy.Conc.Effect.Events as Events
Expand Down
Loading

0 comments on commit df67e4e

Please sign in to comment.