Commit 1ee9fb8a authored by locallycompact's avatar locallycompact
Browse files

Remove dependency on polysemy-plugin

parent d479c3ad
# Changelog for polysemy-uncontrolled
## v0.1.1.0
* Remove dependency on polysemy-plugin.
## v0.1.0.0
* An insane way to represent evil side effects in polysemy.
name: polysemy-uncontrolled
version: 0.1.0.0
version: 0.1.1.0
license: MIT
git: https://gitlab.com/homotopic-tech/polysemy-uncontrolled
author: "Daniel Firth"
......@@ -16,8 +16,7 @@ category: Polysemy
dependencies:
- base >= 4.7 && < 4.16
- polysemy >= 1.3.0.0 && < 1.7
- polysemy-methodology >= 0.1.0.0 && < 0.3
- polysemy-plugin >= 0.3 && < 0.5
- polysemy-methodology >= 0.2.1.0 && < 0.3
ghc-options:
- -Wall
......
......@@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack
name: polysemy-uncontrolled
version: 0.1.0.0
version: 0.1.1.0
synopsis: Uncontrolled toy effect for polysemy.
category: Polysemy
author: Daniel Firth
......@@ -33,6 +33,5 @@ library
build-depends:
base >=4.7 && <4.16
, polysemy >=1.3.0.0 && <1.7
, polysemy-methodology >=0.1.0.0 && <0.3
, polysemy-plugin >=0.3 && <0.5
, polysemy-methodology >=0.2.1.0 && <0.3
default-language: Haskell2010
......@@ -9,7 +9,6 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}
-- |
-- Module : Polysemy.Uncontrolled
......@@ -62,6 +61,8 @@ import Polysemy.Output
import Polysemy.State
-- | An `Uncontrolled` generalises an unmanaged side effect.
--
-- @since 0.1.0.0
data Uncontrolled c b m a where
Send :: c -> Uncontrolled c b m ()
Receive :: Uncontrolled c b m b
......@@ -103,31 +104,32 @@ adaptUncontrolledPure f g = adaptUncontrolledSem (pure . f) (pure . g)
-- | Like `adaptUncontrolledPure`, but with monadic adapters. If you use this I have no idea what you're trying to accomplish.
--
-- @since 0.1.0.0
adaptUncontrolledSem :: Members '[Uncontrolled c' b'] r => (c -> Sem r c') -> (b' -> Sem r b) -> Sem (Uncontrolled c b ': r) a -> Sem r a
adaptUncontrolledSem :: forall c b c' b' r a. Members '[Uncontrolled c' b'] r => (c -> Sem r c') -> (b' -> Sem r b) -> Sem (Uncontrolled c b ': r) a -> Sem r a
adaptUncontrolledSem f g = interpret $ \case
Send c -> f c >>= send
Receive -> receive >>= g
Send c -> f c >>= send @c' @b'
Receive -> receive @c' @b' >>= g
{-# INLINE adaptUncontrolledSem #-}
-- | Run an `Input` as one side of an `Uncontrolled`.
--
-- @since 0.1.0.0
runInputAsUncontrolled :: Members '[Uncontrolled c b] r => Sem (Input b ': r) a -> Sem r a
runInputAsUncontrolled :: forall c b r a. Members '[Uncontrolled c b] r => Sem (Input b ': r) a -> Sem r a
runInputAsUncontrolled = interpret $ \case
Input -> receive
Input -> receive @c @b
{-# INLINE runInputAsUncontrolled #-}
-- | Run an `Output` as one side of an `Uncontrolled`.
--
-- @since 0.1.0.0
runOutputAsUncontrolled :: Members '[Uncontrolled c b] r => Sem (Output c ': r) a -> Sem r a
runOutputAsUncontrolled :: forall c b r a. Members '[Uncontrolled c b] r => Sem (Output c ': r) a -> Sem r a
runOutputAsUncontrolled = interpret $ \case
Output c -> send c
Output c -> send @c @b c
{-# INLINE runOutputAsUncontrolled #-}
-- | Run a `Methodology` as an `Uncontrolled` pure side effect.
--
-- @since 0.1.0.0
runMethodologyAsUncontrolled :: Members '[Uncontrolled b c] r => Sem (Methodology b c ': r) a -> Sem r a
runMethodologyAsUncontrolled :: forall c b r a. Members '[Uncontrolled b c] r => Sem (Methodology b c ': r) a -> Sem r a
runMethodologyAsUncontrolled = interpret $ \case
Process b -> send b >> receive
Process b -> send @b @c b >> receive @b @c
{-# INLINE runMethodologyAsUncontrolled #-}
resolver: nightly-2021-07-23
resolver: nightly-2021-07-30
packages:
- .
extra-deps:
- polysemy-methodology-0.2.0.0
- polysemy-several-0.1.0.0
nix:
packages: [zlib]
- polysemy-methodology-0.2.1.0
......@@ -5,22 +5,15 @@
packages:
- completed:
hackage: polysemy-methodology-0.2.0.0@sha256:0c0ae50d0500e5be46e59dea27df1d815e242277d992fca5d14e67403ef60446,1059
hackage: polysemy-methodology-0.2.1.0@sha256:da4b1837eb07a6c923c9fc6de09477bd321a3054b9ad4062433db0e167af0a93,1023
pantry-tree:
size: 289
sha256: 6806d8fa46c0cf3b4c92c0be9f0678bac0587aac1cf26fc53613bc7ef372c8af
sha256: f795d61595322e735feeb886a59fe945f0f9b11d068ddb387c821789ea8d18f9
original:
hackage: polysemy-methodology-0.2.0.0
- completed:
hackage: polysemy-several-0.1.0.0@sha256:7a4c612116d9ccc2b707d8b95e633c8937e6b018b990c1284fd1949887bfdc50,1029
pantry-tree:
size: 277
sha256: 78913107148e709aeb2efc0d86c725087ddd91241bc5764b298829e917793c2e
original:
hackage: polysemy-several-0.1.0.0
hackage: polysemy-methodology-0.2.1.0
snapshots:
- completed:
size: 567260
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2021/7/23.yaml
sha256: 94c5e73c2221ce53348504de8916c960a78a97bdc6ff0921200a42773694bd7c
original: nightly-2021-07-23
size: 570941
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2021/7/30.yaml
sha256: 3fae869641e4ff2e5e08aadec30918378691cfb3c94a772a54a1c84b9c937602
original: nightly-2021-07-30
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment