fused-effects 1.1.1.0 → 1.1.1.1
raw patch · 41 files changed
+123/−104 lines, 41 filesdep +tasty-benchdep −gaugedep −tastydep −tasty-hedgehogdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies added: tasty-bench
Dependencies removed: gauge, tasty, tasty-hedgehog, tasty-hunit
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- ChangeLog.md +6/−1
- LICENSE +1/−1
- README.lhs +1/−0
- README.md +1/−0
- benchmark/Bench.hs +1/−1
- benchmark/Bench/Error.hs +1/−1
- benchmark/Bench/Interpret.hs +1/−1
- benchmark/Bench/NonDet.hs +1/−1
- benchmark/Bench/NonDet/NQueens.hs +1/−1
- benchmark/Bench/Reader.hs +1/−1
- benchmark/Bench/State.hs +1/−1
- benchmark/Bench/Writer.hs +1/−1
- examples/Inference.hs +1/−2
- examples/Labelled.hs +14/−8
- examples/Main.hs +3/−2
- examples/Parser.hs +1/−2
- examples/ReinterpretLog.hs +5/−5
- examples/Teletype.hs +1/−2
- examples/Utils.hs +20/−0
- fused-effects.cabal +8/−13
- test/Catch.hs +0/−2
- test/Choose.hs +0/−2
- test/Cull.hs +0/−2
- test/Cut.hs +0/−2
- test/Cut/Church.hs +4/−4
- test/Empty.hs +0/−2
- test/Error.hs +0/−1
- test/Fail.hs +0/−2
- test/Fresh.hs +0/−2
- test/Fusion.hs +11/−11
- test/Gen.hs +21/−0
- test/Lift.hs +4/−4
- test/Monad.hs +0/−2
- test/MonadFix.hs +0/−2
- test/NonDet.hs +0/−2
- test/NonDet/Church.hs +10/−10
- test/Reader.hs +0/−2
- test/State.hs +0/−2
- test/Test.hs +3/−2
- test/Throw.hs +0/−2
- test/Writer.hs +0/−2
ChangeLog.md view
@@ -1,6 +1,11 @@+# v1.1.1.1++- Adds support for `ghc` 9.0 & `base` 4.15.++ # v1.1.1 -* Defines `MonadFix` instances for `Labelled` and `UnderLabel`. ([#402](https://github.com/fused-effects/fused-effects/pull/402))+- Defines `MonadFix` instances for `Labelled` and `UnderLabel`. ([#402](https://github.com/fused-effects/fused-effects/pull/402)) # v1.1
LICENSE view
@@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2018-2020, Nicolas Wu, Tom Schrijvers, Rob Rix, and Patrick Thomson+Copyright (c) 2018-2021, Nicolas Wu, Tom Schrijvers, Rob Rix, and Patrick Thomson All rights reserved. Redistribution and use in source and binary forms, with or without
README.lhs view
@@ -293,6 +293,7 @@ * [`semantic`](http://github.com/github/semantic), a program analysis toolkit * [`now-haskell`](http://hackage.haskell.org/package/now-haskell), a client library for AWS Lambda+* ['Deadpendency'](https://deadpendency.com), a software dependency project health tracking tool ### Comparison to other effect libraries
README.md view
@@ -293,6 +293,7 @@ * [`semantic`](http://github.com/github/semantic), a program analysis toolkit * [`now-haskell`](http://hackage.haskell.org/package/now-haskell), a client library for AWS Lambda+* ['Deadpendency'](https://deadpendency.com), a software dependency project health tracking tool ### Comparison to other effect libraries
benchmark/Bench.hs view
@@ -8,7 +8,7 @@ import qualified Bench.Reader as Reader import qualified Bench.State as State import qualified Bench.Writer as Writer-import Gauge+import Test.Tasty.Bench main :: IO () main = defaultMain
benchmark/Bench/Error.hs view
@@ -7,7 +7,7 @@ import Control.Carrier.Error.Either as Either import Data.Foldable (for_) import Control.Monad.Trans.Except as Except-import Gauge hiding (benchmark)+import Test.Tasty.Bench benchmark :: Benchmark benchmark = bgroup "Error"
benchmark/Bench/Interpret.hs view
@@ -10,7 +10,7 @@ import Control.Carrier.Interpret import Control.Carrier.State.Strict import Data.Foldable (for_)-import Gauge hiding (benchmark)+import Test.Tasty.Bench benchmark :: Benchmark benchmark = bgroup "Interpret"
benchmark/Bench/NonDet.hs view
@@ -6,7 +6,7 @@ import qualified Bench.NonDet.NQueens as NQueens import Control.Algebra import qualified Control.Carrier.NonDet.Church as NonDet.Church-import Gauge hiding (benchmark)+import Test.Tasty.Bench benchmark :: Benchmark benchmark = bgroup "NonDet"
benchmark/Bench/NonDet/NQueens.hs view
@@ -14,7 +14,7 @@ import Control.Monad (guard) import Data.Foldable import qualified Data.List as List-import Gauge hiding (benchmark)+import Test.Tasty.Bench type Square = (Int,Int) type Board = [Int]
benchmark/Bench/Reader.hs view
@@ -6,7 +6,7 @@ import Control.Carrier.Reader import Control.Monad (replicateM_) import Control.Monad.Trans.Reader (runReaderT)-import Gauge hiding (benchmark)+import Test.Tasty.Bench benchmark :: Benchmark benchmark = bgroup "Reader"
benchmark/Bench/State.hs view
@@ -8,7 +8,7 @@ import Control.Monad.Trans.State.Lazy as T.Lazy (execStateT) import Control.Monad.Trans.State.Strict as T.Strict (execStateT) import Data.Foldable (for_)-import Gauge hiding (benchmark)+import Test.Tasty.Bench benchmark :: Benchmark benchmark = bgroup "State"
benchmark/Bench/Writer.hs view
@@ -13,7 +13,7 @@ import Control.Monad.Trans.Writer.Lazy as T.Lazy (execWriterT) import Control.Monad.Trans.Writer.Strict as T.Strict (execWriterT) import Data.Monoid (Sum(..))-import Gauge hiding (benchmark)+import Test.Tasty.Bench benchmark :: Benchmark benchmark = bgroup "Writer"
examples/Inference.hs view
@@ -14,8 +14,7 @@ import Hedgehog import qualified Hedgehog.Gen as Gen import qualified Hedgehog.Range as Range-import Test.Tasty-import Test.Tasty.Hedgehog+import Utils example :: TestTree example = testGroup "inference"
examples/Labelled.hs view
@@ -11,8 +11,8 @@ import Control.Effect.Labelled import qualified Control.Effect.Reader.Labelled as L import qualified Control.Effect.State.Labelled as L-import Test.Tasty-import Test.Tasty.HUnit+import Hedgehog+import Utils sample :: ( HasLabelled "fore" (Reader Int) sig m , HasLabelled "aft" (Reader Int) sig m@@ -34,9 +34,12 @@ readerExamples :: TestTree readerExamples = testGroup "Reader"- [ testCase "runUnderLabel" (run (runReader (5 :: Int) (runLabelled @"fore" (runReader (10 :: Int) (runLabelled @"aft" sample)))) @=? 15)- , testCase "Reader.Labelled helpers" (run (runReader (5 :: Int) (runLabelled @"fore" (runReader (10 :: Int) (runLabelled @"aft" withHelpers)))) @=? 15)- , testCase "Nat labels" (run (runReader (5 :: Int) (runLabelled @1 (runReader (10 :: Int) (runLabelled @2 numerically)))) @=? 15)+ [ testProperty "runUnderLabel" . property $+ run (runReader (5 :: Int) (runLabelled @"fore" (runReader (10 :: Int) (runLabelled @"aft" sample)))) === 15+ , testProperty "Reader.Labelled helpers" . property $+ run (runReader (5 :: Int) (runLabelled @"fore" (runReader (10 :: Int) (runLabelled @"aft" withHelpers)))) === 15+ , testProperty "Nat labels" . property $+ run (runReader (5 :: Int) (runLabelled @1 (runReader (10 :: Int) (runLabelled @2 numerically)))) === 15 ] sampleS :: ( HasLabelled "fore" (State Int) sig m@@ -59,9 +62,12 @@ stateExamples :: TestTree stateExamples = testGroup "State"- [ testCase "runUnderLabel" (run (evalState (5 :: Int) (runLabelled @"fore" (evalState (10 :: Int) (runLabelled @"aft" sampleS)))) @=? 15)- , testCase "State.Labelled helpers" (run (evalState (5 :: Int) (runLabelled @"fore" (evalState (10 :: Int) (runLabelled @"aft" helpersS)))) @=? 15)- , testCase "Boolean labels" (run (evalState (5 :: Int) (runLabelled @'True (evalState (10 :: Int) (runLabelled @'False boolean)))) @=? 15)+ [ testProperty "runUnderLabel" . property $+ run (evalState (5 :: Int) (runLabelled @"fore" (evalState (10 :: Int) (runLabelled @"aft" sampleS)))) === 15+ , testProperty "State.Labelled helpers" . property $+ run (evalState (5 :: Int) (runLabelled @"fore" (evalState (10 :: Int) (runLabelled @"aft" helpersS)))) === 15+ , testProperty "Boolean labels" . property $+ run (evalState (5 :: Int) (runLabelled @'True (evalState (10 :: Int) (runLabelled @'False boolean)))) === 15 ]
examples/Main.hs view
@@ -2,15 +2,16 @@ ( main ) where +import Hedgehog.Main import qualified Inference import qualified Labelled import qualified Parser import qualified ReinterpretLog import qualified Teletype-import Test.Tasty+import Utils main :: IO ()-main = defaultMain $ testGroup "examples"+main = defaultMain $ map checkTestTree [ Inference.example , Parser.example , ReinterpretLog.example
examples/Parser.hs view
@@ -23,8 +23,7 @@ import qualified Hedgehog.Function as Fn import qualified Hedgehog.Gen as Gen import qualified Hedgehog.Range as Range-import Test.Tasty-import Test.Tasty.Hedgehog+import Utils example :: TestTree example = testGroup "parser"
examples/ReinterpretLog.hs view
@@ -33,9 +33,9 @@ import Control.Carrier.Writer.Strict import Control.Monad.IO.Class (MonadIO(..)) import Data.Kind (Type)+import Hedgehog import Prelude hiding (log)-import Test.Tasty-import Test.Tasty.HUnit+import Utils -------------------------------------------------------------------------------- -- The application@@ -157,9 +157,9 @@ -- Test spec. example :: TestTree example = testGroup "reinterpret log"- [ testCase "reinterprets logs" $ do- a <- collectLogMessages . reinterpretLog renderLogMessage $ do+ [ testProperty "reinterprets logs" . property $ do+ a <- liftIO . collectLogMessages . reinterpretLog renderLogMessage $ do log (Debug "foo") log (Info "bar")- a @?= ["[debug] foo", "[info] bar"]+ a === ["[debug] foo", "[info] bar"] ]
examples/Teletype.hs view
@@ -19,8 +19,7 @@ import qualified Hedgehog.Gen as Gen import qualified Hedgehog.Range as Range import Prelude hiding (read)-import Test.Tasty-import Test.Tasty.Hedgehog+import Utils example :: TestTree example = testGroup "teletype"
+ examples/Utils.hs view
@@ -0,0 +1,20 @@+module Utils+( module Utils+) where++import Hedgehog++data TestTree+ = Leaf String Property+ | Branch String [TestTree]++checkTestTree :: TestTree -> IO Bool+checkTestTree t = case t of+ Leaf n p -> putStrLn n *> check p <* putStrLn ""+ Branch n ts -> and <$ putStrLn n <*> traverse checkTestTree ts <* putStrLn ""++testGroup :: String -> [TestTree] -> TestTree+testGroup = Branch++testProperty :: String -> Property -> TestTree+testProperty = Leaf
fused-effects.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2 name: fused-effects-version: 1.1.1.0+version: 1.1.1.1 synopsis: A fast, flexible, fused effect system. description: A fast, flexible, fused effect system, à la Effect Handlers in Scope, Monad Transformers and Modular Algebraic Effects: What Binds Them Together, and Fusion for Free—Efficient Algebraic Effect Handlers. homepage: https://github.com/fused-effects/fused-effects@@ -9,7 +9,7 @@ license-file: LICENSE author: Nicolas Wu, Tom Schrijvers, Rob Rix, Patrick Thomson maintainer: robrix@github.com-copyright: 2018-2020 Nicolas Wu, Tom Schrijvers, Rob Rix, Patrick Thomson+copyright: 2018-2021 Nicolas Wu, Tom Schrijvers, Rob Rix, Patrick Thomson category: Control build-type: Simple extra-source-files:@@ -20,8 +20,9 @@ GHC == 8.2.2 GHC == 8.4.4 GHC == 8.6.5- GHC == 8.8.3- GHC == 8.10.1+ GHC == 8.8.4+ GHC == 8.10.4+ GHC == 9.0.1 common common default-language: Haskell2010@@ -105,7 +106,7 @@ Control.Effect.Throw.Internal Control.Effect.Writer.Internal build-depends:- base >= 4.9 && < 4.15+ base >= 4.9 && < 4.16 , transformers >= 0.4 && < 0.6 @@ -120,14 +121,12 @@ Parser ReinterpretLog Teletype+ Utils build-depends: , base , fused-effects , hedgehog ^>= 1 , hedgehog-fn ^>= 1- , tasty ^>= 1.2- , tasty-hedgehog ^>= 1- , tasty-hunit ^>= 0.10 test-suite test@@ -163,9 +162,6 @@ , hedgehog ^>= 1 , hedgehog-fn ^>= 1 , inspection-testing ^>= 0.4- , tasty ^>= 1.2- , tasty-hedgehog ^>= 1- , tasty-hunit ^>= 0.10 , transformers @@ -197,11 +193,10 @@ build-depends: , base , fused-effects- , gauge+ , tasty-bench , transformers ghc-options: -threaded- -rtsopts "-with-rtsopts=-N -A4m -n2m" source-repository head
test/Catch.hs view
@@ -9,8 +9,6 @@ import Control.Effect.Error import Gen-import Test.Tasty-import Test.Tasty.Hedgehog tests :: TestTree tests = testGroup "Catch"
test/Choose.hs view
@@ -14,8 +14,6 @@ import Gen import qualified Monad import qualified MonadFix-import Test.Tasty-import Test.Tasty.Hedgehog tests :: TestTree tests = testGroup "Choose"
test/Cull.hs view
@@ -19,8 +19,6 @@ import qualified Monad import qualified MonadFix import qualified NonDet-import Test.Tasty-import Test.Tasty.Hedgehog tests :: TestTree tests = testGroup "Cull"
test/Cut.hs view
@@ -22,8 +22,6 @@ import qualified MonadFix import qualified NonDet import qualified Reader-import Test.Tasty-import Test.Tasty.Hedgehog tests :: TestTree tests = testGroup "Cut"
test/Cut/Church.hs view
@@ -5,13 +5,13 @@ import Control.Carrier.Cut.Church import Control.Effect.Reader-import Test.Tasty-import Test.Tasty.HUnit+import Hedgehog+import Gen tests :: TestTree tests = testGroup "Cut.Church"- [ testCase "cutfail operates through higher-order effects" $+ [ testProperty "cutfail operates through higher-order effects" . property $ runCutA @[] (local (id @()) cutfail <|> pure 'a') ()- @?=+ === runCutA @[] (cutfail <|> pure 'a') () ]
test/Empty.hs view
@@ -18,8 +18,6 @@ import Gen import qualified Monad import qualified MonadFix-import Test.Tasty-import Test.Tasty.Hedgehog tests :: TestTree tests = testGroup "Empty"
test/Error.hs view
@@ -18,7 +18,6 @@ import Gen import qualified Monad import qualified MonadFix-import Test.Tasty import qualified Throw tests :: TestTree
test/Fail.hs view
@@ -15,8 +15,6 @@ import Hedgehog.Range as Range import qualified Monad import qualified MonadFix-import Test.Tasty-import Test.Tasty.Hedgehog tests :: TestTree tests = testGroup "Fail"
test/Fresh.hs view
@@ -15,8 +15,6 @@ import qualified Hedgehog.Range as R import qualified Monad import qualified MonadFix-import Test.Tasty-import Test.Tasty.Hedgehog tests :: TestTree tests = testGroup "Fresh"
test/Fusion.hs view
@@ -9,24 +9,24 @@ import Control.Algebra import Control.Carrier.Error.Either import Control.Carrier.State.Strict-import Test.Inspection as Inspection-import Test.Tasty-import Test.Tasty.HUnit+import Gen+import Hedgehog+import Test.Inspection as Inspection hiding (property, (===)) tests :: TestTree tests = testGroup "fusion"- [ testCase "eliminates StateCs" $+ [ testProperty "eliminates StateCs" . property $ failureOf $(inspectTest $ 'countDown `doesNotUse` ''StateC)- @?= Nothing- , testCase "eliminates nested StateCs" $+ === Nothing+ , testProperty "eliminates nested StateCs" . property $ failureOf $(inspectTest $ 'countBoth `doesNotUse` ''StateC)- @?= Nothing- , testCase "eliminates catch and throw" $+ === Nothing+ , testProperty "eliminates catch and throw" . property $ failureOf $(inspectTest $ 'throwing `doesNotUse` ''ErrorC)- @?= Nothing- , testCase "eliminates calls to alg" $+ === Nothing+ , testProperty "eliminates calls to alg" . property $ failureOf $(inspectTest $ 'countDown `doesNotUse` 'alg)- @?= Nothing+ === Nothing ]
test/Gen.hs view
@@ -53,6 +53,11 @@ , infixR , pair , addLabel+ -- * Test trees+, TestTree+, checkTestTree+, testGroup+, testProperty -- * Re-exports , Gen , (===)@@ -303,3 +308,19 @@ InfixL p s _ :<*> a -> showParen True (showsPrec p a . showString " " . showString s) InfixR p s _ :<*> a -> showParen True (showsPrec (succ p) a . showString " " . showString s) f :<*> a -> showParen (d > 10) (showsPrec 10 f . showString " " . showsPrec 11 a)+++data TestTree+ = Leaf String Property+ | Branch String [TestTree]++checkTestTree :: TestTree -> IO Bool+checkTestTree = \case+ Leaf n p -> putStrLn n *> check p <* putStrLn ""+ Branch n ts -> and <$ putStrLn n <*> traverse checkTestTree ts <* putStrLn ""++testGroup :: String -> [TestTree] -> TestTree+testGroup = Branch++testProperty :: String -> Property -> TestTree+testProperty = Leaf
test/Lift.hs view
@@ -6,16 +6,16 @@ import Control.Effect.Lift import qualified Control.Exception as E import Control.Monad.IO.Class-import Test.Tasty-import Test.Tasty.HUnit+import Gen+import Hedgehog tests :: TestTree tests = testGroup "Lift"- [ testCase "liftWith" $ do+ [ testProperty "liftWith" . property $ do r <- liftIO . runState "yep" $ handle (put . getMsg) $ do modify ("heck " ++) liftIO (E.throwIO (E.AssertionFailed "nope"))- r @?= ("nope", ())+ r === ("nope", ()) ] where getMsg (E.AssertionFailed msg) = msg
test/Monad.hs view
@@ -9,8 +9,6 @@ import Control.Monad (ap, (>=>)) import Gen-import Test.Tasty-import Test.Tasty.Hedgehog test :: (Monad m, Arg a, Arg b, Eq (g a), Eq (g b), Eq (g c), Show a, Show b, Show (g a), Show (g b), Show (g c), Vary a, Vary b, Functor f)
test/MonadFix.hs view
@@ -10,8 +10,6 @@ import Control.Monad (liftM) import Control.Monad.Fix import Gen-import Test.Tasty-import Test.Tasty.Hedgehog test :: (MonadFix m, Arg a, Eq (g a), Eq (g b), Functor f, Show a, Show (g a), Show (g b), Vary a)
test/NonDet.hs view
@@ -21,8 +21,6 @@ import Gen import qualified Monad import qualified MonadFix-import Test.Tasty-import Test.Tasty.Hedgehog tests :: TestTree tests = testGroup "NonDet"
test/NonDet/Church.hs view
@@ -5,24 +5,24 @@ import Control.Carrier.Error.Either import Control.Carrier.NonDet.Church import Control.Carrier.State.Strict hiding (state)+import Gen+import Hedgehog import Prelude hiding (error)-import Test.Tasty-import Test.Tasty.HUnit tests :: TestTree tests = testGroup "NonDet.Church"- [ testCase "collects results of effects run inside it" $+ [ testProperty "collects results of effects run inside it" . property $ run (runNonDetA (runState 'a' state))- @?= [('a', 'z'), ('b', 'b'), ('a', 'a')]- , testCase "collapses results of effects run outside it" $+ === [('a', 'z'), ('b', 'b'), ('a', 'a')]+ , testProperty "collapses results of effects run outside it" . property $ run (runState 'a' (runNonDetA state))- @?= ('b', "zbb")- , testCase "collects results from higher-order effects run inside it" $+ === ('b', "zbb")+ , testProperty "collects results from higher-order effects run inside it" . property $ run (runNonDetA (runError error))- @?= [Right 'z', Right 'a' :: Either Char Char]- , testCase "collapses results of higher-order effects run outside it" $+ === [Right 'z', Right 'a' :: Either Char Char]+ , testProperty "collapses results of higher-order effects run outside it" . property $ run (runError (runNonDetA error))- @?= (Right "a" :: Either Char String)+ === (Right "a" :: Either Char String) ] state :: (Alternative m, Has (State Char) sig m) => m Char
test/Reader.hs view
@@ -22,8 +22,6 @@ import GHC.Generics ((:.:)(..)) import qualified Monad import qualified MonadFix-import Test.Tasty-import Test.Tasty.Hedgehog tests :: TestTree tests = testGroup "Reader"
test/State.hs view
@@ -26,8 +26,6 @@ import Gen import qualified Monad import qualified MonadFix-import Test.Tasty-import Test.Tasty.Hedgehog tests :: TestTree tests = testGroup "State"
test/Test.hs view
@@ -12,17 +12,18 @@ import qualified Fail import qualified Fresh import qualified Fusion+import Gen+import Hedgehog.Main import qualified Lift import qualified NonDet import qualified NonDet.Church import qualified Reader import qualified State-import Test.Tasty import qualified Throw import qualified Writer main :: IO ()-main = defaultMain $ testGroup "unit tests"+main = defaultMain $ map checkTestTree [ Catch.tests , Choose.tests , Cull.tests
test/Throw.hs view
@@ -15,8 +15,6 @@ import Gen import qualified Monad import qualified MonadFix-import Test.Tasty-import Test.Tasty.Hedgehog tests :: TestTree tests = testGroup "Throw"
test/Writer.hs view
@@ -31,8 +31,6 @@ import Gen import qualified Monad import qualified MonadFix-import Test.Tasty-import Test.Tasty.Hedgehog tests :: TestTree tests = testGroup "Writer"