packages feed

effable 0.3.1.2 → 0.3.1.3

raw patch · 2 files changed

+28/−19 lines, 2 filesdep ~doctest-parallelPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

Dependency ranges changed: doctest-parallel

API changes (from Hackage documentation)

+ Data.Effable: unsafeDeconstruct :: Effable m b -> [(Wrap m, b)]
+ Data.Effable: unsafeDeconstructRunWith :: RunWith a -> [a]

Files

effable.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0  name:           effable-version:        0.3.1.2+version:        0.3.1.3 stability:      experimental category:       Data synopsis:       A data structure for emission plans@@ -15,11 +15,9 @@ build-type:     Simple tested-with:     GHC == 9.14.1-    GHC == 9.12.2+    GHC == 9.12.4     GHC == 9.10.3     GHC == 9.8.4-    GHC == 9.6.7-    GHC == 9.4.8 extra-doc-files:     README.md description:@@ -29,11 +27,6 @@   type: git   location: https://github.com/carlwr/effable -flag doctest-  description: enable doctests-  default: False-  manual: True- flag isDev   description: development conveniences   default: False@@ -86,10 +79,6 @@ test-suite doctest   import:     , defaults-  -- no solution for 9.14 due to doctest-parallell-  -- (forcing with --alow-newer causes compilation error)-  if !flag(doctest) || impl(ghc >= 9.14)-      buildable: False   hs-source-dirs:  test/doctests   type:            exitcode-stdio-1.0   main-is:         doctests.hs@@ -97,4 +86,4 @@       -threaded   build-depends:     , effable-    , doctest-parallel >= 0.3 && < 1.0+    , doctest-parallel >= 0.3 && < 0.5
src/Data/Effable.hs view
@@ -95,6 +95,10 @@ , RunWith , runWith +-- * Unsafe+, unsafeDeconstruct+, unsafeDeconstructRunWith+ -- * Usage example -- $env_example @@ -183,6 +187,11 @@ newtype Effable m b = Effable { inEffable :: [Part m b] }   deriving (Semigroup, Monoid, Functor) +unsafeDeconstruct :: Effable m b -> [(Wrap m, b)]+unsafeDeconstruct = fmap unPart . inEffable+  where+    unPart (Part w item) = (w,item)+ instance (IsString b) => IsString (Effable m b) where   fromString = string @@ -227,7 +236,7 @@  {- | 'Monad' models /list-like indeterminism/. -The result of @xs '>>=' f@ is the concatenation of the results of applying @f@ to each value embedded in @xs@.+The result of @xs '>>=' f@ is the concatenation of the results of applying @f@ to each value embedded in @xs@. Emission wrappers from @xs@ are composed on the outside of those from @f@s result.  @ 'pure' x  ==  'embed' x@@ -348,6 +357,7 @@ These hold for both 'wrap' and 'wrapInside':  @+'wrap' 'id'          ==  'id' 'wrap' f 'mempty'    ==  'mempty' 'wrap' f (x '<>' y)  ==  'wrap' f x '<>' 'wrap' f y   -- distributes over '<>' g '<$>' 'wrap' f x   ==  'wrap' f (g '<$>' x) \ \     -- commutes with 'fmap'@@ -359,7 +369,6 @@ The given function /composes outside of/ any existing wrappers.  @-'wrap' 'id'          ==  'id' 'wrap' (f . g)\ \    ==  'wrap' f . 'wrap' g           \ \ \ \        -- composes /co/variantly @@ -373,7 +382,6 @@ The given function /composes inside of/ any existing wrappers, i.e. it will be applied directly to the action produced by the emission.  @-'wrapInside' 'id'              ==  'id' 'wrapInside' (f . g)\ \        ==  'wrapInside' g . 'wrapInside' f                 \ \ \ \            -- composes /contra/variantly @@ -570,7 +578,7 @@ > λ> :set +s > λ> run print ineffable > 1-> (ran for 1.02 million years, allocated 3.06e10 gigabytes)+> (ran for 1.02 million years, allocated 3.06e10 terabytes) >  -}@@ -726,15 +734,27 @@ newtype RunWith a = RunWith [a]   deriving (Functor, Foldable, Traversable) +unsafeDeconstructRunWith :: RunWith a -> [a]+unsafeDeconstructRunWith (RunWith xs) = xs+ {- | Create a representation of the individual emission results of an t'Effable'.  Methods of the 'Foldable' and 'Traversable' instances of the result type can be used e.g. to customize how the individual emission results are combined. +== Laws+ @ 'Data.Foldable.sequenceA_' ('runWith' emit x)  ==  'run' emit x @ -=== Example+[Naturality]:++    @+    'runWith' emit (f '<$>' x) == 'runWith' (emit . f) x+    @+++== Example  The following uses the 'foldr' method of t'RunWith'\'s 'Foldable' instance to create a 'run'-like function with a 'foldr'-style API: