Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
haskell
polysemy-uncontrolled
Commits
1ee9fb8a
Commit
1ee9fb8a
authored
3 years ago
by
locallycompact
Browse files
Options
Download
Email Patches
Plain Diff
Remove dependency on polysemy-plugin
parent
d479c3ad
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
35 deletions
+29
-35
ChangeLog.md
ChangeLog.md
+4
-0
package.yaml
package.yaml
+2
-3
polysemy-uncontrolled.cabal
polysemy-uncontrolled.cabal
+2
-3
src/Polysemy/Uncontrolled.hs
src/Polysemy/Uncontrolled.hs
+12
-10
stack.yaml
stack.yaml
+2
-5
stack.yaml.lock
stack.yaml.lock
+7
-14
No files found.
ChangeLog.md
View file @
1ee9fb8a
# 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.
This diff is collapsed.
Click to expand it.
package.yaml
View file @
1ee9fb8a
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
...
...
This diff is collapsed.
Click to expand it.
polysemy-uncontrolled.cabal
View file @
1ee9fb8a
...
...
@@ -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
This diff is collapsed.
Click to expand it.
src/Polysemy/Uncontrolled.hs
View file @
1ee9fb8a
...
...
@@ -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 #-}
This diff is collapsed.
Click to expand it.
stack.yaml
View file @
1ee9fb8a
resolver
:
nightly-2021-07-
2
3
resolver
:
nightly-2021-07-3
0
packages
:
-
.
extra-deps
:
-
polysemy-methodology-0.2.0.0
-
polysemy-several-0.1.0.0
nix
:
packages
:
[
zlib
]
-
polysemy-methodology-0.2.1.0
This diff is collapsed.
Click to expand it.
stack.yaml.lock
View file @
1ee9fb8a
...
...
@@ -5,22 +5,15 @@
packages:
- completed:
hackage: polysemy-methodology-0.2.
0
.0@sha256:
0c0ae50d0500e5be46e59dea27df1d815e242277d992fca5d14e67403ef60446
,10
59
hackage: polysemy-methodology-0.2.
1
.0@sha256:
da4b1837eb07a6c923c9fc6de09477bd321a3054b9ad4062433db0e167af0a93
,10
23
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: 5
67260
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2021/7/
2
3.yaml
sha256:
94c5e73c2221ce53348504de8916c960a78a97bdc6ff0921200a42773694bd7c
original: nightly-2021-07-
2
3
size: 5
70941
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2021/7/3
0
.yaml
sha256:
3fae869641e4ff2e5e08aadec30918378691cfb3c94a772a54a1c84b9c937602
original: nightly-2021-07-3
0
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment