interruptible-0.1.1.1: interruptible.cabal
-- Initial interruptible.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/
name: interruptible
version: 0.1.1.1
synopsis: Monad transformers that can be run and resumed later, conserving their context.
description:
Given an inner monad @M@ and a transformer @T@, if T is an interruptible transformer,
it becomes possible to intercalate functions over its context with functions over the
inner monad. That is, code like this:
.
@
runT (f 1 >>= g)
where
f :: Int -> T M a
g :: a -> T M b
@
.
Can be broken up like this:
.
@
do
let c0 = inTCtx 1
c1 <- resume f ct1
_ <- resume g ct2
@
.
That makes it possible to intercalate the execution of different contexts, and
treat contexts like data, for iterating or returning them.
.
As shown on the example, interruptible transformers are resumed with the @resume@ function.
State may be managed by specialized functions usually named as @inTransfomerCtx@ and
@peelTransformerCtx@ that enclose a value in an initial context and retrieve the
value from a context.
.
Interruptible transformers can be stacked. On this case, they must be resumed with a
composition of @resume@ calls, and their contexts must be created and peeled on the inverse
order that they appear on the stack. Like:
.
@
do
let c0 = inT2Ctx . inT1Ctx $ 1
c1 <- (resume . resume) f ct1
_ <- (resume . resume) g ct2
where
f :: Monad m => Int -> T1 T2 M a
g :: Monad m => a -> T1 T2 M b
@
.
For convenience, the @Interruptible@ module exports the @resume2@ to @resume5@
functions as composotions of resume. They can be composed further as in
@resume7 = resume3 . resume4@ if necessary.
.
This package also contains the appliable instantiations of Interruptible for the mtl transformers,
the @intercalateWith@ function, that intercalates calls of a function through a list
of contexts and parameters, and the @SafeIO@ module that lifts IOException treatment from the
base monad into the current resumed context.
homepage: https://sealgram.com/git/haskell/interruptible/
license: BSD3
license-file: LICENSE
author: Marcos Dumay de Medeiros
maintainer: marcos@marcosdumay.com
--copyright:
category: Control
build-type: Simple
-- extra-source-files:
cabal-version: >=1.10
source-repository head
type: git
location: https://sealgram.com/git/haskell/interruptible/
branch: master
source-repository this
type: git
location: https://sealgram.com/git/haskell/interruptible/
tag: 0.1.1.1
library
exposed-modules:
Control.Monad.Trans.Interruptible
Control.Monad.Trans.SafeIO
other-modules: Control.Monad.Trans.Interruptible.Class
other-extensions: TypeFamilies
build-depends:
base >=4.7 && <5,
transformers,
monad-control,
lifted-base,
either
hs-source-dirs: src
default-language: Haskell2010
Test-suite all
type: detailed-0.9
test-module: Test
hs-source-dirs:
test
build-depends:
base >=4.7 && <5.0,
Cabal >= 1.9.2,
either,
transformers,
interruptible
ghc-options: -Wall -fno-warn-unused-do-bind -fwarn-incomplete-patterns -threaded
default-language: Haskell2010