diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c69237a..a4f213f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,30 +6,26 @@ on: pull_request: branches: [master] +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - uses: purescript-contrib/setup-purescript@main + - uses: actions/checkout@v6 + - uses: actions/setup-node@v6 with: - purescript: "unstable" - - - uses: actions/setup-node@v2 - with: - node-version: "14.x" + node-version: "24" - name: Install dependencies - run: | - npm install -g bower - npm install - bower install --production + run: npm install - name: Build source - run: npm run-script build + run: npm run build - name: Run tests - run: | - bower install - npm run-script test --if-present + run: npm test + + - name: Check formatting + run: npm run format:check diff --git a/.gitignore b/.gitignore index a6d3c15..043a700 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,10 @@ /.* !/.gitignore !/.github/ +!/.tidyrc.json /bower_components/ /node_modules/ /output/ -package-lock.json +/package-lock.json +/spago.lock /tmp/ diff --git a/.tidyrc.json b/.tidyrc.json new file mode 100644 index 0000000..9e39cf1 --- /dev/null +++ b/.tidyrc.json @@ -0,0 +1,10 @@ +{ + "importSort": "ide", + "importWrap": "source", + "indent": 2, + "operatorsFile": null, + "ribbon": 1, + "typeArrowPlacement": "first", + "unicode": "never", + "width": null +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c198ea..a266d9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,14 +12,22 @@ Bugfixes: Other improvements: +## [v7.1.1](https://github.com/purescript/purescript-free/releases/tag/v7.1.1) - 2026-10-17 + +Other improvements: + +- Migrate from Bower/Pulp to Spago, update CI and formatting, and remove the benchmarks (#129 by @thomashoneyman). + ## [v7.1.0](https://github.com/purescript/purescript-free/releases/tag/v7.1.0) - 2023-09-05 New features: + - Added `FoldableWithIndex` and `TraversableWithIndex` instances for `Cofree` (#126 by @postsolar) ## [v7.0.0](https://github.com/purescript/purescript-free/releases/tag/v7.0.0) - 2022-04-27 Breaking changes: + - Update project and deps to PureScript v0.15.0 (#123 by @JordanMartinez) - Drop deprecated `MonadZero` instance (#122 by @JordanMartinez) - Drop deprecated `unfoldCofree`; use `buildCofree` instead (#124 by @JordanMartinez) @@ -33,30 +41,37 @@ Other improvements: ## [v6.2.0](https://github.com/purescript/purescript-free/releases/tag/v6.2.0) - 2021-11-19 New features: + - Added a `FunctorWithIndex` instance for `Cofree` (#118 by @mikesol) Other improvements: + - Split `LICENSE` into `LICENSE` and `LICENSE_THIRDPARTY` (#119 by @maxdeviant) ## [v6.1.0](https://github.com/purescript/purescript-free/releases/tag/v6.1.0) - 2021-09-09 New features: + - Added semigroup and monoid instances for `Cofree` (#116 by @mikesol) ## [v6.0.1](https://github.com/purescript/purescript-free/releases/tag/v6.0.1) - 2021-04-20 Bugfixes: + - Removed unused constraint from `Ord1` instance (#114 by @rintcius) Other improvements: + - Fixed warnings revealed by v0.14.1 PS release (#115 by @JordanMartinez) ## [v6.0.0](https://github.com/purescript/purescript-free/releases/tag/v6.0.0) - 2021-02-26 Breaking changes: + - Added support for PureScript 0.14 and dropped support for all previous versions (#106, #110) Other improvements: + - Migrated CI to GitHub Actions and updated installation instructions to use Spago (#108) - Added a CHANGELOG.md file and pull request template (#111, #112) - Updated benchmarks (#103) @@ -232,6 +247,7 @@ This release works with versions 0.7.\* of the PureScript compiler. It will not ## [v0.3.0](https://github.com/purescript/purescript-free/releases/tag/v0.3.0) - 2015-02-21 **This release requires PureScript v0.6.8 or later** + - Updated dependencies ## [v0.2.0](https://github.com/purescript/purescript-free/releases/tag/v0.2.0) - 2015-01-10 diff --git a/README.md b/README.md index 7ef0fe4..7927b52 100644 --- a/README.md +++ b/README.md @@ -21,15 +21,3 @@ spago install free ## Documentation Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-free). - -## Benchmarks - -The following benchmarks compare the implementation at `v5.2.0` (commit f686f5fc07766f3ca9abc83b47b6ad3da326759a) with the implementation at `v0.6.1` (commit 0df59c5d459fed983131856886fc3a4b43234f1f), which used the `Gosub` technique to defer monadic binds. - -![left-bind-small](benchmark/left-bind-small.png) - -![left-bind-large](benchmark/left-bind-large.png) - -![right-bind-small](benchmark/right-bind-small.png) - -![right-bind-large](benchmark/right-bind-large.png) diff --git a/benchmark/Benchmark/Free0df59c5.purs b/benchmark/Benchmark/Free0df59c5.purs deleted file mode 100644 index 553089a..0000000 --- a/benchmark/Benchmark/Free0df59c5.purs +++ /dev/null @@ -1,192 +0,0 @@ -module Benchmark.Free0df59c5 - ( Free(..) - , GosubF - , FreeC(..) - , class MonadFree - , wrap - , Natural - , liftF - , liftFI - , liftFC - , liftFCI - , pureF - , pureFC - , mapF - , mapFC - , bindF - , bindFC - , injF - , injFC - , runFree - , runFreeM - , runFreeC - , runFreeCM - ) where - -import Prelude - -import Control.Monad.Rec.Class (class MonadRec, Step(..), tailRecM) -import Control.Monad.Trans.Class (class MonadTrans) -import Data.Coyoneda (Coyoneda, hoistCoyoneda, liftCoyoneda, lowerCoyoneda) -import Data.Either (Either(..), either) -import Data.Exists (Exists, mkExists, runExists) -import Data.Functor.Coproduct.Inject (class Inject, inj) -import Data.Identity (Identity(..)) -import Data.Newtype (unwrap) -import Partial.Unsafe (unsafePartialBecause) - -type Natural f g = forall a. f a -> g a - -newtype GosubF f a i = GosubF { a :: Unit -> Free f i, f :: i -> Free f a } - -gosub :: forall f a i. (Unit -> Free f i) -> (i -> Free f a) -> Free f a -gosub a f = Gosub $ mkExists $ GosubF { a: a, f: f} - --- | The free `Monad` for a `Functor`. --- | --- | The implementation defers the evaluation of monadic binds so that it --- | is safe to use monadic tail recursion, for example. -data Free f a = Pure a - | Free (f (Free f a)) - | Gosub (Exists (GosubF f a)) - --- | The free `Monad` for an arbitrary type constructor. -type FreeC f = Free (Coyoneda f) - --- | The `MonadFree` class provides the `wrap` function, which lifts --- | actions described by a generating functor into a monad. --- | --- | The canonical instance of `MonadFree f` is `Free f`. -class MonadFree f m where - wrap :: forall a. f (m a) -> m a - -instance functorFree :: Functor f => Functor (Free f) where - map f (Pure a) = Pure (f a) - map f g = liftA1 f g - -instance applyFree :: Functor f => Apply (Free f) where - apply = ap - -instance applicativeFree :: Functor f => Applicative (Free f) where - pure = Pure - -instance bindFree :: Functor f => Bind (Free f) where - bind (Gosub g) k = runExists (\(GosubF v) -> gosub v.a (\x -> gosub (\unit -> v.f x) k)) g - bind a k = gosub (\unit -> a) k - -instance monadFree :: Functor f => Monad (Free f) - -instance monadTransFree :: MonadTrans Free where - lift f = Free $ do - a <- f - pure (Pure a) - -instance monadFreeFree :: Functor f => MonadFree f (Free f) where - wrap = Free - -instance monadRecFree :: Functor f => MonadRec (Free f) where - tailRecM f u = f u >>= \o -> case o of - Loop a -> tailRecM f a - Done b -> pure b - --- | Lift an action described by the generating functor `f` into the monad `m` --- | (usually `Free f`). -liftF :: forall f m a. Functor f => Monad m => MonadFree f m => f a -> m a -liftF = wrap <<< map pure - --- | Lift an action described by the generating type constructor `f` into --- | `Free g` using `Inject` to go from `f` to `g`. -liftFI :: forall f g a. Inject f g => Functor g => f a -> Free g a -liftFI fa = liftF (inj fa :: g a) - --- | Lift an action described by the generating type constructor `f` into the monad --- | `FreeC f`. -liftFC :: forall f a. f a -> FreeC f a -liftFC = liftF <<< liftCoyoneda - --- | Lift an action described by the generating type constructor `f` into --- | `FreeC g` using `Inject` to go from `f` to `g`. -liftFCI :: forall f g a. Inject f g => f a -> FreeC g a -liftFCI fa = liftFC (inj fa :: g a) - --- | An implementation of `pure` for the `Free` monad. -pureF :: forall f a. Applicative f => a -> Free f a -pureF = Free <<< pure <<< Pure - --- | An implementation of `pure` for the `FreeC` monad. -pureFC :: forall f a. Applicative f => a -> FreeC f a -pureFC = liftFC <<< pure - --- | Use a natural transformation to change the generating functor of a `Free` monad. -mapF :: forall f g a. Functor f => Functor g => Natural f g -> Free f a -> Free g a -mapF t fa = either (\s -> Free <<< t $ mapF t <$> s) Pure (resume fa) - --- | Use a natural transformation to change the generating type constructor of --- | a `FreeC` monad to another functor. -mapFC :: forall f g a. Functor g => Natural f g -> FreeC f a -> Free g a -mapFC t = mapF (lowerCoyoneda <<< hoistCoyoneda t) - --- | Use a natural transformation to interpret one `Free` monad as another. -bindF :: forall f g a. Functor f => Functor g => Free f a -> Natural f (Free g) -> Free g a -bindF fa t = either (\m -> t m >>= \fa' -> bindF fa' t) Pure (resume fa) - --- | Use a natural transformation to interpret a `FreeC` monad as a different --- | `Free` monad. -bindFC :: forall f g a. Functor g => FreeC f a -> Natural f (Free g) -> Free g a -bindFC fa t = bindF fa (lowerCoyoneda <<< hoistCoyoneda t) - --- | Embed computations in one `Free` monad as computations in the `Free` monad for --- | a coproduct type constructor. --- | --- | This construction allows us to write computations which are polymorphic in the --- | particular `Free` monad we use, allowing us to extend the functionality of --- | our monad later. -injF :: forall f g a. Functor f => Functor g => Inject f g => Free f a -> Free g a -injF = mapF inj - --- | Embed computations in one `FreeC` monad as computations in the `FreeC` monad for --- | a coproduct type constructor. --- | --- | This construction allows us to write computations which are polymorphic in the --- | particular `Free` monad we use, allowing us to extend the functionality of --- | our monad later. -injFC :: forall f g a. Inject f g => FreeC f a -> FreeC g a -injFC = mapF (hoistCoyoneda inj) - -resume :: forall f a. Functor f => Free f a -> Either (f (Free f a)) a -resume f = case f of - Pure x -> Right x - Free x -> Left x - g -> unsafePartialBecause "Existing implementation." case resumeGosub g of - Left l -> Left l - Right r -> resume r - where - resumeGosub :: Partial => Free f a -> Either (f (Free f a)) (Free f a) - resumeGosub (Gosub g) = - runExists (\(GosubF v) -> case v.a unit of - Pure a -> Right (v.f a) - Free t -> Left ((\h -> h >>= v.f) <$> t) - Gosub h -> runExists (\(GosubF w) -> Right (w.a unit >>= (\z -> w.f z >>= v.f))) h) g - --- | `runFree` runs a computation of type `Free f a`, using a function which unwraps a single layer of --- | the functor `f` at a time. -runFree :: forall f a. Functor f => (f (Free f a) -> Free f a) -> Free f a -> a -runFree fn = unwrap <<< runFreeM (Identity <<< fn) - --- | `runFreeM` runs a compuation of type `Free f a` in any `Monad` which supports tail recursion. --- | See the `MonadRec` type class for more details. -runFreeM :: forall f m a. Functor f => MonadRec m => (f (Free f a) -> m (Free f a)) -> Free f a -> m a -runFreeM fn = tailRecM \f -> - case resume f of - Left fs -> Loop <$> fn fs - Right a -> pure (Done a) - --- | `runFreeC` is the equivalent of `runFree` for type constructors transformed with `Coyoneda`, --- | hence we have no requirement that `f` be a `Functor`. -runFreeC :: forall f a. (forall b. f b -> b) -> FreeC f a -> a -runFreeC nat = unwrap <<< runFreeCM (Identity <<< nat) - --- | `runFreeCM` is the equivalent of `runFreeM` for type constructors transformed with `Coyoneda`, --- | hence we have no requirement that `f` be a `Functor`. -runFreeCM :: forall f m a. (MonadRec m) => Natural f m -> FreeC f a -> m a -runFreeCM nat = runFreeM (lowerCoyoneda <<< hoistCoyoneda nat) diff --git a/benchmark/Benchmark/Freef686f5f.purs b/benchmark/Benchmark/Freef686f5f.purs deleted file mode 100644 index 82245f9..0000000 --- a/benchmark/Benchmark/Freef686f5f.purs +++ /dev/null @@ -1,245 +0,0 @@ -module Benchmark.Freef686f5f - ( Free - , suspendF - , wrap - , liftF - , hoistFree - , foldFree - , substFree - , runFree - , runFreeM - , resume - , resume' - ) where - -import Prelude - -import Control.Apply (lift2) -import Control.Monad.Rec.Class (class MonadRec, Step(..), tailRecM) -import Control.Monad.Trans.Class (class MonadTrans) - -import Data.CatList (CatList, empty, snoc, uncons) -import Data.Either (Either(..)) -import Data.Eq (class Eq1, eq1) -import Data.Foldable (class Foldable, foldMap, foldl, foldr) -import Data.Maybe (Maybe(..)) -import Data.Ord (class Ord1, compare1) -import Data.Traversable (class Traversable, traverse) -import Data.Tuple (Tuple(..)) - -import Unsafe.Coerce (unsafeCoerce) - --- | The free monad for a type constructor `f`. --- | --- | Implemented in the spirit of [Reflection without Remorse](http://okmij.org/ftp/Haskell/zseq.pdf), --- | the free monad is represented using a sequential data structure in --- | order to overcome the quadratic complexity of left-associated binds --- | and traversal through the free monad structure. -data Free f a = Free (FreeView f Val Val) (CatList (ExpF f)) - -newtype ExpF f = ExpF (Val -> Free f Val) - -data FreeView f a b = Return a | Bind (f b) (b -> Free f a) - -data Val - -instance eqFree :: (Functor f, Eq1 f, Eq a) => Eq (Free f a) where - eq x y = case resume x, resume y of - Left fa, Left fb -> eq1 fa fb - Right a, Right b -> a == b - _, _ -> false - -instance eq1Free :: (Functor f, Eq1 f) => Eq1 (Free f) where - eq1 = eq - -instance ordFree :: (Functor f, Ord1 f, Ord a) => Ord (Free f a) where - compare x y = case resume x, resume y of - Left fa, Left fb -> compare1 fa fb - Left _, _ -> LT - _, Left _ -> GT - Right a, Right b -> compare a b - -instance ord1Free :: (Functor f, Ord1 f, Ord a) => Ord1 (Free f) where - compare1 = compare - -instance freeFunctor :: Functor (Free f) where - map k f = pure <<< k =<< f - -instance freeBind :: Bind (Free f) where - bind (Free v s) k = Free v (snoc s (ExpF (unsafeCoerceBind k))) - where - unsafeCoerceBind :: forall a b. (a -> Free f b) -> Val -> Free f Val - unsafeCoerceBind = unsafeCoerce - -instance freeApplicative :: Applicative (Free f) where - pure = fromView <<< Return - -instance freeApply :: Apply (Free f) where - apply = ap - -instance freeMonad :: Monad (Free f) - -instance freeMonadTrans :: MonadTrans Free where - lift = liftF - -instance freeMonadRec :: MonadRec (Free f) where - tailRecM k a = k a >>= case _ of - Loop b -> tailRecM k b - Done r -> pure r - -instance foldableFree :: (Functor f, Foldable f) => Foldable (Free f) where - foldMap f = go - where - go = resume >>> case _ of - Left fa -> foldMap go fa - Right a -> f a - foldl f = go - where - go r = resume >>> case _ of - Left fa -> foldl go r fa - Right a -> f r a - foldr f = go - where - go r = resume >>> case _ of - Left fa -> foldr (flip go) r fa - Right a -> f a r - -instance traversableFree :: Traversable f => Traversable (Free f) where - traverse f = go - where - go = resume >>> case _ of - Left fa -> join <<< liftF <$> traverse go fa - Right a -> pure <$> f a - sequence tma = traverse identity tma - -instance semigroupFree :: Semigroup a => Semigroup (Free f a) where - append = lift2 append - -instance monoidFree :: Monoid a => Monoid (Free f a) where - mempty = pure mempty - --- | Lift an impure value described by the generating type constructor `f` into --- | the free monad. -liftF :: forall f. f ~> Free f -liftF f = fromView (Bind (unsafeCoerceF f) (pure <<< unsafeCoerceVal)) - where - unsafeCoerceF :: forall a. f a -> f Val - unsafeCoerceF = unsafeCoerce - - unsafeCoerceVal :: forall a. Val -> a - unsafeCoerceVal = unsafeCoerce - --- | Add a layer. -wrap :: forall f a. f (Free f a) -> Free f a -wrap f = fromView (Bind (unsafeCoerceF f) unsafeCoerceVal) - where - unsafeCoerceF :: forall b. f (Free f b) -> f Val - unsafeCoerceF = unsafeCoerce - - unsafeCoerceVal :: forall b. Val -> Free f b - unsafeCoerceVal = unsafeCoerce - --- | Suspend a value given the applicative functor `f` into the free monad. -suspendF :: forall f. Applicative f => Free f ~> Free f -suspendF f = wrap (pure f) - --- | Use a natural transformation to change the generating type constructor of a --- | free monad. -hoistFree :: forall f g. (f ~> g) -> Free f ~> Free g -hoistFree k = substFree (liftF <<< k) - --- | Run a free monad with a natural transformation from the type constructor `f` --- | to the tail-recursive monad `m`. See the `MonadRec` type class for more --- | details. -foldFree :: forall f m. MonadRec m => (f ~> m) -> Free f ~> m -foldFree k = tailRecM go - where - go :: forall a. Free f a -> m (Step (Free f a) a) - go f = case toView f of - Return a -> Done <$> pure a - Bind g i -> (Loop <<< i) <$> k g - --- | Like `foldFree`, but for folding into some other Free monad without the --- | overhead that `MonadRec` incurs. -substFree :: forall f g. (f ~> Free g) -> Free f ~> Free g -substFree k = go - where - go :: Free f ~> Free g - go f = case toView f of - Return a -> pure a - Bind g i -> k g >>= go <$> i - --- | Run a free monad with a function that unwraps a single layer of the functor --- | `f` at a time. -runFree :: forall f a. Functor f => (f (Free f a) -> Free f a) -> Free f a -> a -runFree k = go - where - go :: Free f a -> a - go f = case toView f of - Return a -> a - Bind g i -> go (k (i <$> g)) - --- | Run a free monad with a function mapping a functor `f` to a tail-recursive --- | monad `m`. See the `MonadRec` type class for more details. -runFreeM - :: forall f m a - . Functor f - => MonadRec m - => (f (Free f a) -> m (Free f a)) - -> Free f a - -> m a -runFreeM k = tailRecM go - where - go :: Free f a -> m (Step (Free f a) a) - go f = case toView f of - Return a -> Done <$> pure a - Bind g i -> Loop <$> k (i <$> g) - --- | Unwraps a single layer of the functor `f`. -resume - :: forall f a - . Functor f - => Free f a - -> Either (f (Free f a)) a -resume = resume' (\g i -> Left (i <$> g)) Right - --- | Unwraps a single layer of `f`, providing the continuation. -resume' - :: forall f a r - . (forall b. f b -> (b -> Free f a) -> r) - -> (a -> r) - -> Free f a - -> r -resume' k j f = case toView f of - Return a -> j a - Bind g i -> k g i - -fromView :: forall f a. FreeView f a Val -> Free f a -fromView f = Free (unsafeCoerceFreeView f) empty - where - unsafeCoerceFreeView :: FreeView f a Val -> FreeView f Val Val - unsafeCoerceFreeView = unsafeCoerce - -toView :: forall f a. Free f a -> FreeView f a Val -toView (Free v s) = - case v of - Return a -> - case uncons s of - Nothing -> - Return (unsafeCoerceVal a) - Just (Tuple h t) -> - toView (unsafeCoerceFree (concatF ((runExpF h) a) t)) - Bind f k -> - Bind f (\a -> unsafeCoerceFree (concatF (k a) s)) - where - concatF :: Free f Val -> CatList (ExpF f) -> Free f Val - concatF (Free v' l) r = Free v' (l <> r) - - runExpF :: ExpF f -> (Val -> Free f Val) - runExpF (ExpF k) = k - - unsafeCoerceFree :: Free f Val -> Free f a - unsafeCoerceFree = unsafeCoerce - - unsafeCoerceVal :: Val -> a - unsafeCoerceVal = unsafeCoerce diff --git a/benchmark/Benchmark/Main.purs b/benchmark/Benchmark/Main.purs deleted file mode 100644 index 207faec..0000000 --- a/benchmark/Benchmark/Main.purs +++ /dev/null @@ -1,142 +0,0 @@ -module Benchmark.Main (main) where - -import Prelude - -import Benchmark.Freef686f5f as Freef686f5f -import Benchmark.Trampoline0df59c5 as Trampoline0df59c5 -import Benchmark.Trampolinef686f5f as Trampolinef686f5f -import Benchotron.Core (Benchmark, benchFn, mkBenchmark) -import Benchotron.UI.Console (runSuite) -import Data.Foldable (foldl) -import Effect (Effect) -import Test.QuickCheck.Gen (vectorOf) - -main :: Effect Unit -main = - runSuite - [ leftBindSmallBenchmark - , rightBindSmallBenchmark - , leftBindLargeBenchmark - , rightBindLargeBenchmark - ] - -leftBindSmallBenchmark :: Benchmark -leftBindSmallBenchmark = - mkBenchmark - { slug: "left-bind-small" - , title: "Left associated binds (small - " <> show inputsPerSize <> " inputs per size)" - , sizes: [1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 100, 250, 500, 1000] - , sizeInterpretation: "Number of binds" - , inputsPerSize: inputsPerSize - , gen: \n -> vectorOf n (pure 0.0) - , functions: - [ benchFn "Free v5.2.0" (Trampolinef686f5f.runTrampoline <<< binds) - , benchFn "Free v0.6.1" (Trampoline0df59c5.runTrampoline <<< bindsT) - ] - } - where - inputsPerSize :: Int - inputsPerSize = 100 - - binds :: Array Number -> Trampolinef686f5f.Trampoline Number - binds as = foldl (\b a -> b >>= const (gen a)) (gen 0.0) as - - gen :: forall a. a -> Trampolinef686f5f.Trampoline a - gen = Freef686f5f.suspendF <<< Trampolinef686f5f.done - - bindsT :: Array Number -> Trampoline0df59c5.Trampoline Number - bindsT as = foldl (\b a -> b >>= const (genT a)) (genT 0.0) as - - genT :: forall a. a -> Trampoline0df59c5.Trampoline a - genT = Trampoline0df59c5.suspend <<< Trampoline0df59c5.done - -rightBindSmallBenchmark :: Benchmark -rightBindSmallBenchmark = - mkBenchmark - { slug: "right-bind-small" - , title: "Right associated binds (small - " <> show inputsPerSize <> " inputs per size)" - , sizes: [1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 100, 250, 500, 1000] - , sizeInterpretation: "Number of binds" - , inputsPerSize: inputsPerSize - , gen: \n -> vectorOf n (pure 0.0) - , functions: - [ benchFn "Free v5.2.0" (Trampolinef686f5f.runTrampoline <<< binds) - , benchFn "Free v0.6.1" (Trampoline0df59c5.runTrampoline <<< bindsT) - ] - } - where - inputsPerSize :: Int - inputsPerSize = 100 - - binds :: Array Number -> Trampolinef686f5f.Trampoline Number - binds as = foldl (\b a -> gen a >>= const b) (gen 0.0) as - - gen :: forall a. a -> Trampolinef686f5f.Trampoline a - gen = Freef686f5f.suspendF <<< Trampolinef686f5f.done - - bindsT :: Array Number -> Trampoline0df59c5.Trampoline Number - bindsT as = foldl (\b a -> genT a >>= const b) (genT 0.0) as - - genT :: forall a. a -> Trampoline0df59c5.Trampoline a - genT = Trampoline0df59c5.suspend <<< Trampoline0df59c5.done - -leftBindLargeBenchmark :: Benchmark -leftBindLargeBenchmark = - mkBenchmark - { slug: "left-bind-large" - , title: "Left associated binds (large - " <> show inputsPerSize <> " input per size)" - , sizes: [1, 5, 10, 15, 20, 25, 30 ] <#> (_ * 100_000) - , sizeInterpretation: "Number of binds" - , inputsPerSize: inputsPerSize - , gen: \n -> vectorOf n (pure 0.0) - , functions: - [ benchFn "Free v5.2.0" (Trampolinef686f5f.runTrampoline <<< binds) - -- Disabled due to stack overflow - -- , benchFn "Free v0.6.1" (Trampoline0df59c5.runTrampoline <<< bindsT) - ] - } - where - inputsPerSize :: Int - inputsPerSize = 1 - - binds :: Array Number -> Trampolinef686f5f.Trampoline Number - binds as = foldl (\b a -> b >>= const (gen a)) (gen 0.0) as - - gen :: forall a. a -> Trampolinef686f5f.Trampoline a - gen = Freef686f5f.suspendF <<< Trampolinef686f5f.done - - bindsT :: Array Number -> Trampoline0df59c5.Trampoline Number - bindsT as = foldl (\b a -> b >>= const (genT a)) (genT 0.0) as - - genT :: forall a. a -> Trampoline0df59c5.Trampoline a - genT = Trampoline0df59c5.suspend <<< Trampoline0df59c5.done - -rightBindLargeBenchmark :: Benchmark -rightBindLargeBenchmark = - mkBenchmark - { slug: "right-bind-large" - , title: "Right associated binds (large - " <> show inputsPerSize <> " input per size)" - , sizes: [1, 5, 10, 15, 20, 25, 30 ] <#> (_ * 100_000) - , sizeInterpretation: "Number of binds" - , inputsPerSize: inputsPerSize - , gen: \n -> vectorOf n (pure 0.0) - , functions: - [ benchFn "Free v5.2.0" (Trampolinef686f5f.runTrampoline <<< binds) - , benchFn "Free v0.6.1" (Trampoline0df59c5.runTrampoline <<< bindsT) - ] - } - where - inputsPerSize :: Int - inputsPerSize = 1 - - binds :: Array Number -> Trampolinef686f5f.Trampoline Number - binds as = foldl (\b a -> gen a >>= const b) (gen 0.0) as - - gen :: forall a. a -> Trampolinef686f5f.Trampoline a - gen = Freef686f5f.suspendF <<< Trampolinef686f5f.done - - bindsT :: Array Number -> Trampoline0df59c5.Trampoline Number - bindsT as = foldl (\b a -> genT a >>= const b) (genT 0.0) as - - genT :: forall a. a -> Trampoline0df59c5.Trampoline a - genT = Trampoline0df59c5.suspend <<< Trampoline0df59c5.done diff --git a/benchmark/Benchmark/Trampoline0df59c5.purs b/benchmark/Benchmark/Trampoline0df59c5.purs deleted file mode 100644 index 0bc2d48..0000000 --- a/benchmark/Benchmark/Trampoline0df59c5.purs +++ /dev/null @@ -1,43 +0,0 @@ --- | A _trampoline_ monad, which can be used at the bottom of --- | a monad transformer stack to avoid stack overflows in large --- | monadic computations. - -module Benchmark.Trampoline0df59c5 - ( Trampoline() - , done - , suspend - , delay' - , delay - , runTrampoline - ) where - -import Prelude - -import Benchmark.Free0df59c5 (Free(..), runFree) -import Data.Lazy (Lazy, defer, force) - --- | The `Trampoline` monad --- | --- | A computation of type `Trampoline a` consists of zero or more lazy --- | suspensions before a value is returned. -type Trampoline = Free Lazy - --- | Return a value immediately -done :: forall a. a -> Trampoline a -done = pure - --- | Suspend a computation by one step. -suspend :: forall a. Trampoline a -> Trampoline a -suspend t = Free (defer (const t)) - --- | Use the `Trampoline` monad to represent a `Lazy` value. -delay' :: forall a. Lazy a -> Trampoline a -delay' a = Free (done <$> a) - --- | Use the `Trampoline` monad to represent the delayed evaluation of a value. -delay :: forall a. (Unit -> a) -> Trampoline a -delay = delay' <<< defer - --- | Run a computation in the `Trampoline` monad. -runTrampoline :: forall a. Trampoline a -> a -runTrampoline = runFree force diff --git a/benchmark/Benchmark/Trampolinef686f5f.purs b/benchmark/Benchmark/Trampolinef686f5f.purs deleted file mode 100644 index 90dd73c..0000000 --- a/benchmark/Benchmark/Trampolinef686f5f.purs +++ /dev/null @@ -1,31 +0,0 @@ --- | A _trampoline_ monad, which can be used at the bottom of --- | a monad transformer stack to avoid stack overflows in large --- | monadic computations. -module Benchmark.Trampolinef686f5f - ( Trampoline - , done - , delay - , runTrampoline - ) where - -import Prelude - -import Benchmark.Freef686f5f (Free, liftF, runFree) - --- | The `Trampoline` monad --- | --- | A computation of type `Trampoline a` consists of zero or more lazy --- | suspensions before a value is returned. -type Trampoline = Free ((->) Unit) - --- | Return a value immediately -done :: forall a. a -> Trampoline a -done = pure - --- | Use the `Trampoline` monad to represent the delayed evaluation of a value. -delay :: forall a. (Unit -> a) -> Trampoline a -delay = liftF - --- | Run a computation in the `Trampoline` monad. -runTrampoline :: forall a. Trampoline a -> a -runTrampoline = runFree (_ $ unit) diff --git a/benchmark/left-bind-large.json b/benchmark/left-bind-large.json deleted file mode 100644 index 2346c7d..0000000 --- a/benchmark/left-bind-large.json +++ /dev/null @@ -1 +0,0 @@ -{"slug":"left-bind-large","title":"Left associated binds (large - 1 input per size)","sizeInterpretation":"Number of binds","series":[{"name":"Free","results":[{"size":100000,"stats":{"moe":0.2956101016555821,"rme":14.39112929360249,"sem":0.11497864708501832,"deviation":0.2816390166738393,"mean":2.0541133056666667,"variance":0.07932053571300712,"sample":[1.7958541160000001,1.872374945,2.288292841,2.511392654,1.954026152,1.902739126]}},{"size":500000,"stats":{"rme":12.595494771361663,"deviation":1.0926834185433445,"mean":10.769947354,"variance":1.1939570531595698,"moe":1.3565281558514735,"sem":0.4886628803499545,"sample":[9.71459062,10.96870124,10.954100764,12.402810162,9.809533984]}},{"size":1000000,"stats":{"rme":102.65855299659903,"deviation":32.67164802409972,"mean":39.5103032394,"variance":1067.4365846106589,"moe":40.560705590136436,"sem":14.61120518376673,"sample":[97.227805073,33.411728362,22.214333973,19.793394896,24.904253893]}},{"size":1500000,"stats":{"rme":91.58067102417942,"deviation":42.97479006541146,"mean":58.25650174980001,"variance":1846.8325811661878,"moe":53.351695217679676,"sem":19.21891038100853,"sample":[134.934246698,44.415789815,37.506067285,37.396271162,37.030133789]}},{"size":2000000,"stats":{"rme":40.897353243454894,"deviation":24.960889781868154,"mean":75.77035457179998,"variance":623.0460187025701,"moe":30.98806956304731,"sem":11.162849266227418,"sample":[119.192609228,62.194457431,74.893429245,62.286611382,60.284665573]}},{"size":2500000,"stats":{"rme":24.226438792294573,"deviation":15.148886076686232,"mean":77.62928395,"variance":229.48874936441797,"moe":18.806810961043304,"sem":6.774787810174101,"sample":[104.234941609,68.549368142,75.577693107,68.529232435,71.255184457]}},{"size":3000000,"stats":{"rme":0.9036291855144747,"deviation":0.5496231347585575,"mean":75.510824967,"variance":0.30208559026182347,"moe":0.6823378526245627,"sem":0.2457989382653324,"sample":[76.015258776,76.161614772,74.961221678,75.357864327,75.058165282]}}]},{"name":"Free v0.6.1","results":[{"size":100000,"stats":{"rme":13.464786421416749,"deviation":0.44150101594625923,"mean":4.0706775109999995,"variance":0.19492314708157904,"moe":0.5481080327607932,"sem":0.19744525675821084,"sample":[3.66077755,4.339257057,4.29966785,4.518401322,3.535283776]}},{"size":500000,"stats":{"rme":44.6759194868656,"deviation":24.372315398627084,"mean":67.726362319,"variance":594.0097578901549,"moe":30.257375101019324,"sem":10.899630800079008,"sample":[34.012386673,55.145016748,82.421494614,70.000856272,97.052057288]}},{"size":1000000,"stats":{"rme":17.61229588902891,"deviation":20.387979711109995,"mean":143.711882828,"variance":415.6697167006329,"moe":25.310962031361885,"sem":9.117781711585694,"sample":[107.627165983,157.551595375,150.54147385,152.756308747,150.082870185]}},{"size":1500000,"stats":{"rme":7.168686647443891,"deviation":12.729640772372832,"mean":220.45046057960002,"variance":162.0437541936568,"moe":15.803402731798345,"sem":5.692868419235715,"sample":[206.630076621,212.397207164,220.711863941,222.348590939,240.164564233]}},{"size":2000000,"stats":{"rme":11.062031748305523,"deviation":29.44693059250524,"mean":330.47574609820003,"variance":867.121721319821,"moe":36.55733195383244,"sem":13.169067706711974,"sample":[278.870463631,338.792022116,339.805939187,341.431522044,353.478783513]}},{"size":2500000,"stats":{"rme":3.244145393596063,"deviation":9.32213107277591,"mean":356.7379848668,"variance":86.90212773801416,"moe":11.573098903263713,"sem":4.168983754777995,"sample":[345.987214502,355.449872606,353.704699248,371.608380984,356.939756994]}},{"size":3000000,"stats":{"rme":5.2069916890538925,"deviation":17.865549890153357,"mean":425.9552380094,"variance":319.1778728775587,"moe":22.179453842239184,"sem":7.989716801959361,"sample":[423.433975557,438.419904645,436.876036402,395.799223561,435.247049882]}}]}]} diff --git a/benchmark/left-bind-large.png b/benchmark/left-bind-large.png deleted file mode 100644 index fc979b8..0000000 Binary files a/benchmark/left-bind-large.png and /dev/null differ diff --git a/benchmark/left-bind-small.json b/benchmark/left-bind-small.json deleted file mode 100644 index df1a9ce..0000000 --- a/benchmark/left-bind-small.json +++ /dev/null @@ -1 +0,0 @@ -{"slug":"left-bind-small","title":"Left associated binds (small - 100 inputs per size)","sizeInterpretation":"Number of binds","series":[{"name":"Free","results":[{"size":1,"stats":{"moe":0.0002552396452441629,"rme":10.488846513381104,"sem":0.00013022430879804228,"deviation":0.0010170843655850777,"mean":0.002433438652367941,"variance":0.0000010344606067176,"sample":[0.0039486718,0.0035355652,0.0036191946,0.0016963445,0.0016091770625,0.0018094969375,0.001768847888888889,0.0014602111388888888,0.0018064448055555556,0.0016578250555555557,0.0014646249166666665,0.0017390423333333333,0.0014830704444444445,0.0015771075277777778,0.001664818361111111,0.0015163020555555556,0.002596861638888889,0.0031630854444444443,0.003092734472222222,0.0029241114444444444,0.0028705598333333333,0.0016454055833333332,0.001711620861111111,0.0016900070833333334,0.0014959885555555557,0.0014836878333333334,0.0015052755833333334,0.001788427138888889,0.0014512297777777778,0.0014522022777777779,0.0019536894722222225,0.0024363785277777775,0.0029895754999999997,0.0037041276388888886,0.0034885652777777772,0.0030373121944444444,0.0024320685833333334,0.0029131954444444447,0.0026020054722222224,0.003052439472222222,0.0029362796111111113,0.003079990138888889,0.003035265194444444,0.006503356361111112,0.004779550083333333,0.004934420416666667,0.00323369375,0.0018781574722222224,0.0025841495833333335,0.00179031525,0.0017129315833333332,0.0018879475555555554,0.0015875140555555555,0.0017556328333333334,0.0017726653333333332,0.00164373475,0.0017631573333333334,0.0020732539166666668,0.0031871428333333333,0.003042760888888889,0.0034205391111111114]}},{"size":2,"stats":{"rme":13.273266950760515,"deviation":0.0021950139243280247,"mean":0.004331332343537417,"variance":0.000004818086127993915,"moe":0.0005749093044823528,"sem":0.0002933210737154861,"sample":[0.0039336455714285715,0.002869311523809524,0.0033681905714285716,0.004006681238095238,0.003035744857142857,0.0035403969047619046,0.004620695476190476,0.004139437285714286,0.005022591904761904,0.007341679428571429,0.009562048904761904,0.0064429179047619045,0.004964747,0.003206654095238095,0.003663248238095238,0.003422980238095238,0.003547155619047619,0.003276085761904762,0.003538400761904762,0.0034188595238095238,0.0035068348095238094,0.008298172714285715,0.01652297566666667,0.0033820317619047617,0.0034403469523809523,0.0029582179047619047,0.0029850279047619046,0.0033098496666666664,0.003237449904761905,0.0033115743333333334,0.003109104619047619,0.003008495904761905,0.0032912558095238094,0.003140042619047619,0.004436925952380952,0.005841434666666667,0.005683290190476191,0.005824430571428571,0.004936367,0.003123343904761905,0.003056350047619048,0.0031864456190476187,0.004215455142857143,0.004913718571428571,0.003412681571428571,0.0029259104761904763,0.0031821540476190476,0.0034887706666666663,0.003014242761904762,0.006136003428571428,0.006840230571428571,0.004696864619047619,0.0032181907142857145,0.0037648729999999997,0.002968609142857143,0.0032654651904761903]}},{"size":3,"stats":{"rme":6.470985918969754,"deviation":0.0015436796466411341,"mean":0.005712226152698048,"variance":0.000002382946851454097,"moe":0.00036963735000079844,"sem":0.00018859048469428493,"sample":[0.007778895,0.005844431846153846,0.005382359999999999,0.004743467846153846,0.007507394538461539,0.008426685692307692,0.004655098461538462,0.005786476384615384,0.004850101076923076,0.0050011261538461535,0.004712081384615385,0.004931171307692308,0.004543063,0.005600400769230769,0.004334335846153847,0.005518897461538461,0.005784022692307693,0.004827880923076923,0.004425803769230769,0.005326636230769231,0.004582035769230769,0.005139928615384615,0.008890097846153846,0.008353854769230768,0.00865039723076923,0.009909505538461538,0.005248373076923076,0.006083129230769231,0.004234217615384616,0.005030254999999999,0.005296868769230769,0.004742823461538461,0.004223510076923077,0.005023698769230769,0.004276470769230769,0.004699187923076923,0.004862148538461538,0.00637102,0.008056447384615384,0.008743886615384614,0.008585705461538461,0.007934472461538462,0.004897112538461539,0.003994243461538462,0.004390586615384615,0.004988542692307692,0.0046407471538461535,0.004183789692307692,0.005637116923076923,0.0038752725384615383,0.00452943023076923,0.004211434538461538,0.004948777692307693,0.004232149846153846,0.0063883213846153844,0.008749506846153847,0.008443853461538461,0.007229518923076924,0.005391123615384615,0.004077244307692308,0.004745374384615385,0.0051690306153846155,0.006065091230769231,0.006800881384615385,0.006884926230769231,0.004458918846153846,0.004867791769230769]}},{"size":4,"stats":{"rme":7.316025786941184,"deviation":0.0023496435575443117,"mean":0.0077483790912457945,"variance":0.000005520824847509489,"moe":0.0005668734123855013,"sem":0.0002892211287681129,"sample":[0.010926924666666666,0.015849782833333333,0.010118213833333334,0.010640174666666667,0.010602080333333333,0.006744016333333333,0.006256407,0.006167282111111111,0.006629436444444445,0.005880073222222223,0.0065147362222222225,0.006765934666666667,0.006359928666666666,0.007059587333333333,0.006296072888888889,0.0063365007,0.0097455376,0.0111037415,0.0119827152,0.010145258899999999,0.0089865379,0.006231237,0.0061933367000000005,0.0066719027,0.0069704704000000004,0.0059092401,0.0059322061,0.0055762401,0.0052496255,0.0062842995999999995,0.0057870191000000005,0.0052720451,0.0087759826,0.0102064389,0.0101803343,0.0119499673,0.0110047092,0.0082972498,0.0056388029999999995,0.0056457241,0.0068318124,0.0065510410000000005,0.0066950716,0.0063556251,0.005736691800000001,0.006300964300000001,0.0069151402,0.0077851488,0.0111336224,0.011790893600000001,0.0110446644,0.0108201519,0.0064478020999999995,0.0058321573,0.0053380637,0.00685978,0.0057740505999999995,0.0057251719,0.007094784,0.0057350451,0.0053049486,0.006681964899999999,0.0056606299,0.006800473999999999,0.0111638324,0.0101257134]}},{"size":5,"stats":{"rme":12.677671975985163,"deviation":0.0048132118594694994,"mean":0.009943917794642857,"variance":0.00002316700840413784,"moe":0.0012606572795664393,"sem":0.000643192489574714,"sample":[0.007136109,0.01001541525,0.006874251375,0.00657671925,0.007545646,0.00703617125,0.00797082275,0.006504831875,0.006653333875,0.0083824165,0.01348840475,0.027149076375,0.016645459,0.012295565875,0.008750754,0.008509081375,0.00863639375,0.01481984975,0.0113543905,0.0251242275,0.027828182625,0.0088383495,0.0084518575,0.00720552875,0.007547649875,0.00781369275,0.007629465125,0.006782815125,0.007626611625,0.00686263625,0.00865185,0.00765608975,0.006820999,0.01067880175,0.013389152625,0.012417540375,0.01283362775,0.013069722625,0.0085037835,0.007403853875,0.006577496875,0.007260755375,0.006406379375,0.006334173375,0.007226516625,0.0071006235,0.00658204275,0.007658963,0.007595737625,0.008369632875,0.01524457825,0.01443299125,0.011445071125,0.010447696625,0.007851224125,0.006844383375]}},{"size":10,"stats":{"rme":7.725102064182073,"deviation":0.005012722395663803,"mean":0.017809035980392157,"variance":0.000025127385815989456,"moe":0.0013757662061322025,"sem":0.0007019215337409196,"sample":[0.0153355876,0.0150565056,0.016687512800000002,0.0141886928,0.016017471,0.0252713694,0.0304281134,0.0241396694,0.0161108368,0.0140723834,0.0158514908,0.0138268142,0.0145183972,0.0129342854,0.015370398399999999,0.012952317999999999,0.015015609599999999,0.0135938712,0.021212686,0.025169208399999997,0.025974992600000003,0.0217217026,0.013928074200000001,0.013382038199999998,0.013754995,0.013072167,0.0201330126,0.018340424,0.014269800199999998,0.014669332600000001,0.0280230892,0.0212331338,0.0254651668,0.0262337508,0.0159697522,0.014009626399999999,0.0148521726,0.0150008298,0.016571361,0.0142225764,0.0150954334,0.015482556,0.024903210000000002,0.0255914266,0.027435404000000004,0.0208395636,0.0147164342,0.0139507414,0.015474164600000001,0.012805972600000002,0.0133847092]}},{"size":20,"stats":{"rme":7.706571550596003,"deviation":0.009618758998436368,"mean":0.03606907327173913,"variance":0.00009252052467000059,"moe":0.002779688939323475,"sem":0.0014182086425119772,"sample":[0.0535175065,0.0560606645,0.0439089795,0.0460493225,0.037472929,0.031148172,0.0305528595,0.031626917,0.026668294,0.031983636,0.026797478,0.0588438515,0.034806729,0.0398920685,0.0297911415,0.034529819,0.0267543685,0.0325386495,0.0290946105,0.030144112,0.028344417,0.0259824145,0.0270000555,0.026588971,0.048901875,0.0472573585,0.047387821,0.0396549675,0.028906752666666664,0.028451720666666666,0.03902135566666667,0.03340420166666667,0.027085803333333335,0.040464362,0.06007030333333333,0.034706196333333335,0.03168342133333333,0.031121557666666664,0.028060120999999997,0.029686122,0.028183035999999998,0.027468169333333334,0.027891482666666665,0.04315312033333333,0.04672263766666667,0.04979701833333333]}},{"size":30,"stats":{"rme":10.727464773354011,"deviation":0.017497098953260567,"mean":0.05328117231944445,"variance":0.00030614847178019207,"moe":0.005715718991398452,"sem":0.0029161831588767613,"sample":[0.0437583345,0.0563246925,0.077170353,0.0718714085,0.051097012,0.0435295165,0.0477552005,0.0441354615,0.0399841765,0.052155323,0.0822814725,0.054768652,0.044760656,0.0461335,0.0388777875,0.038741085,0.039999193,0.0406841055,0.0443862665,0.0732636355,0.077369141,0.040346191,0.0360389375,0.0543973315,0.052894189,0.0483386085,0.042633904,0.12246182,0.0477536585,0.0443786195,0.042991129,0.0488636735,0.0462491055,0.0400063175,0.0654493365,0.076272409]}},{"size":40,"stats":{"rme":10.154886280070158,"deviation":0.01795866409980932,"mean":0.06857997207142856,"variance":0.00032251361624978007,"moe":0.006964218174757446,"sem":0.0033938685062170786,"sample":[0.061948325,0.053533423,0.068941853,0.0521256985,0.0986347685,0.09762585,0.062746492,0.060164327,0.057635129,0.057103704,0.1023486995,0.08781686,0.0573581915,0.057519049,0.0562060315,0.055089347,0.0600607655,0.0996447495,0.0738273075,0.0547735765,0.0816252195,0.0602613015,0.059108246,0.112424379,0.059699418,0.0586908175,0.0557466835,0.0575790055]}},{"size":50,"stats":{"rme":9.50055320197502,"deviation":0.024013611717697836,"mean":0.08757692093750001,"variance":0.0005766535477283547,"moe":0.00832029196631879,"sem":0.004245046921591219,"sample":[0.079638462,0.06851665,0.07127316,0.074230355,0.070679754,0.112661168,0.092338965,0.141421397,0.086956681,0.104951542,0.104799999,0.117770659,0.124903024,0.106731623,0.07107002,0.073123102,0.070067264,0.062828854,0.063511946,0.096015056,0.131979576,0.078504255,0.065441019,0.098218105,0.068777288,0.077960162,0.078684761,0.141218883,0.0740446,0.063999425,0.060809417,0.069334298]}},{"size":100,"stats":{"rme":12.350350503376253,"deviation":0.044367325916488475,"mean":0.16812728559999998,"variance":0.0019684596089799096,"moe":0.02076430906341243,"sem":0.009920835672915638,"sample":[0.134376747,0.13782974,0.139861309,0.251633224,0.136193655,0.137276661,0.198575206,0.183625698,0.132277407,0.133466606,0.144596417,0.249094405,0.211936586,0.142706633,0.231570045,0.13319439,0.138165128,0.130450134,0.159511609,0.236204112]}},{"size":250,"stats":{"rme":13.589636274059865,"deviation":0.07939310774473976,"mean":0.4178953798999999,"variance":0.0063032655573678565,"moe":0.056790462134510666,"sem":0.025106305099253167,"sample":[0.348042196,0.415641228,0.498849248,0.318846263,0.384543239,0.542469935,0.341740948,0.462471858,0.5059616,0.360387284]}},{"size":500,"stats":{"rme":10.636435414630824,"deviation":0.09571277318851444,"mean":0.8322594625714286,"variance":0.009160934951436009,"moe":0.0885227402185636,"sem":0.03617602787844855,"sample":[0.907020954,0.795681981,0.700632592,0.891420737,0.936428737,0.713890966,0.880740271]}},{"size":1000,"stats":{"rme":4.591701253826344,"deviation":0.07444284597715682,"mean":1.7016717745,"variance":0.005541737317178694,"moe":0.07813568420572552,"sem":0.030391164607438938,"sample":[1.7039705029999999,1.697325038,1.741995438,1.651626935,1.8159186470000002,1.599194086]}}]},{"name":"Free v0.6.1","results":[{"size":1,"stats":{"rme":8.735495607850144,"deviation":0.0009566537064906855,"mean":0.0026223211565734547,"variance":9.151863141423666e-7,"moe":0.00022907274945619923,"sem":0.00011687385176336695,"sample":[0.0020955884444444446,0.0018656194074074073,0.002529691259259259,0.0021241020344827588,0.0020203787586206895,0.002130749620689655,0.002371468068965517,0.0019209316206896551,0.0020771012068965516,0.002195536379310345,0.002683446551724138,0.00276548675862069,0.003850824068965517,0.005843688344827586,0.0033190352413793108,0.002710146896551724,0.0018057851724137932,0.0021272292068965516,0.0021996894827586207,0.002130506655172414,0.0023403379655172413,0.0021488980344827584,0.0021472244827586205,0.0018417698965517242,0.0020753954137931034,0.0023167177586206895,0.0021568740344827587,0.002185456482758621,0.002152681103448276,0.004005337482758621,0.004282362,0.004819472448275862,0.003409247724137931,0.0018264066551724138,0.002665114896551724,0.0021419237931034484,0.0019223060689655173,0.0020705038275862066,0.0021531744827586207,0.0023007536896551724,0.0022768282068965514,0.002136213620689655,0.0020925898620689654,0.002168903689655172,0.002200590655172414,0.0027934569310344827,0.0035478274827586203,0.0038080423793103446,0.004510914379310345,0.0022261902758620687,0.0019695676896551726,0.002158820068965517,0.0025900539655172414,0.002469301793103448,0.002252531344827586,0.002262223931034483,0.0023901802758620693,0.0018454185862068965,0.0026553313103448275,0.002307572655172414,0.0018179567931034483,0.0020985635862068967,0.006788606655172414,0.003389774344827586,0.0038639349999999998,0.003183958689655172,0.0021611998965517243]}},{"size":2,"stats":{"rme":7.425364870592388,"deviation":0.001389851269889524,"mean":0.004992403978557506,"variance":0.0000019316865524135227,"moe":0.0003707042112218658,"sem":0.0001891348016438091,"sample":[0.00433391447368421,0.0036924764736842104,0.005039807263157894,0.0038711637894736843,0.003785189157894737,0.004665331631578948,0.0038113532631578943,0.006948522684210527,0.008406592368421053,0.007226863947368421,0.005908266578947369,0.004034722947368422,0.004613224210526315,0.004631820578947368,0.0039423023157894735,0.003959305631578948,0.0041707787368421055,0.006683196157894736,0.005235866263157894,0.007722273947368421,0.0077517455263157896,0.007535821,0.0040905918421052625,0.004090406315789474,0.004850734947368421,0.004123789947368421,0.0047673881052631584,0.003976588368421053,0.003910656526315789,0.003802081789473684,0.0040315394736842106,0.0043445310000000004,0.006752901315789473,0.006806834842105263,0.004385266052631579,0.0047505942105263155,0.004526033789473684,0.0038881441052631576,0.004701974473684211,0.0038686012105263157,0.004726458105263158,0.004186599684210527,0.0037967417368421053,0.004304542105263158,0.003780593631578947,0.004321067684210526,0.004803945947368421,0.008202262578947368,0.0075778706842105255,0.007233411684210527,0.0041867741052631574,0.004817490157894737,0.003955017263157895,0.004057842210526316]}},{"size":3,"stats":{"rme":7.818079311734423,"deviation":0.0024533241683735835,"mean":0.008293342320661156,"variance":0.000006018799475125935,"moe":0.0006483800802229254,"sem":0.00033080616337904353,"sample":[0.007715665272727273,0.006691219909090909,0.009536494909090908,0.012466559727272728,0.015551666363636363,0.008428253454545455,0.006497179363636364,0.006676447454545455,0.007738683,0.006424513181818182,0.006203786454545454,0.006773426181818182,0.006854815181818182,0.006623254818181818,0.007836115818181819,0.006735657272727272,0.012413788727272728,0.011738470272727274,0.011840136272727274,0.009564534454545455,0.006523656545454545,0.006773622454545455,0.007748262909090909,0.006434551,0.0062835010909090905,0.008475440363636365,0.009960866454545454,0.007531812,0.01247630309090909,0.012289372545454546,0.011580511909090908,0.005559322272727273,0.0067570220000000005,0.007853614181818182,0.007566773,0.006594065272727273,0.007756785454545454,0.006505442454545454,0.006439621545454546,0.006725699000000001,0.006427980636363636,0.006781947636363636,0.014187253363636364,0.011818953363636364,0.01339631409090909,0.005994947818181818,0.006187887636363637,0.007747282818181819,0.006794653727272727,0.006239835454545455,0.007556421999999999,0.0065077268181818184,0.008079023636363637,0.007585268272727272,0.008681416727272727]}},{"size":4,"stats":{"rme":12.701169866061129,"deviation":0.0062609242448788014,"mean":0.01409294857011145,"variance":0.00003919917240011119,"moe":0.0017899693370264883,"sem":0.0009132496617482083,"sample":[0.016302299,0.0153141902,0.018691561666666665,0.021726643166666667,0.02383374016666667,0.022520573833333335,0.012472651500000001,0.010737822833333334,0.032378145500000004,0.024453183,0.013092010333333334,0.008409251833333334,0.010042404999999999,0.008730090333333334,0.011367661142857142,0.009380696142857142,0.008572485285714285,0.009742792857142857,0.0087843215,0.010408286375,0.010425794125,0.016534163125,0.018967704875,0.015998863375,0.009054976375,0.00882403525,0.00873378675,0.0091692505,0.00969626775,0.01707087425,0.014366886125,0.012181811375,0.01665274925,0.020540483375,0.013379976,0.009518771875,0.010260218875,0.008866679625,0.00915245325,0.017044609375,0.009406062875,0.00949480225,0.01163353925,0.009095463125,0.02950122675,0.029605849875,0.0102304715]}},{"size":5,"stats":{"rme":8.212406091520275,"deviation":0.004054273117530343,"mean":0.01411398747416413,"variance":0.00001643713051152921,"moe":0.0011590979670846636,"sem":0.0005913765138187059,"sample":[0.011628745142857142,0.011060291428571428,0.012645932,0.011123363857142857,0.013624806714285715,0.012481165857142857,0.010848137999999998,0.019532232142857143,0.019588146,0.022096629714285713,0.011688781714285714,0.011006496285714287,0.00989549442857143,0.010210010571428571,0.012205640142857143,0.012532384428571427,0.01038633757142857,0.010618129142857143,0.010454493714285714,0.022168221285714284,0.023165689,0.021356801285714287,0.010841319142857143,0.011466057714285714,0.013299938428571427,0.012848861285714287,0.011210453714285714,0.012468572571428572,0.011814883714285714,0.013782243285714285,0.022042676714285715,0.020105443857142857,0.018435007,0.010751906285714286,0.012512181428571429,0.01200722957142857,0.010977499142857143,0.010876453714285713,0.011031800714285714,0.011455988571428571,0.011939975142857143,0.015216491142857143,0.019556211142857143,0.019726451142857145,0.017603454571428572,0.013664983285714286,0.017403397571428572]}},{"size":10,"stats":{"rme":7.947330558829363,"deviation":0.00812604676526758,"mean":0.029232447773049647,"variance":0.0000660326360313157,"moe":0.002323199254961408,"sem":0.0011853057423272491,"sample":[0.023793245666666667,0.022935259,0.04110835166666667,0.04466183466666667,0.043419083,0.028256005333333334,0.032543671,0.034962919,0.026909962,0.019311464333333334,0.024704298333333333,0.023482615,0.023595377666666667,0.042146038999999996,0.04136304166666666,0.041781387333333336,0.022579242,0.023910048333333333,0.023442612,0.022252115666666666,0.022434303,0.022368066000000002,0.023281198,0.023745237333333336,0.027218427,0.04140027266666667,0.047759237333333336,0.03658436633333333,0.027291862,0.024005816333333332,0.024051928,0.024838596666666667,0.024482752333333333,0.025980266333333335,0.023756612333333333,0.028870564666666668,0.04294748566666667,0.04240571333333334,0.03841554966666667,0.022181169333333334,0.022309317999999998,0.02362528,0.023840755666666668,0.028913448999999997,0.022075289666666668,0.024863383,0.027119572999999998]}},{"size":20,"stats":{"rme":9.735594210810671,"deviation":0.016351752905118123,"mean":0.05730611321212121,"variance":0.000267379823070039,"moe":0.005579090640319881,"sem":0.0028464748164897355,"sample":[0.047023444,0.046665262,0.0410628815,0.054078925,0.0827015895,0.092110298,0.0444540465,0.0499588435,0.0510650785,0.050105707,0.054908508,0.0423508335,0.0808035785,0.088324452,0.0435506655,0.046656712,0.048802216,0.046574263,0.04706927,0.047818905,0.0819365365,0.089234723,0.0451651,0.051703877,0.0505865645,0.04421551,0.0548140045,0.072237225,0.0869740025,0.065018285,0.047280471,0.048760993,0.047088965]}},{"size":30,"stats":{"rme":13.16248123472712,"deviation":0.031191444258079452,"mean":0.08691057238709678,"variance":0.0009729061949048777,"moe":0.011439587781445543,"sem":0.005602148766623675,"sample":[0.11926241,0.067748954,0.061724908,0.072512068,0.070728528,0.103643227,0.197218609,0.05899976,0.071443569,0.071475331,0.066897424,0.069460348,0.123696606,0.13447981,0.067805337,0.077600224,0.069551614,0.066981554,0.078830698,0.068518609,0.136488067,0.108775969,0.071753832,0.088489817,0.070683602,0.057028387,0.074017175,0.103509191,0.127321987,0.072954395,0.064625734]}},{"size":40,"stats":{"rme":10.160949974211668,"deviation":0.029674049844853164,"mean":0.11798398346153846,"variance":0.0008805492341948301,"moe":0.01198829353710909,"sem":0.005819559969470432,"sample":[0.106159246,0.170857273,0.16779246,0.080159511,0.096521862,0.112620671,0.10880461,0.159199304,0.104848399,0.099269197,0.101624198,0.111553043,0.130396229,0.15776688,0.083418699,0.095085137,0.092582159,0.09259612,0.146446048,0.159002953,0.098240989,0.103568975,0.103764356,0.085972297,0.171940048,0.127392906]}},{"size":50,"stats":{"rme":14.783163333725607,"deviation":0.048424507340925654,"mean":0.14910853128571433,"variance":0.0023449329112113625,"moe":0.022042957724486497,"sem":0.010567093827654122,"sample":[0.121349164,0.287252768,0.12214752,0.117203518,0.132483847,0.149707656,0.219795889,0.128877257,0.122001759,0.118606955,0.167654218,0.180322859,0.104897646,0.103980143,0.106387738,0.222442909,0.113075679,0.117344618,0.136293826,0.156353086,0.203100102]}},{"size":100,"stats":{"rme":16.58436723404181,"deviation":0.08135815857088013,"mean":0.28319914492857146,"variance":0.0066191499660444774,"moe":0.04696678619862058,"sem":0.021743882499361378,"sample":[0.241140618,0.522856359,0.255340978,0.403915428,0.226795616,0.273281908,0.24798883,0.238580854,0.244519068,0.243925316,0.279532547,0.24996972,0.254406424,0.282534363]}},{"size":250,"stats":{"rme":15.127904640763463,"deviation":0.12337313508844795,"mean":0.6819114366249999,"variance":0.015220930461552427,"moe":0.10315891186709016,"sem":0.04361899021864277,"sample":[0.580810989,0.623433496,0.566602574,0.638241133,0.597745983,0.831866849,0.718333754,0.898256715]}},{"size":500,"stats":{"rme":5.927369456192178,"deviation":0.07762787557965846,"mean":1.374618405666667,"variance":0.0060260870670109335,"moe":0.08147871151668191,"sem":0.03169144749773703,"sample":[1.437946988,1.457550383,1.236967027,1.365965037,1.385114976,1.3641660230000001]}},{"size":1000,"stats":{"rme":4.371357697406755,"deviation":0.10690735268748533,"mean":3.036167239,"variance":0.011429182058646377,"moe":0.13272173030816867,"sem":0.0478104215807524,"sample":[3.189855874,3.038351118,3.07570966,2.911676746,2.965242797]}}]}]} \ No newline at end of file diff --git a/benchmark/left-bind-small.png b/benchmark/left-bind-small.png deleted file mode 100644 index 96061f7..0000000 Binary files a/benchmark/left-bind-small.png and /dev/null differ diff --git a/benchmark/right-bind-large.json b/benchmark/right-bind-large.json deleted file mode 100644 index 037a784..0000000 --- a/benchmark/right-bind-large.json +++ /dev/null @@ -1 +0,0 @@ -{"slug":"right-bind-large","title":"Right associated binds (large - 1 input per size)","sizeInterpretation":"Number of binds","series":[{"name":"Free","results":[{"size":100000,"stats":{"rme":54.087295923035704,"deviation":1.8690243264338895,"mean":3.6269881435,"variance":3.4932519328016545,"moe":1.9617398102682642,"sem":0.7630259861020086,"sample":[5.281779364,3.876533873,4.146684662,5.69766806,1.437201473,1.3220614290000001]}},{"size":500000,"stats":{"rme":9.095733345571979,"deviation":0.4832989570916459,"mean":6.5964852806,"variance":0.2335778819258726,"moe":0.5999987113032814,"sem":0.21613786430233484,"sample":[6.668239242,6.455364192,6.189816145,6.273004219,7.396002605]}},{"size":1000000,"stats":{"rme":106.2412908346505,"deviation":29.723291913434345,"mean":34.732658606600005,"variance":883.4740821712314,"moe":36.90042484484418,"sem":13.292660246701796,"sample":[86.417579438,26.53633886,30.405841321,12.933476041,17.370057373]}},{"size":1500000,"stats":{"rme":80.78978903813764,"deviation":22.862576656977367,"mean":35.1320231442,"variance":522.6974113961664,"moe":28.38308738302887,"sem":10.224455109160257,"sample":[75.986347276,26.652435758,24.502746679,23.814094452,24.704491556]}},{"size":2000000,"stats":{"rme":110.06860459297802,"deviation":48.66134956373595,"mean":54.88518701019999,"variance":2367.9269413641055,"moe":60.41135947037357,"sem":21.762017100278666,"sample":[141.928692781,32.633208799,33.335225074,32.686487232,33.842321165]}},{"size":2500000,"stats":{"rme":19.896515123974336,"deviation":10.768351141944862,"mean":67.1903111322,"variance":115.95738631622523,"moe":13.368530416263583,"sem":4.815753031795239,"sample":[86.415585599,61.944501873,62.188354209,63.532956893,61.870157087]}},{"size":3000000,"stats":{"rme":23.62213954568086,"deviation":14.3778362784687,"mean":75.5629253404,"variance":206.72217605045068,"moe":17.849579668707932,"sem":6.429963857603722,"sample":[101.218426417,69.005205535,68.416595675,68.323939027,70.850460048]}}]},{"name":"Free v0.6.1","results":[{"size":100000,"stats":{"rme":18.878076393195613,"deviation":0.4188978423226622,"mean":2.7547668221999997,"variance":0.17547540230258196,"moe":0.5200469851493231,"sem":0.1873368102122922,"sample":[2.554999252,3.373539042,2.994936612,2.470887744,2.379471461]}},{"size":500000,"stats":{"rme":51.34404443791469,"deviation":13.82934089387188,"mean":33.4384290648,"variance":191.25066955891708,"moe":17.168641878371492,"sem":6.184669264543046,"sample":[22.457426975,18.358243998,31.781299748,43.417530726,51.177643877]}},{"size":1000000,"stats":{"rme":41.69794488612991,"deviation":37.64926458466703,"mean":112.0924356536,"variance":1417.467123766263,"moe":46.740242040358766,"sem":16.837262982838173,"sample":[60.66906026,106.215801135,163.490892977,127.922547106,102.16387679]}},{"size":1500000,"stats":{"rme":37.776962318228655,"deviation":44.32251312700119,"mean":145.6571486226,"variance":1964.4851698931925,"moe":55.024846148965906,"sem":19.821630457120285,"sample":[114.222053676,185.001896583,112.832185496,202.465123576,113.764483782]}},{"size":2000000,"stats":{"rme":2.687159022907891,"deviation":4.5836016441445055,"mean":211.7619648372,"variance":21.009404032204213,"moe":5.690380745209855,"sem":2.049848971617383,"sample":[206.129960633,218.619070512,211.290322438,212.933128983,209.83734162]}},{"size":2500000,"stats":{"rme":12.091860499318567,"deviation":28.917991358352097,"mean":296.8994923542,"variance":836.2502242017266,"moe":35.90067243865486,"sem":12.932518890005353,"sample":[247.527512002,310.007200229,323.042127184,301.276455565,302.644166791]}},{"size":3000000,"stats":{"rme":20.086417850008097,"deviation":70.01060986055948,"mean":432.7088995982,"variance":4901.4854930474685,"moe":86.91571764746647,"sem":31.309696558885616,"sample":[368.304993303,502.205225384,389.881487887,515.145993456,388.006797961]}}]}]} diff --git a/benchmark/right-bind-large.png b/benchmark/right-bind-large.png deleted file mode 100644 index bc474e4..0000000 Binary files a/benchmark/right-bind-large.png and /dev/null differ diff --git a/benchmark/right-bind-small.json b/benchmark/right-bind-small.json deleted file mode 100644 index 9e6f054..0000000 --- a/benchmark/right-bind-small.json +++ /dev/null @@ -1 +0,0 @@ -{"slug":"right-bind-small","title":"Right associated binds (small - 100 inputs per size)","sizeInterpretation":"Number of binds","series":[{"name":"Free","results":[{"size":1,"stats":{"rme":7.704460777626861,"deviation":0.0007505377155810193,"mean":0.0022195783701898755,"variance":5.633068625095749e-7,"moe":0.00017100654495996848,"sem":0.00008724823722447371,"sample":[0.0035089712352941176,0.003134843705882353,0.0030993049411764707,0.003162290823529412,0.0031066262352941174,0.003283377117647059,0.0024244792272727273,0.0025544020454545454,0.0019203925625,0.00164292096875,0.00184587978125,0.00176719078125,0.0017404609375,0.00206512325,0.00172203125,0.0017758324375,0.0030416393125,0.0032566055,0.00303043171875,0.00524580328125,0.00194093696875,0.00165668909375,0.0017035624375,0.00169564909375,0.0019969241875,0.00165752775,0.00195390546875,0.00168574865625,0.00158028315625,0.0016063041875,0.0018594273125,0.0016014646875,0.0016703321875,0.0015883225625,0.002160341,0.003133980125,0.003121307375,0.00354297946875,0.0031388316875,0.0025274413125,0.00166572265625,0.00192044334375,0.001697606125,0.001602374125,0.00168569746875,0.00282055840625,0.00237691709375,0.001832713125,0.00200375040625,0.0017499844375,0.00169691584375,0.00171004571875,0.00364988628125,0.0031790318125,0.00363037075,0.00209988009375,0.0020072328125,0.00182352865625,0.00170472853125,0.0020416220625,0.0017288809375,0.00159235465625,0.00161850296875,0.0016176331875,0.001862903125,0.00160569353125,0.0015903550625,0.00158980853125,0.00182953125,0.00160286703125,0.00158748296875,0.0016396495625,0.00318921284375,0.00314434815625]}},{"size":2,"stats":{"rme":8.797687508591961,"deviation":0.0011581096613747077,"mean":0.0033878426206896553,"variance":0.00000134121798776944,"moe":0.0002980518070511684,"sem":0.00015206724849549407,"sample":[0.003018620346153846,0.002941966730769231,0.0028795218076923075,0.0026594295,0.0029657726923076927,0.002284440923076923,0.0026264388076923076,0.002719698346153846,0.0023031183846153845,0.0025259361923076922,0.0028332740769230766,0.0036052478461538464,0.004728487730769231,0.004805714730769231,0.004911727846153846,0.005518223769230769,0.002938460846153846,0.003085229,0.002497338692307692,0.002720285769230769,0.003094409269230769,0.0025067452307692304,0.0027481880000000004,0.0031060203076923075,0.0024519119230769233,0.004792431038461538,0.0049648078461538465,0.0046106870000000005,0.0047739035769230765,0.002656160423076923,0.002274262230769231,0.002615494230769231,0.002536907153846154,0.0026237140384615387,0.002513045653846154,0.0025459897692307696,0.002596843192307692,0.002618533769230769,0.002760327576923077,0.0022718257307692306,0.003028585961538461,0.005038789423076923,0.004790715192307692,0.004844190038461539,0.0042751497307692305,0.0025491355384615385,0.002855123269230769,0.002458791846153846,0.0035457120769230768,0.004178023038461539,0.0025913085000000002,0.0025461178076923077,0.0032069025,0.0024854294615384615,0.003670297846153846,0.007154756230769231,0.0067633436153846154,0.004881357923076923]}},{"size":3,"stats":{"rme":7.605326051920093,"deviation":0.0013123583184039905,"mean":0.004440957993965517,"variance":0.0000017222843558841498,"moe":0.00033774933526988746,"sem":0.00017232108942341197,"sample":[0.0043592054,0.00380170085,0.0042836932,0.0037151070500000003,0.00394893745,0.0034724023499999998,0.0034517388500000003,0.0038941532,0.0064975968,0.00667859435,0.006524074100000001,0.00628962775,0.0033668863,0.0036153677,0.0033223579500000003,0.0035956029,0.00332458255,0.00376543215,0.00301945115,0.0033958192999999997,0.0032351356,0.0033458061,0.0044855949499999995,0.006451159099999999,0.0066386281,0.006883821850000001,0.006955210450000001,0.0038363952,0.00405262195,0.0036161781,0.0041636683,0.0036449583,0.0041571238500000005,0.0032904237500000003,0.0032482004000000003,0.00417390115,0.006826109049999999,0.0067577780500000005,0.00619859625,0.00482228935,0.0035014736499999997,0.0037568839,0.0034094402500000004,0.0034927013,0.0033515988500000004,0.00391500935,0.0033213555499999998,0.0036374898,0.00302672005,0.0033730903,0.00550067485,0.00647791035,0.006676509799999999,0.0065860188,0.0044068202,0.00338411645,0.00388374045,0.004768078550000001]}},{"size":4,"stats":{"rme":7.490313749546636,"deviation":0.0015340695773533586,"mean":0.005412772505882353,"variance":0.0000023533694681611124,"moe":0.0004054336432397859,"sem":0.00020685389961213566,"sample":[0.00548032094117647,0.004205924764705883,0.004538072058823529,0.0070462041764705885,0.008133751411764705,0.007223730823529412,0.005418183,0.004413393,0.004467297352941177,0.0042981795294117645,0.004940822882352942,0.0040322380000000005,0.004768893647058824,0.0043468259411764704,0.004776258294117647,0.004164356882352942,0.004690594529411765,0.00783709505882353,0.008658761823529412,0.00788729805882353,0.0067524785294117646,0.004080025588235294,0.004593448941176471,0.004202069235294118,0.004644605411764706,0.004095442470588235,0.004650374411764706,0.00409692205882353,0.004851706235294117,0.004117511411764706,0.005270940823529411,0.007817452823529412,0.008732942529411765,0.008813404235294118,0.007022877941176471,0.0044720488235294115,0.005136848470588235,0.004520101411764706,0.005064210529411765,0.004433721117647059,0.004648721235294118,0.004454701764705882,0.00475238705882353,0.0068690546470588235,0.008396555529411764,0.00807476282352941,0.0073270962352941175,0.0044509717647058826,0.0042523544117647055,0.0044374034705882345,0.004249918294117647,0.004157248058823529,0.004364183647058824,0.004299000941176471,0.004270792764705883]}},{"size":5,"stats":{"rme":8.973520990063651,"deviation":0.002564253303266562,"mean":0.006947002156177156,"variance":0.000006575395003313474,"moe":0.0006233906966647315,"sem":0.0003180564778901691,"sample":[0.011425768000000001,0.009587194333333333,0.006069359636363636,0.005399457727272727,0.0055667952727272724,0.004729869818181818,0.004901619181818182,0.0055265158181818175,0.005071994090909091,0.005655958909090909,0.005330675272727272,0.0047710770909090905,0.005165559363636363,0.005235509545454545,0.011767157636363636,0.010928307,0.01748420609090909,0.00622441,0.005886449181818182,0.0060287149090909094,0.005256574181818182,0.006112790909090909,0.005401489181818182,0.005765665272727274,0.006268045363636363,0.006031130272727273,0.006123097272727273,0.004867904545454545,0.0051422940909090905,0.010322879727272728,0.010203017363636364,0.010562950636363637,0.010065044181818182,0.00645070890909091,0.005378691,0.004780349636363636,0.005590243,0.005331323090909091,0.005587577272727273,0.005226731636363636,0.0047914814545454544,0.005043236,0.0050886765454545456,0.006283568272727274,0.004740854545454545,0.0059524975454545445,0.010459980636363636,0.009383456545454546,0.011655961727272728,0.010279216090909092,0.006469623181818182,0.005923633818181818,0.006034323727272728,0.006109150545454545,0.005451708363636364,0.005225693909090909,0.006082058,0.0051885636363636365,0.0060923264545454546,0.00598305890909091,0.005408644181818182,0.010415841818181818,0.009432808272727272,0.010788063909090909,0.010045605636363636]}},{"size":10,"stats":{"rme":8.243987229853005,"deviation":0.004069835733822465,"mean":0.012288526118279566,"variance":0.000016563562900298246,"moe":0.0010130645239281185,"sem":0.0005168696550653666,"sample":[0.010427078166666666,0.009699611833333333,0.0097266475,0.011078544333333334,0.009968352,0.010317109833333333,0.008972092666666666,0.009821328833333334,0.014142923166666667,0.0169461855,0.019127543,0.018799904166666666,0.014861192166666667,0.009797956,0.010555280166666667,0.0087135815,0.008678274833333334,0.010587038333333333,0.008766382166666666,0.010457045833333333,0.009957088333333334,0.010473930166666666,0.009701571666666667,0.013528087166666668,0.025919854000000003,0.013914227500000001,0.019232438833333334,0.009325588000000001,0.011599775666666666,0.0106954305,0.011087367333333334,0.010654643833333333,0.012434296833333332,0.009349475833333334,0.010592363,0.010270395,0.008900962333333333,0.010197332333333333,0.010174104833333334,0.019437778666666666,0.018550473833333334,0.020893846999999997,0.01625391,0.009212485666666667,0.009997678,0.009275375333333334,0.010771366833333332,0.010796766833333332,0.0102907295,0.009842959833333333,0.0114099365,0.008713104666666667,0.008748367666666666,0.0102321875,0.013038761666666667,0.019204465166666667,0.02030639366666667,0.0226447005,0.011732622333333333,0.012304725,0.009354576166666666,0.009422401833333333]}},{"size":20,"stats":{"rme":9.971814530996312,"deviation":0.009177502528283773,"mean":0.02410529098214286,"variance":0.00008422655265665503,"moe":0.0024037349088962654,"sem":0.001226395361681768,"sample":[0.025246188,0.018536792666666666,0.022383540666666663,0.037464779,0.038880633,0.029770390666666664,0.019568938,0.02080895,0.021160976666666668,0.021826842,0.022767613000000003,0.021377315999999997,0.02163701733333333,0.017960504999999998,0.019600624,0.018452517666666664,0.019591975333333334,0.03258337066666667,0.03672714433333333,0.032812186,0.030603583333333333,0.018715184,0.019588279,0.019621269,0.019543332666666666,0.019752623333333334,0.019593460666666666,0.018789024666666668,0.023986285333333333,0.01995129,0.03157523366666667,0.052520737000000005,0.06409276900000001,0.02192390666666667,0.018697601333333334,0.018229182,0.018232671333333336,0.018082944666666666,0.018026357666666666,0.019154498,0.017366062666666664,0.018345623666666668,0.017839880333333332,0.030149543666666667,0.03533089266666667,0.03520396333333333,0.035792827,0.01679248066666667,0.018900740333333332,0.021403931666666667,0.016670619333333334,0.019516000333333335,0.016712015333333333,0.01939898866666667,0.0203158545,0.0203183375]}},{"size":30,"stats":{"rme":8.88051971142423,"deviation":0.010580491567385459,"mean":0.03561142122480619,"variance":0.0001119468018075148,"moe":0.0031624792813872257,"sem":0.0016135098374424621,"sample":[0.05021942,0.059386974,0.054334604,0.0298808465,0.028166503,0.0258802115,0.0444307025,0.032558055,0.035071534,0.0304158905,0.031151268,0.052188048,0.0545426285,0.0296259405,0.030747472,0.031411287,0.0265221135,0.0250144675,0.028966891999999998,0.02442775833333333,0.025922848999999998,0.028052504333333336,0.05188005666666667,0.050788968999999996,0.03785630833333333,0.028009071333333333,0.030665226333333333,0.026646518999999997,0.028059162666666665,0.029551870999999997,0.031688878999999996,0.04475686833333333,0.05894428733333334,0.03831296033333333,0.029153989333333335,0.026364612,0.029429788999999998,0.03245890766666667,0.027197067000000002,0.028124913666666668,0.028211313666666668,0.04697510933333333,0.047297262]}},{"size":40,"stats":{"rme":9.0107428201209,"deviation":0.013293909781262674,"mean":0.04572126190000001,"variance":0.0001767280372723514,"moe":0.004119825323922924,"sem":0.0021019516958790427,"sample":[0.057775949,0.040375939,0.0381016985,0.0337914865,0.038737636,0.066665047,0.06479226,0.0424483095,0.033935284,0.0396928495,0.048854401,0.034705951,0.041926193,0.0361393875,0.0749938005,0.0666354635,0.0408895535,0.0382929815,0.0342886275,0.038884756,0.0368584585,0.034259232,0.039120847,0.0348063175,0.06487681,0.064570578,0.061574217,0.0378892525,0.035346552,0.034917172,0.0375259565,0.0349591165,0.059620324,0.0651945875,0.0784410655,0.043160427,0.0365856765,0.0414708065,0.0393388825,0.036406623]}},{"size":50,"stats":{"rme":9.856656434903488,"deviation":0.01699660092223415,"mean":0.05796276189705882,"variance":0.00028888444290969074,"moe":0.005713190300374235,"sem":0.0029148930103950177,"sample":[0.0799070955,0.08635615,0.043826863,0.048286937,0.049039318,0.046135064,0.048054149,0.0392158185,0.08080838,0.080535742,0.0432076985,0.059749639,0.057265324,0.051472864,0.046661772,0.088893283,0.082193643,0.0439753385,0.0481696355,0.0453956165,0.044717335,0.049758077,0.043736013,0.0862403235,0.082229993,0.049849956,0.0484996945,0.0405229395,0.0435427665,0.0621417375,0.059570232,0.092393926,0.0474217955,0.0509587845]}},{"size":100,"stats":{"rme":10.598729540513759,"deviation":0.02888947285348556,"mean":0.11012003830769229,"variance":0.0008346016417522792,"moe":0.01167132503014245,"sem":0.005665691762205073,"sample":[0.109795123,0.093012896,0.087663311,0.079467221,0.085467714,0.099061999,0.172106353,0.147022522,0.097199154,0.103231442,0.093896955,0.1296147,0.171625715,0.098705321,0.086099783,0.085575579,0.086617461,0.088275248,0.166416994,0.102815137,0.085632,0.094097981,0.133649684,0.12552322,0.144130033,0.09641745]}},{"size":250,"stats":{"rme":15.101156319616905,"deviation":0.07527989917267376,"mean":0.287778642,"variance":0.005667063219447928,"moe":0.0434579025828907,"sem":0.02011939934393088,"sample":[0.211692694,0.404948578,0.257337788,0.397895768,0.216839293,0.223181616,0.331340933,0.272198181,0.396144407,0.239161019,0.212903094,0.274909739,0.225289073,0.365058805]}},{"size":500,"stats":{"rme":18.044132743426726,"deviation":0.13709837680181677,"mean":0.5840289128888889,"variance":0.018795964921692932,"moe":0.10538295230166317,"sem":0.045699458933938925,"sample":[0.689517485,0.692970613,0.472270853,0.434486908,0.480063827,0.439246742,0.636238883,0.586570984,0.824893921]}},{"size":1000,"stats":{"rme":6.496402235977254,"deviation":0.0803545247623788,"mean":1.1439903975714285,"variance":0.006456849649787746,"moe":0.07431821776719537,"sem":0.0303711556057194,"sample":[1.139697177,0.993256243,1.195161198,1.259478571,1.140791752,1.139525828,1.140022014]}}]},{"name":"Free v0.6.1","results":[{"size":1,"stats":{"rme":9.613658371050049,"deviation":0.0010749209423115723,"mean":0.00273939036214754,"variance":0.0000011554550322199985,"moe":0.0002633556308663352,"sem":0.00013436511778894654,"sample":[0.0037082834375,0.003701989,0.004635319125,0.002062978724137931,0.002443546724137931,0.0020033744333333332,0.002021608066666667,0.002031163533333333,0.0021761443666666667,0.0019822987,0.0027873866,0.0031259976,0.0040078426666666665,0.003911531766666667,0.0034621040666666667,0.0022085286,0.002207278433333333,0.0023458284333333335,0.0021427892666666666,0.0021702572999999998,0.0022148137999999998,0.0019326648333333333,0.0023351148000000004,0.0022226091,0.0022465554,0.0017879954,0.0023828854,0.0021368836333333337,0.0020358154666666665,0.0064218699333333336,0.007266162166666667,0.0031631039666666664,0.0021360349333333336,0.0018508254666666666,0.0021720829333333335,0.002576340166666667,0.002008591,0.0018215091333333333,0.0020289265,0.0021360366666666668,0.002415817633333333,0.0017858457666666667,0.0020520711666666665,0.0021950445666666664,0.0037144032666666664,0.0038083430333333335,0.0046919363,0.0038749341,0.0022128940333333335,0.0024803662666666665,0.0021749080999999997,0.0022040420000000002,0.0022189427,0.0026992027333333337,0.0018618762666666666,0.0023034347333333333,0.0022740441333333333,0.0021370366333333334,0.0024034543000000003,0.0021774283666666666,0.0036712344666666665,0.003902593666666667,0.0042732760666666664,0.003774781333333333]}},{"size":2,"stats":{"rme":8.455770984978919,"deviation":0.0015425742450916992,"mean":0.004735997969529086,"variance":0.0000023795353016202258,"moe":0.0004004651421566312,"sem":0.0002043189500799139,"sample":[0.0036838340526315788,0.0036435319999999997,0.004198971052631579,0.0035189243684210524,0.0035057362631578945,0.0043451110000000005,0.0034827415789473685,0.0034486474736842108,0.004076672684210527,0.0035691638947368417,0.006395003947368421,0.006499386789473684,0.0073645238947368415,0.006081677631578947,0.0034641115263157893,0.004295117736842105,0.0034752512631578947,0.00344631752631579,0.003473312947368421,0.004025883315789474,0.003474183052631579,0.004201358736842105,0.005862774578947369,0.004427326421052632,0.008639059631578946,0.008711315736842105,0.008930553368421053,0.005219452526315789,0.003857061789473684,0.004454497473684211,0.003926733,0.0037995672631578946,0.0036816082631578946,0.004461839368421053,0.003624827157894737,0.0037279981052631577,0.004534339947368421,0.0064037226842105265,0.0064480751578947365,0.006524146526315789,0.006742737947368421,0.0034218112105263154,0.003408390105263158,0.004706893,0.0036068474210526314,0.0034592013684210526,0.003732261052631579,0.004317923315789473,0.0037500614736842106,0.0035765266842105264,0.00408530047368421,0.0077742528947368425,0.0070205664736842106,0.006344141842105263,0.005543513631578948,0.0038053284210526317,0.0037517652105263162]}},{"size":3,"stats":{"rme":6.977711829294028,"deviation":0.0018159607251741349,"mean":0.006376164401055194,"variance":0.0000032977133553749697,"moe":0.000444910377667663,"sem":0.00022699509064676686,"sample":[0.007791250285714286,0.0057302656,0.005955891600000001,0.0046359876363636365,0.0057374976363636365,0.005971971909090909,0.009393352454545454,0.012225832909090907,0.007997887181818182,0.005129655727272728,0.005881702,0.005792999454545455,0.0046406572727272725,0.006632019833333333,0.00518598425,0.005474065833333333,0.005868163666666666,0.004364178333333334,0.005035146,0.005021951,0.006427210583333333,0.00770999175,0.009398500416666667,0.009434215083333334,0.00993773075,0.006733167333333334,0.0042212598333333335,0.004546032333333333,0.00488258325,0.005072707166666667,0.00504859625,0.006244229083333334,0.004886489083333333,0.00652319325,0.006600234,0.006297584166666666,0.00739177575,0.01023594025,0.010415289416666666,0.007917727583333334,0.00463449325,0.0054609077500000006,0.005541690166666666,0.005133023333333334,0.005920562083333333,0.005468931416666666,0.006614353333333333,0.005020635916666667,0.005551371666666667,0.005432412333333333,0.0053018246666666664,0.005535603833333333,0.00788988775,0.009413588083333334,0.009949873083333333,0.008522146333333333,0.00715048925,0.00501447325,0.004775002333333334,0.0050043015,0.0051339551666666665,0.006025050583333334,0.004945049333333333,0.0042439773333333335]}},{"size":4,"stats":{"rme":7.654687952096323,"deviation":0.0023986995742144883,"mean":0.008774177144557822,"variance":0.000005753759647336768,"moe":0.0006716358807800567,"sem":0.0003426713677449269,"sample":[0.005919865166666666,0.008638576416666667,0.011685135749999999,0.012766955750000001,0.012311272333333333,0.007214813666666667,0.008799654083333334,0.009890395416666666,0.007699369166666667,0.007738654583333333,0.0077013605,0.00768514775,0.010449397249999999,0.012475633916666666,0.012818777083333335,0.007581962166666667,0.0071447015,0.006141286,0.006204397166666667,0.007524832249999999,0.00694773675,0.007099915583333334,0.00609552725,0.006503490333333334,0.007597213833333334,0.012938935916666667,0.013176669916666666,0.011849662249999999,0.006076784416666667,0.0072469284999999994,0.0071794827500000005,0.007032100833333333,0.0063913184166666664,0.008422973583333333,0.010286095833333333,0.007565921083333333,0.013196458416666668,0.010250147083333333,0.0134116685,0.011580852916666667,0.007518711500000001,0.008127966166666667,0.006562821083333333,0.006470882833333334,0.007134807833333333,0.00711419975,0.007111905250000001,0.008964926333333333,0.01168638725]}},{"size":5,"stats":{"rme":9.52037752197625,"deviation":0.003816417864863873,"mean":0.010499383709821435,"variance":0.000014565045319252124,"moe":0.0009995809666558761,"sem":0.0005099902891101409,"sample":[0.008031596,0.007685084625,0.007895775875,0.008814380875,0.007781476625,0.00834147675,0.0078922675,0.007759284125,0.00901751625,0.00919485925,0.014820293375,0.0168079665,0.01499817175,0.0120778815,0.007439651875,0.0117342735,0.011032389375,0.007002096125,0.008829999125,0.00923036825,0.00696490775,0.008657353875,0.0099752875,0.01627379575,0.02016829975,0.0247943575,0.008620245875,0.00833597975,0.01008704675,0.00807138075,0.00798438475,0.008509658125,0.00776553025,0.007976304375,0.008620475625,0.0083661655,0.017773805625,0.015501594,0.016437187,0.01350572075,0.008209159,0.007840654625,0.007756832375,0.00907693325,0.008164562125,0.009714954875,0.01555168275,0.009538311375,0.008751425125,0.0133825385,0.016285443125,0.01026284025,0.007816044,0.008443154125,0.0088471795,0.00754748225]}},{"size":10,"stats":{"rme":7.780389964740491,"deviation":0.005755712245712285,"mean":0.019731354524691363,"variance":0.00003312822345544236,"moe":0.0015351763273464554,"sem":0.0007832532282379875,"sample":[0.017977490333333335,0.016726447,0.01649168625,0.016816579,0.01514478675,0.02478397925,0.03388453175,0.02858941775,0.024750388,0.01590586675,0.01492488525,0.0150450745,0.01832058425,0.015077879,0.0160043655,0.0149558035,0.01497906225,0.0178637255,0.01499162475,0.0279998135,0.029077341,0.02879436675,0.02565806025,0.01619816725,0.022144534,0.02273929325,0.016223262,0.01376872725,0.01704118875,0.01654834425,0.017254895,0.017580728,0.024547456,0.0381836615,0.015944874,0.0161631025,0.0170630615,0.01595540475,0.0163674615,0.01914966625,0.01640987675,0.017151954,0.015301133,0.01523653275,0.01982030175,0.02348433225,0.02843705775,0.02955323075,0.02888334275,0.01585042225,0.01256129,0.01651324625,0.01873350575,0.01991933175]}},{"size":20,"stats":{"rme":9.200007574749973,"deviation":0.013072982389780956,"mean":0.04062502428723404,"variance":0.00017090286856352298,"moe":0.0037375053116695477,"sem":0.0019068904651375245,"sample":[0.053437106,0.055375818,0.081357722,0.061454097,0.040864535,0.031765732,0.032419249,0.032809429,0.0322497495,0.04061526,0.035340808,0.044202469,0.0569939185,0.0590301865,0.048673595,0.030339932,0.0267235905,0.0296490705,0.0306588285,0.02998253,0.035527273,0.0292072165,0.029793383,0.047716143,0.049222537,0.064000956,0.0566774295,0.04940418,0.032196465,0.035229687,0.0316403545,0.032114071,0.026134304,0.0329598915,0.06141801,0.0608211085,0.0466867525,0.030995951,0.029491277,0.0290619155,0.0293045425,0.0353293095,0.0296777175,0.0321526185,0.0298275115,0.0333823315,0.055459579]}},{"size":30,"stats":{"rme":10.196572911452558,"deviation":0.016950882253511955,"mean":0.05672012503030303,"variance":0.0002873324091724266,"moe":0.0057835089041819,"sem":0.002950769849072398,"sample":[0.074887433,0.0445944795,0.044674446,0.043556634,0.0443823625,0.043829276,0.0858092705,0.103504815,0.048014488,0.047890404,0.048966602,0.05002043,0.043563613,0.061443108,0.0841160365,0.06535325,0.045085154,0.0448393195,0.0439392025,0.0500291445,0.043515649,0.06409846,0.0922059635,0.0861639335,0.0566648975,0.0511201985,0.04770912,0.0489836645,0.047320121,0.0755704225,0.0476051575,0.0476457385,0.0446613315]}},{"size":40,"stats":{"rme":9.930646162682553,"deviation":0.023668284995469045,"mean":0.07679704181081082,"variance":0.0005601877146267451,"moe":0.007626442485639001,"sem":0.0038910420845096943,"sample":[0.052143771,0.069434919,0.058731688,0.114251402,0.11239274,0.058346858,0.05844314,0.059102826,0.06997728,0.058053769,0.069167853,0.062955236,0.119299588,0.129202811,0.065879631,0.066996705,0.063619309,0.05215786,0.070642053,0.060865257,0.111688204,0.112988049,0.110367724,0.062337581,0.060540493,0.061912282,0.06006606,0.070275507,0.05811019,0.109416035,0.111275031,0.107556884,0.080654523,0.065482641,0.066745946,0.063019478,0.057389223]}},{"size":50,"stats":{"rme":11.73302462038882,"deviation":0.030362559243494545,"mean":0.09490810106451614,"variance":0.000921885003814716,"moe":0.011135590864643182,"sem":0.005453276623233684,"sample":[0.088460392,0.083883499,0.080107714,0.077599468,0.148116763,0.157023449,0.071369693,0.067788856,0.080461149,0.071978216,0.067765264,0.11421297,0.160781147,0.073002688,0.073215338,0.084701256,0.075969303,0.081854793,0.12403599,0.150864601,0.076944106,0.076671633,0.081869227,0.082000742,0.067108813,0.082105339,0.148075904,0.140384757,0.076174001,0.088273427,0.089350635]}},{"size":100,"stats":{"rme":15.002716363446192,"deviation":0.0566192924627138,"mean":0.18768983044444446,"variance":0.00320574427897832,"moe":0.02815857290461308,"sem":0.013345295215456436,"sample":[0.163826084,0.145625548,0.281165284,0.145850567,0.150691297,0.190054167,0.189516084,0.161830323,0.156829129,0.281492724,0.13414889,0.156941707,0.160614052,0.287491174,0.165815161,0.163703051,0.298996685,0.143825021]}},{"size":250,"stats":{"rme":20.27634381770261,"deviation":0.1430509010198173,"mean":0.5046538042,"variance":0.02046356028258156,"moe":0.10232534042870772,"sem":0.045236666856192626,"sample":[0.395821402,0.390206412,0.642675487,0.500978927,0.38455247,0.596436916,0.602246083,0.362449302,0.392620335,0.778550708]}},{"size":500,"stats":{"rme":12.81937909717097,"deviation":0.1395040115871502,"mean":1.0064788542857144,"variance":0.019461369248907737,"moe":0.12902433986374873,"sem":0.052727560222210354,"sample":[0.959229338,1.2283453930000001,0.833027396,1.034469704,1.070045114,0.845875176,1.074359859]}},{"size":1000,"stats":{"rme":2.0049090098654823,"deviation":0.03926800948024038,"mean":2.0557517616666665,"variance":0.0015419765685402483,"moe":0.04121595229012337,"sem":0.0160310977402269,"sample":[2.022743171,2.096036793,2.083418595,2.035792053,2.091395433,2.005124525]}}]}]} \ No newline at end of file diff --git a/benchmark/right-bind-small.png b/benchmark/right-bind-small.png deleted file mode 100644 index bd31d9e..0000000 Binary files a/benchmark/right-bind-small.png and /dev/null differ diff --git a/bower.json b/bower.json deleted file mode 100644 index 08a9916..0000000 --- a/bower.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "purescript-free", - "homepage": "https://github.com/purescript/purescript-free", - "authors": [ - "Eric Thul ", - "Brian McKenna ", - "John A. De Goes (http://degoes.net)", - "Gary Burgess ", - "Phil Freeman " - ], - "license": "BSD-3-Clause", - "repository": { - "type": "git", - "url": "https://github.com/purescript/purescript-free.git" - }, - "ignore": [ - "**/.*", - "bower_components", - "node_modules", - "output", - "test", - "bower.json", - "package.json" - ], - "dependencies": { - "purescript-catenable-lists": "^7.0.0", - "purescript-control": "^6.0.0", - "purescript-distributive": "^6.0.0", - "purescript-either": "^6.0.0", - "purescript-exists": "^6.0.0", - "purescript-foldable-traversable": "^6.0.0", - "purescript-invariant": "^6.0.0", - "purescript-lazy": "^6.0.0", - "purescript-maybe": "^6.0.0", - "purescript-prelude": "^6.0.0", - "purescript-tailrec": "^6.0.0", - "purescript-transformers": "^6.0.0", - "purescript-tuples": "^7.0.0", - "purescript-unsafe-coerce": "^6.0.0" - }, - "devDependencies": { - "purescript-console": "^6.0.0", - "purescript-functors": "^5.0.0" - } -} diff --git a/package.json b/package.json index d28ee5d..e577dda 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,15 @@ { "private": true, "scripts": { - "clean": "rimraf output && rimraf .pulp-cache", - "build": "pulp build -- --censor-lib --strict", - "build:benchmark": "pulp build --main 'Benchmark.Main' --include './benchmark' -- --censor-lib --strict", - "test": "pulp test", - "test:benchmark": "node -e \"require('./output/Benchmark.Main').main()\"" + "build": "spago build -p free", + "test": "spago test -p free", + "format": "purs-tidy format-in-place src test && oxfmt --write .", + "format:check": "purs-tidy check src test && oxfmt --check ." }, "devDependencies": { - "benchmark": "^2.1.4", - "pulp": "16.0.0-0", - "purescript-psa": "^0.8.2", - "rimraf": "^3.0.2" + "oxfmt": "^0.73.0", + "purescript": "^0.15.16", + "purs-tidy": "^0.11.1", + "spago": "^1.0.5" } } diff --git a/spago.yaml b/spago.yaml new file mode 100644 index 0000000..e87874e --- /dev/null +++ b/spago.yaml @@ -0,0 +1,37 @@ +package: + name: free + description: Free monad, Cofree comonad, Yoneda and Coyoneda functors, and the + Trampoline monad + build: + strict: true + pedanticPackages: true + publish: + version: 7.1.1 + license: BSD-3-Clause + location: + githubOwner: purescript + githubRepo: purescript-free + dependencies: + - catenable-lists: ">=7.0.0 <8.0.0" + - control: ">=6.0.0 <7.0.0" + - distributive: ">=6.0.0 <7.0.0" + - either: ">=6.0.0 <7.0.0" + - exists: ">=6.0.0 <7.0.0" + - foldable-traversable: ">=6.0.0 <7.0.0" + - invariant: ">=6.0.0 <7.0.0" + - lazy: ">=6.0.0 <7.0.0" + - maybe: ">=6.0.0 <7.0.0" + - prelude: ">=6.0.0 <7.0.0" + - tailrec: ">=6.0.0 <7.0.0" + - transformers: ">=6.0.0 <7.0.0" + - tuples: ">=7.0.0 <8.0.0" + - unsafe-coerce: ">=6.0.0 <7.0.0" + test: + main: Test.Main + strict: true + pedanticPackages: true + dependencies: + - console: ">=6.0.0 <7.0.0" + - effect: ">=4.0.0 <5.0.0" + - functors: ">=5.0.0 <6.0.0" +workspace: {} diff --git a/src/Control/Comonad/Cofree.purs b/src/Control/Comonad/Cofree.purs index 711ecf2..4fd0e33 100644 --- a/src/Control/Comonad/Cofree.purs +++ b/src/Control/Comonad/Cofree.purs @@ -3,7 +3,8 @@ module Control.Comonad.Cofree ( Cofree , deferCofree - , mkCofree, (:<) + , mkCofree + , (:<) , head , tail , hoistCofree @@ -13,7 +14,8 @@ module Control.Comonad.Cofree ) where import Prelude -import Control.Alternative (class Alternative, (<|>), empty) + +import Control.Alternative (class Alternative, empty, (<|>)) import Control.Comonad (class Comonad, extract) import Control.Extend (class Extend) import Control.Lazy as Z @@ -21,10 +23,10 @@ import Control.Monad.Free (Free, runFreeM) import Control.Monad.Rec.Class (class MonadRec) import Control.Monad.State (State, StateT(..), runState, runStateT, state) import Data.Eq (class Eq1, eq1) +import Data.Foldable (class Foldable, foldMap, foldl, foldr) import Data.FoldableWithIndex (class FoldableWithIndex) import Data.FunctorWithIndex (class FunctorWithIndex) -import Data.Foldable (class Foldable, foldr, foldl, foldMap) -import Data.Lazy (Lazy, force, defer) +import Data.Lazy (Lazy, defer, force) import Data.Ord (class Ord1, compare1) import Data.Traversable (class Traversable, traverse) import Data.TraversableWithIndex (class TraversableWithIndex) @@ -86,11 +88,11 @@ explore -> Cofree g a -> b explore pair m w = - case runState (runFreeM step m) w of - Tuple f cof -> f (extract cof) + case runState (runFreeM step m) w of + Tuple f cof -> f (extract cof) where - step :: f (Free f (a -> b)) -> State (Cofree g a) (Free f (a -> b)) - step ff = state \cof -> pair (map Tuple ff) (tail cof) + step :: f (Free f (a -> b)) -> State (Cofree g a) (Free f (a -> b)) + step ff = state \cof -> pair (map Tuple ff) (tail cof) exploreM :: forall f g a b m @@ -104,11 +106,11 @@ exploreM exploreM pair m w = eval <$> runStateT (runFreeM step m) w where - step :: f (Free f (a -> b)) -> StateT (Cofree g a) m (Free f (a -> b)) - step ff = StateT \cof -> pair (map Tuple ff) (tail cof) + step :: f (Free f (a -> b)) -> StateT (Cofree g a) m (Free f (a -> b)) + step ff = StateT \cof -> pair (map Tuple ff) (tail cof) - eval :: forall x y. Tuple (x -> y) (Cofree g x) -> y - eval (Tuple f cof) = f (extract cof) + eval :: forall x y. Tuple (x -> y) (Cofree g x) -> y + eval (Tuple f cof) = f (extract cof) instance semigroupCofree :: (Apply f, Semigroup a) => Semigroup (Cofree f a) where append x y = deferCofree \_ -> Tuple (head x <> head y) (append <$> tail x <*> tail y) @@ -196,8 +198,10 @@ instance bindCofree :: Alternative f => Bind (Cofree f) where bind fa f = loop fa where loop fa' = - let fh = f (head fa') - in mkCofree (head fh) ((tail fh) <|> (loop <$> tail fa')) + let + fh = f (head fa') + in + mkCofree (head fh) ((tail fh) <|> (loop <$> tail fa')) instance monadCofree :: Alternative f => Monad (Cofree f) diff --git a/src/Control/Monad/Free.purs b/src/Control/Monad/Free.purs index bd2f94e..5061ba0 100644 --- a/src/Control/Monad/Free.purs +++ b/src/Control/Monad/Free.purs @@ -17,7 +17,6 @@ import Prelude import Control.Apply (lift2) import Control.Monad.Rec.Class (class MonadRec, Step(..), tailRecM) import Control.Monad.Trans.Class (class MonadTrans) - import Data.CatList (CatList, empty, snoc, uncons) import Data.Either (Either(..)) import Data.Eq (class Eq1, eq1) @@ -26,7 +25,6 @@ import Data.Maybe (Maybe(..)) import Data.Ord (class Ord1, compare1) import Data.Traversable (class Traversable, traverse) import Data.Tuple (Tuple(..)) - import Unsafe.Coerce (unsafeCoerce) -- | The free monad for a type constructor `f`. @@ -95,7 +93,7 @@ instance foldableFree :: (Functor f, Foldable f) => Foldable (Free f) where Right a -> f a foldl f = go where - go r = resume >>> case _ of + go r = resume >>> case _ of Left fa -> foldl go r fa Right a -> f r a foldr f = go @@ -117,7 +115,7 @@ instance semigroupFree :: Semigroup a => Semigroup (Free f a) where instance monoidFree :: Monoid a => Monoid (Free f a) where mempty = pure mempty - + -- | Lift an impure value described by the generating type constructor `f` into -- | the free monad. liftF :: forall f. f ~> Free f diff --git a/src/Control/Monad/Trampoline.purs b/src/Control/Monad/Trampoline.purs index 6634ca2..44d3306 100644 --- a/src/Control/Monad/Trampoline.purs +++ b/src/Control/Monad/Trampoline.purs @@ -13,7 +13,6 @@ import Prelude import Control.Monad.Free (Free, liftF, runFree) - -- | The `Trampoline` monad -- | -- | A computation of type `Trampoline a` consists of zero or more lazy diff --git a/src/Data/Coyoneda.purs b/src/Data/Coyoneda.purs index 9614ee0..12d5b3c 100644 --- a/src/Data/Coyoneda.purs +++ b/src/Data/Coyoneda.purs @@ -18,11 +18,11 @@ import Control.Monad.Trans.Class (class MonadTrans) import Control.MonadPlus (class MonadPlus) import Data.Distributive (class Distributive, collect) import Data.Eq (class Eq1, eq1) -import Data.Exists (Exists, runExists, mkExists) +import Data.Exists (Exists, mkExists, runExists) import Data.Foldable (class Foldable, foldMap, foldl, foldr) import Data.Functor.Invariant (class Invariant, imapF) import Data.Ord (class Ord1, compare1) -import Data.Semigroup.Foldable (class Foldable1, foldMap1, foldr1Default, foldl1Default) +import Data.Semigroup.Foldable (class Foldable1, foldMap1, foldl1Default, foldr1Default) import Data.Semigroup.Traversable (class Traversable1, sequence1, traverse1) import Data.Traversable (class Traversable, traverse) diff --git a/src/Data/Yoneda.purs b/src/Data/Yoneda.purs index 1aab85a..801d63c 100644 --- a/src/Data/Yoneda.purs +++ b/src/Data/Yoneda.purs @@ -11,7 +11,6 @@ import Prelude import Control.Comonad (class Comonad, extract) import Control.Extend (class Extend, (<<=)) import Control.Monad.Trans.Class (class MonadTrans) - import Data.Eq (class Eq1, eq1) import Data.Ord (class Ord1, compare1) diff --git a/test/Test/Control/Monad/Free/Coproduct.purs b/test/Test/Control/Monad/Free/Coproduct.purs index e65826b..cbdf9fb 100644 --- a/test/Test/Control/Monad/Free/Coproduct.purs +++ b/test/Test/Control/Monad/Free/Coproduct.purs @@ -2,7 +2,7 @@ module Test.Control.Monad.Free.Coproduct where import Prelude -import Control.Monad.Free (Free, liftF, hoistFree, foldFree) +import Control.Monad.Free (Free, foldFree, hoistFree, liftF) import Data.Functor.Coproduct (Coproduct, coproduct, left, right) import Effect (Effect) import Effect.Console (log) @@ -42,7 +42,7 @@ t :: T Unit t = hoistFree (right <<< right) (print3 "3") u :: T Unit -u = r *> s *> t +u = r *> s *> t teletype1N :: Teletype1F ~> Effect teletype1N (Print1 x a) = const a <$> log ("teletype1: " <> x) diff --git a/test/Test/Control/Monad/Free/Teletype.purs b/test/Test/Control/Monad/Free/Teletype.purs index 469b3b0..edd2f3b 100644 --- a/test/Test/Control/Monad/Free/Teletype.purs +++ b/test/Test/Control/Monad/Free/Teletype.purs @@ -2,9 +2,9 @@ module Test.Control.Monad.Free.Teletype where import Prelude +import Control.Monad.Free (Free, foldFree, liftF) import Effect (Effect) import Effect.Console (log) -import Control.Monad.Free (Free, foldFree, liftF) data TeletypeF a = PutStrLn String a | GetLine (String -> a)