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
forks
composite
Commits
08bac7ad
Commit
08bac7ad
authored
6 years ago
by
Heneli Kailahi
Browse files
Options
Download
Email Patches
Plain Diff
Added MonadUnliftIO instance for ContextT.
parent
0966581d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
5 deletions
+21
-5
composite-base/composite-base.cabal
composite-base/composite-base.cabal
+4
-2
composite-base/package.nix
composite-base/package.nix
+4
-3
composite-base/package.yaml
composite-base/package.yaml
+1
-0
composite-base/src/Control/Monad/Composite/Context.hs
composite-base/src/Control/Monad/Composite/Context.hs
+12
-0
No files found.
composite-base/composite-base.cabal
View file @
08bac7ad
-- This file has been generated from package.yaml by hpack version 0.2
0
.0.
-- This file has been generated from package.yaml by hpack version 0.2
7
.0.
--
-- see: https://github.com/sol/hpack
--
-- hash:
0e7b65fc80c01f09bbc6c5d29da7e17ba09561542cffc9f1780105d9c863f54d
-- hash:
b746e53a0cfe97d0438e3622bc5cfa0dda9a6e4a0d8d8e0c667a18eea98cf70a
name: composite-base
version: 0.5.4.0
...
...
@@ -33,6 +33,7 @@ library
, text >=1.2.2.2 && <1.3
, transformers >=0.5.2.0 && <0.6
, transformers-base >=0.4.4 && <0.5
, unliftio-core >=0.1.0.0 && <0.2.0.0
, vinyl >=0.5.3 && <0.8
exposed-modules:
Composite
...
...
@@ -65,6 +66,7 @@ test-suite composite-base-test
, text >=1.2.2.2 && <1.3
, transformers >=0.5.2.0 && <0.6
, transformers-base >=0.4.4 && <0.5
, unliftio-core >=0.1.0.0 && <0.2.0.0
, vinyl >=0.5.3 && <0.8
other-modules:
RecordSpec
...
...
This diff is collapsed.
Click to expand it.
composite-base/package.nix
View file @
08bac7ad
{
mkDerivation
,
base
,
exceptions
,
hspec
,
lens
,
monad-control
,
mtl
,
profunctors
,
QuickCheck
,
stdenv
,
template-haskell
,
text
,
transformers
,
transformers-base
,
vinyl
,
transformers
,
transformers-base
,
unliftio-core
,
vinyl
}:
mkDerivation
{
pname
=
"composite-base"
;
...
...
@@ -8,11 +8,12 @@ mkDerivation {
src
=
./.
;
libraryHaskellDepends
=
[
base
exceptions
lens
monad-control
mtl
profunctors
template-haskell
text
transformers
transformers-base
vinyl
text
transformers
transformers-base
unliftio-core
vinyl
];
testHaskellDepends
=
[
base
exceptions
hspec
lens
monad-control
mtl
profunctors
QuickCheck
template-haskell
text
transformers
transformers-base
vinyl
template-haskell
text
transformers
transformers-base
unliftio-core
vinyl
];
homepage
=
"https://github.com/ConferHealth/composite#readme"
;
description
=
"Shared utilities for composite-* packages"
;
...
...
This diff is collapsed.
Click to expand it.
composite-base/package.yaml
View file @
08bac7ad
...
...
@@ -20,6 +20,7 @@ dependencies:
-
text >= 1.2.2.2 && <
1.3
-
transformers >= 0.5.2.0 && <
0.6
-
transformers-base >= 0.4.4 && <
0.5
-
unliftio-core >= 0.1.0.0 && < 0.2.0.0
-
vinyl >= 0.5.3 && <
0.8
default-extensions
:
...
...
This diff is collapsed.
Click to expand it.
composite-base/src/Control/Monad/Composite/Context.hs
View file @
08bac7ad
...
...
@@ -21,6 +21,7 @@ import Control.Monad.Fail (MonadFail)
import
qualified
Control.Monad.Fail
as
MonadFail
import
Control.Monad.Fix
(
MonadFix
(
mfix
))
import
Control.Monad.IO.Class
(
MonadIO
(
liftIO
))
import
Control.Monad.IO.Unlift
(
askUnliftIO
,
MonadUnliftIO
,
UnliftIO
(
UnliftIO
),
unliftIO
,
withUnliftIO
,
withRunInIO
)
import
Control.Monad.Reader
(
ReaderT
(
ReaderT
),
runReaderT
)
import
Control.Monad.Reader.Class
(
MonadReader
(
local
,
ask
,
reader
))
import
qualified
Control.Monad.RWS.Lazy
as
Lazy
...
...
@@ -162,6 +163,17 @@ instance MonadBaseControl b m => MonadBaseControl b (ContextT c m) where
liftBaseWith
$
\
runInBase
->
f
(
runInBase
.
(
$
c
)
.
runContextT
)
instance
MonadUnliftIO
m
=>
MonadUnliftIO
(
ContextT
c
m
)
where
{-# INLINE askUnliftIO #-}
askUnliftIO
=
ContextT
$
\
c
->
withUnliftIO
$
\
u
->
return
(
UnliftIO
(
unliftIO
u
.
flip
runContextT
c
))
{-# INLINE withRunInIO #-}
withRunInIO
inner
=
ContextT
$
\
c
->
withRunInIO
$
\
run
->
inner
(
run
.
flip
runContextT
c
)
instance
MonadReader
r
m
=>
MonadReader
r
(
ContextT
c
m
)
where
ask
=
lift
ask
local
=
mapContextT
.
local
...
...
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