yaya-unsafe 0.5.0.0 → 1.0.0.0
raw patch · 9 files changed
+184/−153 lines, 9 filesdep −lensdep ~yayadep ~yaya-hedgehogsetup-changedPVP ok
version bump matches the API change (PVP)
Dependencies removed: lens
Dependency ranges changed: yaya, yaya-hedgehog
API changes (from Hackage documentation)
- Yaya.Unsafe.Fold: corecursivePrism :: forall t (f :: Type -> Type) a. (Steppable (->) t f, Recursive (->) t f, Traversable f) => CoalgebraPrism f a -> Prism' a t
- Yaya.Unsafe.Fold.Instances: seqFreeT :: forall (f :: Type -> Type) (h :: Type -> Type). (Functor f, Functor h) => DistributiveLaw (->) h f -> DistributiveLaw (->) (Free h) f
- Yaya.Unsafe.Zoo: futu :: (Corecursive (->) t f, Functor f) => GCoalgebra (->) (Free f) f a -> a -> t
- Yaya.Unsafe.Zoo: chrono :: Functor f => GAlgebra (->) (Cofree f) f b -> GCoalgebra (->) (Free f) f a -> a -> b
+ Yaya.Unsafe.Zoo: chrono :: (Functor f, forall x. () => Corecursive (->) (cofreef x) (EnvT x f), forall x. () => Projectable (->) (cofreef x) (EnvT x f), forall x. () => Recursive (->) (freef x) (FreeF f x), forall x. () => Steppable (->) (freef x) (FreeF f x), Comonad cofreef, Monad freef) => GAlgebra (->) cofreef f b -> GCoalgebra (->) freef f a -> a -> b
- Yaya.Unsafe.Zoo: codyna :: Functor f => Algebra (->) f b -> GCoalgebra (->) (Free f) f a -> a -> b
+ Yaya.Unsafe.Zoo: codyna :: (Functor f, forall x. () => Recursive (->) (freef x) (FreeF f x), forall x. () => Steppable (->) (freef x) (FreeF f x), Monad freef) => Algebra (->) f b -> GCoalgebra (->) freef f a -> a -> b
- Yaya.Unsafe.Zoo: dyna :: Functor f => GAlgebra (->) (Cofree f) f b -> Coalgebra (->) f a -> a -> b
+ Yaya.Unsafe.Zoo: dyna :: (Functor f, forall x. () => Corecursive (->) (cofreef x) (EnvT x f), forall x. () => Projectable (->) (cofreef x) (EnvT x f), Comonad cofreef) => GAlgebra (->) cofreef f b -> Coalgebra (->) f a -> a -> b
- Yaya.Unsafe.Zoo: zygoHistoPrepro :: (Steppable (->) t f, Recursive (->) t f, Functor f) => (f b -> b) -> (f (EnvT b (Cofree f) a) -> a) -> (forall c. () => f c -> f c) -> t -> a
+ Yaya.Unsafe.Zoo: zygoHistoPrepro :: forall t f (cofreef :: Type -> Type) b a. (Steppable (->) t f, Recursive (->) t f, forall x. () => Corecursive (->) (cofreef x) (EnvT x f), forall x. () => Projectable (->) (cofreef x) (EnvT x f), Functor f, Comonad cofreef) => (f b -> b) -> (f (EnvT b cofreef a) -> a) -> (forall c. () => f c -> f c) -> t -> a
Files
- CHANGELOG.md +26/−8
- Setup.hs +0/−5
- docs/license-report.md +29/−38
- src/Yaya/Unsafe/Applied.hs +1/−1
- src/Yaya/Unsafe/Fold.hs +14/−21
- src/Yaya/Unsafe/Fold/Instances.hs +24/−37
- src/Yaya/Unsafe/Zoo.hs +78/−34
- tests/Test/Fold.hs +1/−1
- yaya-unsafe.cabal +11/−8
CHANGELOG.md view
@@ -5,6 +5,23 @@ The format is based on [Keep a Changelog 1.1](https://keepachangelog.com/en/1.1.0/), and this project adheres to the [Haskell Package Versioning Policy](https://pvp.haskell.org/). +## [1.0.0.0] - 2026-04-22++### Added++- support for yaya-1.0.0.0++### Changed++- generalized type of `zygoHistoPrepro`++### Removed++- dependency on `lens`+- `corecursivePrism` (this was _not_ added to `yaya-lens`)+- `seqFreeT` and `futu` (these are now in `yaya`, because they’re safe)+- any import of `Yaya.Unsafe.Fold.Instances`, fixing massive transitive leakage of unsafe instances+ ## [0.5.0.0] - 2026-01-18 ### Added@@ -111,12 +128,13 @@ - everything (this is the initial release) -[0.5.0.0]: https://github.com/sellout/no-recursion/compare/v3.2.3...v4.0.0-[0.4.1.4]: https://github.com/sellout/no-recursion/compare/v3.2.2...v3.2.3-[0.4.1.3]: https://github.com/sellout/no-recursion/compare/v3.2.1...v3.2.2-[0.4.1.2]: https://github.com/sellout/no-recursion/compare/v3.2.0...v3.2.1-[0.4.1.1]: https://github.com/sellout/no-recursion/compare/v3.1.0...v3.2.0-[0.4.1.0]: https://github.com/sellout/no-recursion/compare/v3.0.0...v3.1.0-[0.4.0.0]: https://github.com/sellout/no-recursion/compare/v2.0.0...v3.0.0-[0.3.3.1]: https://github.com/sellout/no-recursion/compare/v1.0.0...v2.0.0+[1.0.0.0]: https://github.com/sellout/yaya/compare/v4.0.0...v5.0.0+[0.5.0.0]: https://github.com/sellout/yaya/compare/v3.2.3...v4.0.0+[0.4.1.4]: https://github.com/sellout/yaya/compare/v3.2.2...v3.2.3+[0.4.1.3]: https://github.com/sellout/yaya/compare/v3.2.1...v3.2.2+[0.4.1.2]: https://github.com/sellout/yaya/compare/v3.2.0...v3.2.1+[0.4.1.1]: https://github.com/sellout/yaya/compare/v3.1.0...v3.2.0+[0.4.1.0]: https://github.com/sellout/yaya/compare/v3.0.0...v3.1.0+[0.4.0.0]: https://github.com/sellout/yaya/compare/v2.0.0...v3.0.0+[0.3.3.1]: https://github.com/sellout/yaya/compare/v1.0.0...v2.0.0 [0.3.3.0]: https://github.com/sellout/yaya/releases/tag/v1.0.0
Setup.hs view
@@ -1,17 +1,12 @@ -- __NB__: `custom-setup` doesn’t have any way to specify extensions or options, -- so any we want need to be specified here.-{-# LANGUAGE CPP #-} {-# LANGUAGE PackageImports #-} {-# LANGUAGE Unsafe #-} {-# LANGUAGE NoImplicitPrelude #-}-#if MIN_VERSION_GLASGOW_HASKELL(8, 0, 0, 0) {-# OPTIONS_GHC -Weverything #-} -- Warns even when `Unsafe` is explicit, not inferred. See -- https://gitlab.haskell.org/ghc/ghc/-/issues/16689 {-# OPTIONS_GHC -Wno-unsafe #-}-#else-{-# OPTIONS_GHC -Wall #-}-#endif module Main (main) where
docs/license-report.md view
@@ -9,34 +9,31 @@ | Name | Version | [SPDX](https://spdx.org/licenses/) License Id | Description | Also depended upon by | | --- | --- | --- | --- | --- | | **`base`** | [`4.20.0.0`](http://hackage.haskell.org/package/base-4.20.0.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/base-4.20.0.0/src/LICENSE) | Core data structures and operations | *(core library)* |-| `comonad` | [`5.0.10`](http://hackage.haskell.org/package/comonad-5.0.10) | [`BSD-3-Clause`](http://hackage.haskell.org/package/comonad-5.0.10/src/LICENSE) | Comonads | `adjunctions`, `bifunctors`, `free`, `invariant`, `kan-extensions`, `lens`, `profunctors`, `semigroupoids`, `yaya` |-| `free` | [`5.2`](http://hackage.haskell.org/package/free-5.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/free-5.2/src/LICENSE) | Monads for free | `adjunctions`, `kan-extensions`, `lens`, `yaya` |-| `lens` | [`5.3.6`](http://hackage.haskell.org/package/lens-5.3.6) | [`BSD-2-Clause`](http://hackage.haskell.org/package/lens-5.3.6/src/LICENSE) | Lenses, Folds and Traversals | `yaya` |+| `comonad` | [`5.0.10`](http://hackage.haskell.org/package/comonad-5.0.10) | [`BSD-3-Clause`](http://hackage.haskell.org/package/comonad-5.0.10/src/LICENSE) | Comonads | `adjunctions`, `bifunctors`, `free`, `invariant`, `kan-extensions`, `profunctors`, `semigroupoids`, `yaya` |+| `free` | [`5.2`](http://hackage.haskell.org/package/free-5.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/free-5.2/src/LICENSE) | Monads for free | `adjunctions`, `kan-extensions`, `yaya` | | `no-recursion` | [`0.4.0.0`](http://hackage.haskell.org/package/no-recursion-0.4.0.0) | [`(AGPL-3.0-only WITH Universal-FOSS-exception-1.0 OR LicenseRef-commercial)`](http://hackage.haskell.org/package/no-recursion-0.4.0.0/src/LICENSE) | A GHC plugin to remove support for recursion | `yaya` |-| `yaya` | [`0.7.0.0`](http://hackage.haskell.org/package/yaya-0.7.0.0) | *MISSING* | *MISSING* | |+| `yaya` | [`1.0.0.0`](http://hackage.haskell.org/package/yaya-1.0.0.0) | *MISSING* | *MISSING* | | ## Indirect transitive dependencies | Name | Version | [SPDX](https://spdx.org/licenses/) License Id | Description | Depended upon by | | --- | --- | --- | --- | --- |-| `OneTuple` | [`0.4.2.1`](http://hackage.haskell.org/package/OneTuple-0.4.2.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/OneTuple-0.4.2.1/src/LICENSE) | Singleton Tuple | `indexed-traversable-instances` | | `StateVar` | [`1.2.2`](http://hackage.haskell.org/package/StateVar-1.2.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/StateVar-1.2.2/src/LICENSE) | State variables | `contravariant`, `invariant` | | `adjunctions` | [`4.4.4`](http://hackage.haskell.org/package/adjunctions-4.4.4) | [`BSD-2-Clause`](http://hackage.haskell.org/package/adjunctions-4.4.4/src/LICENSE) | Adjunctions and representable functors | `kan-extensions` |-| **`array`** | [`0.5.7.0`](http://hackage.haskell.org/package/array-0.5.7.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/array-0.5.7.0/src/LICENSE) | Mutable and immutable arrays | `binary`, `containers`, `deepseq`, `ghc`, `ghci`, `indexed-traversable`, `invariant`, `lens`, `parallel`, `stm`, `text` |-| `assoc` | [`1.1.1`](http://hackage.haskell.org/package/assoc-1.1.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/assoc-1.1.1/src/LICENSE) | swap and assoc: Symmetric and Semigroupy Bifunctors | `bifunctors`, `lens`, `strict`, `these` |-| `base-orphans` | [`0.9.4`](http://hackage.haskell.org/package/base-orphans-0.9.4) | [`MIT`](http://hackage.haskell.org/package/base-orphans-0.9.4/src/LICENSE) | Backwards-compatible orphan instances for base | `lens`, `profunctors`, `semigroupoids`, `transformers-base` |-| `bifunctors` | [`5.6.3`](http://hackage.haskell.org/package/bifunctors-5.6.3) | [`BSD-3-Clause`](http://hackage.haskell.org/package/bifunctors-5.6.3/src/LICENSE) | Bifunctors | `either`, `invariant`, `lens`, `profunctors`, `semigroupoids` |+| **`array`** | [`0.5.7.0`](http://hackage.haskell.org/package/array-0.5.7.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/array-0.5.7.0/src/LICENSE) | Mutable and immutable arrays | `binary`, `containers`, `deepseq`, `ghc`, `ghci`, `indexed-traversable`, `invariant`, `stm`, `text` |+| `assoc` | [`1.1.1`](http://hackage.haskell.org/package/assoc-1.1.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/assoc-1.1.1/src/LICENSE) | swap and assoc: Symmetric and Semigroupy Bifunctors | `bifunctors`, `strict`, `these` |+| `base-orphans` | [`0.9.4`](http://hackage.haskell.org/package/base-orphans-0.9.4) | [`MIT`](http://hackage.haskell.org/package/base-orphans-0.9.4/src/LICENSE) | Backwards-compatible orphan instances for base | `profunctors`, `semigroupoids`, `transformers-base` |+| `bifunctors` | [`5.6.3`](http://hackage.haskell.org/package/bifunctors-5.6.3) | [`BSD-3-Clause`](http://hackage.haskell.org/package/bifunctors-5.6.3/src/LICENSE) | Bifunctors | `either`, `invariant`, `profunctors`, `semigroupoids` | | **`binary`** | [`0.8.9.2`](http://hackage.haskell.org/package/binary-0.8.9.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/binary-0.8.9.2/src/LICENSE) | Binary serialisation for Haskell values using lazy ByteStrings | `ghc`, `ghc-boot`, `ghci`, `strict`, `text`, `these` |-| **`bytestring`** | [`0.12.1.0`](http://hackage.haskell.org/package/bytestring-0.12.1.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/bytestring-0.12.1.0/src/LICENSE) | Fast, compact, strict and lazy byte strings with a list interface | `binary`, `filepath`, `ghc`, `ghc-boot`, `ghci`, `hashable`, `lens`, `os-string`, `strict`, `text`, `unix` |-| `call-stack` | [`0.4.0`](http://hackage.haskell.org/package/call-stack-0.4.0) | [`MIT`](http://hackage.haskell.org/package/call-stack-0.4.0/src/LICENSE) | Use GHC call-stacks in a backward compatible way | `lens` |-| **`containers`** | [`0.7`](http://hackage.haskell.org/package/containers-0.7) | [`BSD-3-Clause`](http://hackage.haskell.org/package/containers-0.7/src/LICENSE) | Assorted concrete container types | `adjunctions`, `bifunctors`, `binary`, `comonad`, `free`, `ghc`, `ghc-boot`, `ghc-heap`, `ghci`, `hashable`, `hpc`, `indexed-traversable`, `invariant`, `lens`, `parallel`, `semigroupoids`, `th-abstraction` |-| `contravariant` | [`1.5.6`](http://hackage.haskell.org/package/contravariant-1.5.6) | [`BSD-3-Clause`](http://hackage.haskell.org/package/contravariant-1.5.6/src/LICENSE) | Contravariant functors | `invariant`, `kan-extensions`, `lens`, `profunctors`, `semigroupoids` |-| **`deepseq`** | [`1.5.0.0`](http://hackage.haskell.org/package/deepseq-1.5.0.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/deepseq-1.5.0.0/src/LICENSE) | Deep evaluation of data structures | `bytestring`, `containers`, `filepath`, `ghc`, `ghc-boot`, `ghci`, `hashable`, `hpc`, `os-string`, `parallel`, `pretty`, `primitive`, `process`, `strict`, `tagged`, `text`, `these`, `time`, `unordered-containers`, `vector` |+| **`bytestring`** | [`0.12.1.0`](http://hackage.haskell.org/package/bytestring-0.12.1.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/bytestring-0.12.1.0/src/LICENSE) | Fast, compact, strict and lazy byte strings with a list interface | `binary`, `filepath`, `ghc`, `ghc-boot`, `ghci`, `hashable`, `os-string`, `strict`, `text`, `unix` |+| **`containers`** | [`0.7`](http://hackage.haskell.org/package/containers-0.7) | [`BSD-3-Clause`](http://hackage.haskell.org/package/containers-0.7/src/LICENSE) | Assorted concrete container types | `adjunctions`, `bifunctors`, `binary`, `comonad`, `free`, `ghc`, `ghc-boot`, `ghc-heap`, `ghci`, `hashable`, `hpc`, `indexed-traversable`, `invariant`, `semigroupoids`, `th-abstraction` |+| `contravariant` | [`1.5.6`](http://hackage.haskell.org/package/contravariant-1.5.6) | [`BSD-3-Clause`](http://hackage.haskell.org/package/contravariant-1.5.6/src/LICENSE) | Contravariant functors | `invariant`, `kan-extensions`, `profunctors`, `semigroupoids` |+| **`deepseq`** | [`1.5.0.0`](http://hackage.haskell.org/package/deepseq-1.5.0.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/deepseq-1.5.0.0/src/LICENSE) | Deep evaluation of data structures | `bytestring`, `containers`, `filepath`, `ghc`, `ghc-boot`, `ghci`, `hashable`, `hpc`, `os-string`, `pretty`, `process`, `strict`, `tagged`, `text`, `these`, `time`, `unordered-containers` | | **`directory`** | [`1.3.8.3`](http://hackage.haskell.org/package/directory-1.3.8.3) | [`BSD-3-Clause`](http://hackage.haskell.org/package/directory-1.3.8.3/src/LICENSE) | Platform-agnostic library for filesystem operations | `ghc`, `ghc-boot`, `hpc`, `process` |-| `distributive` | [`0.6.3`](http://hackage.haskell.org/package/distributive-0.6.3) | [`BSD-3-Clause`](http://hackage.haskell.org/package/distributive-0.6.3/src/LICENSE) | Distributive functors -- Dual to Traversable | `adjunctions`, `comonad`, `free`, `kan-extensions`, `lens`, `profunctors` |+| `distributive` | [`0.6.3`](http://hackage.haskell.org/package/distributive-0.6.3) | [`BSD-3-Clause`](http://hackage.haskell.org/package/distributive-0.6.3/src/LICENSE) | Distributive functors -- Dual to Traversable | `adjunctions`, `comonad`, `free`, `kan-extensions`, `profunctors` | | `either` | [`5.0.3`](http://hackage.haskell.org/package/either-5.0.3) | [`BSD-3-Clause`](http://hackage.haskell.org/package/either-5.0.3/src/LICENSE) | Combinators for working with sums | `yaya` |-| **`exceptions`** | [`0.10.7`](http://hackage.haskell.org/package/exceptions-0.10.7) | [`BSD-3-Clause`](http://hackage.haskell.org/package/exceptions-0.10.7/src/LICENSE) | Extensible optionally-pure exceptions | `filepath`, `free`, `ghc`, `kan-extensions`, `lens`, `os-string`, `semaphore-compat` |-| **`filepath`** | [`1.5.2.0`](http://hackage.haskell.org/package/filepath-1.5.2.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/filepath-1.5.2.0/src/LICENSE) | Library for manipulating FilePaths in a cross platform way. | `directory`, `ghc`, `ghc-boot`, `ghci`, `hashable`, `hpc`, `lens`, `process`, `unix` |+| **`exceptions`** | [`0.10.7`](http://hackage.haskell.org/package/exceptions-0.10.7) | [`BSD-3-Clause`](http://hackage.haskell.org/package/exceptions-0.10.7/src/LICENSE) | Extensible optionally-pure exceptions | `filepath`, `free`, `ghc`, `kan-extensions`, `os-string`, `semaphore-compat` |+| **`filepath`** | [`1.5.2.0`](http://hackage.haskell.org/package/filepath-1.5.2.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/filepath-1.5.2.0/src/LICENSE) | Library for manipulating FilePaths in a cross platform way. | `directory`, `ghc`, `ghc-boot`, `ghci`, `hashable`, `hpc`, `process`, `unix` | | **`ghc`** | [`9.10.1`](http://hackage.haskell.org/package/ghc-9.10.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/ghc-9.10.1/src/LICENSE) | The GHC API | `no-recursion` | | **`ghc-bignum`** | [`1.3`](http://hackage.haskell.org/package/ghc-bignum-1.3) | [`BSD-3-Clause`](http://hackage.haskell.org/package/ghc-bignum-1.3/src/LICENSE) | GHC BigNum library | `ghc-internal` | | **`ghc-boot`** | [`9.10.1`](http://hackage.haskell.org/package/ghc-boot-9.10.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/ghc-boot-9.10.1/src/LICENSE) | Shared functionality between GHC and its boot libraries | `ghc`, `ghci` |@@ -46,35 +43,29 @@ | **`ghc-platform`** | [`0.1.0.0`](http://hackage.haskell.org/package/ghc-platform-0.1.0.0) | *MISSING* | *MISSING* | `ghc-boot` | | **`ghc-prim`** | [`0.11.0`](http://hackage.haskell.org/package/ghc-prim-0.11.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/ghc-prim-0.11.0/src/LICENSE) | GHC primitives | *(core library)* | | **`ghci`** | [`9.10.1`](http://hackage.haskell.org/package/ghci-9.10.1) | *MISSING* | *MISSING* | `ghc` |-| `hashable` | [`1.5.1.0`](http://hackage.haskell.org/package/hashable-1.5.1.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/hashable-1.5.1.0/src/LICENSE) | A class for types that can be converted to a hash value | `lens`, `semigroupoids`, `strict`, `these`, `unordered-containers` |+| `hashable` | [`1.5.1.0`](http://hackage.haskell.org/package/hashable-1.5.1.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/hashable-1.5.1.0/src/LICENSE) | A class for types that can be converted to a hash value | `semigroupoids`, `strict`, `these`, `unordered-containers` | | **`hpc`** | [`0.7.0.1`](http://hackage.haskell.org/package/hpc-0.7.0.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/hpc-0.7.0.1/src/LICENSE) | Code Coverage Library for Haskell | `ghc` |-| `indexed-traversable` | [`0.1.4`](http://hackage.haskell.org/package/indexed-traversable-0.1.4) | [`BSD-2-Clause`](http://hackage.haskell.org/package/indexed-traversable-0.1.4/src/LICENSE) | FunctorWithIndex, FoldableWithIndex, TraversableWithIndex | `comonad`, `free`, `indexed-traversable-instances`, `lens` |-| `indexed-traversable-instances` | [`0.1.2`](http://hackage.haskell.org/package/indexed-traversable-instances-0.1.2) | [`BSD-2-Clause`](http://hackage.haskell.org/package/indexed-traversable-instances-0.1.2/src/LICENSE) | More instances of FunctorWithIndex, FoldableWithIndex, TraversableWithIndex | `lens` |+| `indexed-traversable` | [`0.1.4`](http://hackage.haskell.org/package/indexed-traversable-0.1.4) | [`BSD-2-Clause`](http://hackage.haskell.org/package/indexed-traversable-0.1.4/src/LICENSE) | FunctorWithIndex, FoldableWithIndex, TraversableWithIndex | `comonad`, `free` | | `invariant` | [`0.6.5`](http://hackage.haskell.org/package/invariant-0.6.5) | [`BSD-2-Clause`](http://hackage.haskell.org/package/invariant-0.6.5/src/LICENSE) | Haskell98 invariant functors | `kan-extensions` |-| `kan-extensions` | [`5.2.8`](http://hackage.haskell.org/package/kan-extensions-5.2.8) | [`BSD-3-Clause`](http://hackage.haskell.org/package/kan-extensions-5.2.8/src/LICENSE) | Kan extensions, Kan lifts, the Yoneda lemma, and (co)density (co)monads | `lens`, `yaya` |-| **`mtl`** | [`2.3.1`](http://hackage.haskell.org/package/mtl-2.3.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/mtl-2.3.1/src/LICENSE) | Monad classes for transformers, using functional dependencies | `adjunctions`, `either`, `exceptions`, `free`, `kan-extensions`, `lens` |+| `kan-extensions` | [`5.2.8`](http://hackage.haskell.org/package/kan-extensions-5.2.8) | [`BSD-3-Clause`](http://hackage.haskell.org/package/kan-extensions-5.2.8/src/LICENSE) | Kan extensions, Kan lifts, the Yoneda lemma, and (co)density (co)monads | `yaya` |+| **`mtl`** | [`2.3.1`](http://hackage.haskell.org/package/mtl-2.3.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/mtl-2.3.1/src/LICENSE) | Monad classes for transformers, using functional dependencies | `adjunctions`, `either`, `exceptions`, `free`, `kan-extensions` | | **`os-string`** | [`2.0.2`](http://hackage.haskell.org/package/os-string-2.0.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/os-string-2.0.2/src/LICENSE) | Library for manipulating Operating system strings. | `directory`, `filepath`, `hashable`, `unix` |-| `parallel` | [`3.3.0.0`](http://hackage.haskell.org/package/parallel-3.3.0.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/parallel-3.3.0.0/src/LICENSE) | Parallel programming library | `lens` | | **`pretty`** | [`1.1.3.6`](http://hackage.haskell.org/package/pretty-1.1.3.6) | [`BSD-3-Clause`](http://hackage.haskell.org/package/pretty-1.1.3.6/src/LICENSE) | Pretty-printing library | `template-haskell` |-| `primitive` | [`0.9.1.0`](http://hackage.haskell.org/package/primitive-0.9.1.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/primitive-0.9.1.0/src/LICENSE) | Primitive memory-related operations | `vector` | | **`process`** | [`1.6.19.0`](http://hackage.haskell.org/package/process-1.6.19.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/process-1.6.19.0/src/LICENSE) | Process libraries | `ghc` |-| `profunctors` | [`5.6.3`](http://hackage.haskell.org/package/profunctors-5.6.3) | [`BSD-3-Clause`](http://hackage.haskell.org/package/profunctors-5.6.3/src/LICENSE) | Profunctors | `adjunctions`, `either`, `free`, `invariant`, `kan-extensions`, `lens`, `yaya` |-| `reflection` | [`2.1.9`](http://hackage.haskell.org/package/reflection-2.1.9) | [`BSD-3-Clause`](http://hackage.haskell.org/package/reflection-2.1.9/src/LICENSE) | Reifies arbitrary terms into types that can be reflected back into terms | `lens` |+| `profunctors` | [`5.6.3`](http://hackage.haskell.org/package/profunctors-5.6.3) | [`BSD-3-Clause`](http://hackage.haskell.org/package/profunctors-5.6.3/src/LICENSE) | Profunctors | `adjunctions`, `either`, `free`, `invariant`, `kan-extensions`, `yaya` | | **`semaphore-compat`** | [`1.0.0`](http://hackage.haskell.org/package/semaphore-compat-1.0.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/semaphore-compat-1.0.0) | Cross-platform abstraction for system semaphores | `ghc` |-| `semigroupoids` | [`6.0.2`](http://hackage.haskell.org/package/semigroupoids-6.0.2) | [`BSD-2-Clause`](http://hackage.haskell.org/package/semigroupoids-6.0.2/src/LICENSE) | Semigroupoids: Category sans id | `adjunctions`, `either`, `free`, `kan-extensions`, `lens` |+| `semigroupoids` | [`6.0.2`](http://hackage.haskell.org/package/semigroupoids-6.0.2) | [`BSD-2-Clause`](http://hackage.haskell.org/package/semigroupoids-6.0.2/src/LICENSE) | Semigroupoids: Category sans id | `adjunctions`, `either`, `free`, `kan-extensions` | | **`stm`** | [`2.5.3.1`](http://hackage.haskell.org/package/stm-2.5.3.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/stm-2.5.3.1/src/LICENSE) | Software Transactional Memory | `StateVar`, `exceptions`, `ghc`, `invariant`, `transformers-base` |-| `strict` | [`0.5.1`](http://hackage.haskell.org/package/strict-0.5.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/strict-0.5.1/src/LICENSE) | Strict data types and String IO. | `lens`, `yaya` |-| `tagged` | [`0.8.10`](http://hackage.haskell.org/package/tagged-0.8.10) | [`BSD-3-Clause`](http://hackage.haskell.org/package/tagged-0.8.10/src/LICENSE) | Haskell 98 phantom types to avoid unsafely passing dummy arguments | `adjunctions`, `bifunctors`, `comonad`, `distributive`, `indexed-traversable-instances`, `invariant`, `lens`, `profunctors`, `semigroupoids` |-| **`template-haskell`** | [`2.22.0.0`](http://hackage.haskell.org/package/template-haskell-2.22.0.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/template-haskell-2.22.0.0/src/LICENSE) | Support library for Template Haskell | `OneTuple`, `bifunctors`, `bytestring`, `containers`, `exceptions`, `filepath`, `free`, `ghc`, `ghci`, `invariant`, `lens`, `os-string`, `primitive`, `reflection`, `semigroupoids`, `tagged`, `text`, `th-abstraction`, `unordered-containers`, `yaya` |-| **`text`** | [`2.1.1`](http://hackage.haskell.org/package/text-2.1.1) | [`BSD-2-Clause`](http://hackage.haskell.org/package/text-2.1.1/src/LICENSE) | An efficient packed Unicode text type. | `hashable`, `lens`, `strict` |-| `th-abstraction` | [`0.7.2.0`](http://hackage.haskell.org/package/th-abstraction-0.7.2.0) | [`ISC`](http://hackage.haskell.org/package/th-abstraction-0.7.2.0/src/LICENSE) | Nicer interface for reified information about data types | `bifunctors`, `free`, `invariant`, `lens`, `yaya` |-| `these` | [`1.2.1`](http://hackage.haskell.org/package/these-1.2.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/these-1.2.1/src/LICENSE) | An either-or-both data type. | `lens`, `strict` |+| `strict` | [`0.5.1`](http://hackage.haskell.org/package/strict-0.5.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/strict-0.5.1/src/LICENSE) | Strict data types and String IO. | `yaya` |+| `tagged` | [`0.8.10`](http://hackage.haskell.org/package/tagged-0.8.10) | [`BSD-3-Clause`](http://hackage.haskell.org/package/tagged-0.8.10/src/LICENSE) | Haskell 98 phantom types to avoid unsafely passing dummy arguments | `adjunctions`, `bifunctors`, `comonad`, `distributive`, `invariant`, `profunctors`, `semigroupoids` |+| **`template-haskell`** | [`2.22.0.0`](http://hackage.haskell.org/package/template-haskell-2.22.0.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/template-haskell-2.22.0.0/src/LICENSE) | Support library for Template Haskell | `bifunctors`, `bytestring`, `containers`, `exceptions`, `filepath`, `free`, `ghc`, `ghci`, `invariant`, `os-string`, `semigroupoids`, `tagged`, `text`, `th-abstraction`, `unordered-containers`, `yaya` |+| **`text`** | [`2.1.1`](http://hackage.haskell.org/package/text-2.1.1) | [`BSD-2-Clause`](http://hackage.haskell.org/package/text-2.1.1/src/LICENSE) | An efficient packed Unicode text type. | `hashable`, `strict` |+| `th-abstraction` | [`0.7.2.0`](http://hackage.haskell.org/package/th-abstraction-0.7.2.0) | [`ISC`](http://hackage.haskell.org/package/th-abstraction-0.7.2.0/src/LICENSE) | Nicer interface for reified information about data types | `bifunctors`, `free`, `invariant`, `yaya` |+| `these` | [`1.2.1`](http://hackage.haskell.org/package/these-1.2.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/these-1.2.1/src/LICENSE) | An either-or-both data type. | `strict` | | **`time`** | [`1.12.2`](http://hackage.haskell.org/package/time-1.12.2) | [`BSD-2-Clause`](http://hackage.haskell.org/package/time-1.12.2/src/LICENSE) | A time library | `directory`, `ghc`, `hpc`, `unix` |-| **`transformers`** | [`0.6.1.1`](http://hackage.haskell.org/package/transformers-0.6.1.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/transformers-0.6.1.1/src/LICENSE) | Concrete functor and monad transformers | `StateVar`, `adjunctions`, `comonad`, `contravariant`, `distributive`, `exceptions`, `free`, `ghc`, `ghci`, `indexed-traversable`, `invariant`, `kan-extensions`, `lens`, `mtl`, `primitive`, `profunctors`, `semigroupoids`, `strict`, `transformers-base`, `transformers-compat`, `yaya` |-| `transformers-base` | [`0.4.6`](http://hackage.haskell.org/package/transformers-base-0.4.6) | [`BSD-3-Clause`](http://hackage.haskell.org/package/transformers-base-0.4.6/src/LICENSE) | Lift computations from the bottom of a transformer stack | `free` |+| **`transformers`** | [`0.6.1.1`](http://hackage.haskell.org/package/transformers-0.6.1.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/transformers-0.6.1.1/src/LICENSE) | Concrete functor and monad transformers | `StateVar`, `adjunctions`, `comonad`, `contravariant`, `distributive`, `exceptions`, `free`, `ghc`, `ghci`, `indexed-traversable`, `invariant`, `kan-extensions`, `mtl`, `profunctors`, `semigroupoids`, `strict`, `transformers-base`, `transformers-compat`, `yaya` |+| `transformers-base` | [`0.4.6.1`](http://hackage.haskell.org/package/transformers-base-0.4.6.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/transformers-base-0.4.6.1/src/LICENSE) | Lift computations from the bottom of a transformer stack | `free` | | `transformers-compat` | [`0.7.2`](http://hackage.haskell.org/package/transformers-compat-0.7.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/transformers-compat-0.7.2/src/LICENSE) | A small compatibility shim for the transformers library | `semigroupoids`, `transformers-base` | | **`unix`** | [`2.8.5.1`](http://hackage.haskell.org/package/unix-2.8.5.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/unix-2.8.5.1/src/LICENSE) | POSIX functionality | `directory`, `ghc`, `ghc-boot`, `ghci`, `process`, `semaphore-compat` |-| `unordered-containers` | [`0.2.21`](http://hackage.haskell.org/package/unordered-containers-0.2.21) | [`BSD-3-Clause`](http://hackage.haskell.org/package/unordered-containers-0.2.21/src/LICENSE) | Efficient hashing-based container types | `indexed-traversable-instances`, `invariant`, `lens`, `semigroupoids` |-| `vector` | [`0.13.2.0`](http://hackage.haskell.org/package/vector-0.13.2.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/vector-0.13.2.0/src/LICENSE) | Efficient Arrays | `indexed-traversable-instances`, `lens` |-| `vector-stream` | [`0.1.0.1`](http://hackage.haskell.org/package/vector-stream-0.1.0.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/vector-stream-0.1.0.1/src/LICENSE) | Efficient Streams | `vector` |+| `unordered-containers` | [`0.2.21`](http://hackage.haskell.org/package/unordered-containers-0.2.21) | [`BSD-3-Clause`](http://hackage.haskell.org/package/unordered-containers-0.2.21/src/LICENSE) | Efficient hashing-based container types | `invariant`, `semigroupoids` |
src/Yaya/Unsafe/Applied.hs view
@@ -5,7 +5,7 @@ ) where -import "yaya" Yaya.Fold (Steppable (embed))+import "yaya" Yaya.Fold (Steppable, embed) import "yaya" Yaya.Pattern (XNor) import "this" Yaya.Unsafe.Fold (unsafeCata)
src/Yaya/Unsafe/Fold.hs view
@@ -4,7 +4,6 @@ -- laziness) can lead to non-termination. module Yaya.Unsafe.Fold ( anaM,- corecursivePrism, ganaM, ghylo, ghyloM,@@ -18,47 +17,47 @@ ) where -import "base" Control.Applicative (Applicative (pure))-import "base" Control.Category (Category ((.)))+import "base" Control.Applicative (pure)+import "base" Control.Category ((.)) import "base" Control.Monad (Monad, (<=<)) import "base" Data.Function (flip, ($))-import "base" Data.Functor (Functor (fmap))-import "base" Data.Functor.Compose (Compose (Compose, getCompose))-import "base" Data.Traversable (Traversable (sequenceA))-import "comonad" Control.Comonad (Comonad (extract))-import "lens" Control.Lens (Prism', matching, prism, review)+import "base" Data.Functor (Functor, fmap)+import "base" Data.Functor.Compose (Compose (Compose), getCompose)+import "base" Data.Traversable (Traversable, sequenceA)+import "comonad" Control.Comonad (Comonad, extract) import "yaya" Yaya.Fold ( Algebra, AlgebraM, Coalgebra, CoalgebraM,- CoalgebraPrism,- Corecursive (ana),+ Corecursive, DistributiveLaw, GAlgebra, GAlgebraM, GCoalgebra, GCoalgebraM,- Projectable (project),- Recursive (cata),- Steppable (embed),+ Projectable,+ Steppable,+ ana,+ embed, lowerAlgebra, lowerAlgebraM, lowerCoalgebra, lowerCoalgebraM,+ project, ) import "yaya" Yaya.Pattern (Maybe, Pair, maybe, uncurry) -- | Instances leak transitively, so while "Yaya.Unsafe.Fold.Instances" exists, -- it should only be used when it is unavoidable. If you are explicitly--- folding a structure unsafely, use this function instead of importing that+-- unfolding a structure unsafely, use this function instead of importing that -- module. unsafeAna :: (Steppable (->) t f, Functor f) => Coalgebra (->) f a -> a -> t unsafeAna = hylo embed -- | Instances leak transitively, so while "Yaya.Unsafe.Fold.Instances" exists, -- it should only be used when it is unavoidable. If you are explicitly--- unfolding a structure unsafely, use this function instead of importing that+-- folding a structure unsafely, use this function instead of importing that -- module. -- -- Should one prefer `unsafeAna` or `unsafeCata` in cases where both are@@ -262,9 +261,3 @@ streamGApo flush process accum = stream' process $ \state cont -> maybe (ana flush state) (uncurry cont) . accum--corecursivePrism ::- (Steppable (->) t f, Recursive (->) t f, Traversable f) =>- CoalgebraPrism f a ->- Prism' a t-corecursivePrism alg = prism (cata $ review alg) (anaM $ matching alg)
src/Yaya/Unsafe/Fold/Instances.hs view
@@ -1,4 +1,6 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE TypeFamilies #-}+{-# OPTIONS_GHC -Wno-orphans #-} -- __NB__: base-4.17 moves `IsList` to its own module, which avoids the unsafety -- of importing "GHC.Exts". With prior versions of base, we at least@@ -8,8 +10,6 @@ #else {-# LANGUAGE Trustworthy #-} #endif-{-# LANGUAGE TypeFamilies #-}-{-# OPTIONS_GHC -Wno-orphans #-} -- | Type class instances that use direct recursion in a potentially partial -- way. This is separated from the rest of `Yaya.Unsafe.Fold` because you can@@ -20,38 +20,28 @@ -- This contains instances that you might /expect/ to see, but which aren’t -- actually total. For example, folding a lazy list @[a]@ is /not/ guaranteed -- to terminate.-module Yaya.Unsafe.Fold.Instances- ( seqFreeT,- )-where+module Yaya.Unsafe.Fold.Instances () where -import safe "base" Control.Category (Category ((.)))-import safe "base" Data.Eq (Eq ((==)))+import safe "base" Data.Eq (Eq, (==)) import safe "base" Data.Foldable (Foldable) import safe "base" Data.Function (flip)-import safe "base" Data.Functor (Functor, (<$>))+import safe "base" Data.Functor (Functor) import safe "base" Data.Functor.Classes (Eq1, Ord1, Show1) import safe "base" Data.List.NonEmpty (NonEmpty)-import safe "base" Data.Ord (Ord (compare))---- See comment on @{-# LANGUAGE Safe #-}@ above.-#if MIN_VERSION_base(4, 17, 0)-import "base" GHC.IsList (IsList (Item, fromList, fromListN, toList))-#else-import "base" GHC.Exts (IsList (Item, fromList, fromListN, toList))-#endif-import safe "base" Text.Show (Show (showsPrec))+import safe "base" Data.Ord (Ord, compare)+import safe "base" Text.Show (Show, showsPrec) import safe "comonad" Control.Comonad.Env (EnvT) import safe "free" Control.Comonad.Cofree (Cofree)-import safe "free" Control.Monad.Trans.Free (Free, FreeF (Free, Pure), free)+import safe "free" Control.Monad.Trans.Free (Free, FreeF) import safe "yaya" Yaya.Fold- ( Corecursive (ana),- DistributiveLaw,+ ( Corecursive, Mu, Nu,- Projectable (project),- Recursive (cata),- Steppable (embed),+ Recursive,+ ana,+ cata,+ embed,+ project, recursiveCompare, recursiveEq, recursiveShowsPrec,@@ -61,6 +51,13 @@ import safe "this" Yaya.Unsafe.Applied (unsafeFromList) import safe qualified "this" Yaya.Unsafe.Fold as Unsafe +-- See comment on @{-# LANGUAGE Safe #-}@ above.+#if MIN_VERSION_base(4, 17, 0)+import "base" GHC.IsList (IsList (Item, fromList, fromListN, toList))+#else+import "base" GHC.Exts (IsList (Item, fromList, fromListN, toList))+#endif+ instance (Functor f) => Corecursive (->) (Fix f) f where ana = Unsafe.hylo embed @@ -69,6 +66,7 @@ instance (Functor f, Foldable f, Eq1 f) => Eq (Cofix f) where (==) = recursiveEq+ {-# INLINEABLE (==) #-} -- | @since 0.4.1.0 instance (Functor f, Foldable f, Ord1 f) => Ord (Cofix f) where@@ -79,12 +77,14 @@ instance (Functor f) => Corecursive (->) (Mu f) f where ana = Unsafe.unsafeAna+ {-# INLINEABLE ana #-} instance (Functor f) => Recursive (->) (Nu f) f where cata = Unsafe.unsafeCata instance (Functor f, Foldable f, Eq1 f) => Eq (Nu f) where (==) = recursiveEq+ {-# INLINEABLE (==) #-} -- | @since 0.4.1.0 instance (Functor f, Foldable f, Ord1 f) => Ord (Nu f) where@@ -104,19 +104,6 @@ instance (Functor f) => Recursive (->) (Free f a) (FreeF f a) where cata = Unsafe.unsafeCata---- TODO: If we can generalize this to an arbitrary 'Recursive (->) t (FreeF h a)'--- then it would no longer be unsafe.-seqFreeT ::- (Functor f, Functor h) =>- DistributiveLaw (->) h f ->- DistributiveLaw (->) (Free h) f-seqFreeT k =- cata- ( \case- Pure a -> free . Pure <$> a- Free ft -> free . Free <$> k ft- ) -- | `fromList` in this instance is unsafe, but `fromListN` is safe, because we -- have a finite length to fold.
src/Yaya/Unsafe/Zoo.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE QuantifiedConstraints #-} {-# LANGUAGE Safe #-} module Yaya.Unsafe.Zoo@@ -8,7 +9,6 @@ dyna, elgot, fstream,- futu, gpostpro, gprepro, stream,@@ -16,72 +16,109 @@ ) where -import "base" Control.Applicative (Applicative (pure))-import "base" Control.Category (Category (id, (.)))+import "base" Control.Applicative (pure)+import "base" Control.Category (id, (.)) import "base" Control.Monad (Monad)-import "base" Data.Bifunctor (Bifunctor (second))-import "base" Data.Bitraversable (Bitraversable (bitraverse))+import "base" Data.Bifunctor (second)+import "base" Data.Bitraversable (Bitraversable, bitraverse) import "base" Data.Function (const, flip)-import "base" Data.Functor (Functor (fmap))-import "base" Data.Functor.Compose (Compose (Compose, getCompose))-import "base" Data.Functor.Identity (Identity (Identity, runIdentity))+import "base" Data.Functor (Functor, fmap)+import "base" Data.Functor.Compose (Compose (Compose), getCompose)+import "base" Data.Functor.Identity (Identity (Identity), runIdentity) import "base" Data.Traversable (Traversable) import "comonad" Control.Comonad (Comonad) import "comonad" Control.Comonad.Env (EnvT)-import "free" Control.Comonad.Cofree (Cofree)-import "free" Control.Monad.Trans.Free (Free)+import "free" Control.Monad.Trans.Free (FreeF) import "yaya" Yaya.Fold ( Algebra, Coalgebra,- Corecursive (ana),+ Corecursive, DistributiveLaw, ElgotAlgebra, ElgotCoalgebra, GAlgebra, GCoalgebra,- Projectable (project),- Recursive (cata),- Steppable (embed),+ Projectable,+ Recursive,+ Steppable,+ ana,+ cata,+ distCofreeT, distEnvT, distIdentity,- gana,+ embed,+ project,+ seqFreeT, seqIdentity, ) import "yaya" Yaya.Fold.Common (diagonal, fromEither)-import "yaya" Yaya.Fold.Native (distCofreeT)-import "yaya" Yaya.Pattern (Either, Maybe (Nothing), Pair ((:!:)), XNor (Both, Neither))+import "yaya" Yaya.Fold.Native ()+import "yaya" Yaya.Pattern+ ( Either,+ Maybe (Nothing),+ Pair ((:!:)),+ XNor (Both, Neither),+ ) import qualified "this" Yaya.Unsafe.Fold as Unsafe-import qualified "this" Yaya.Unsafe.Fold.Instances as Unsafe -- FIXME: extremely unsafe chrono ::- (Functor f) =>- GAlgebra (->) (Cofree f) f b ->- GCoalgebra (->) (Free f) f a ->+ ( Functor f,+ forall x. Corecursive (->) (cofreef x) (EnvT x f),+ forall x. Projectable (->) (cofreef x) (EnvT x f),+ forall x. Recursive (->) (freef x) (FreeF f x),+ forall x. Steppable (->) (freef x) (FreeF f x),+ Comonad cofreef,+ Monad freef+ ) =>+ GAlgebra (->) cofreef f b ->+ GCoalgebra (->) freef f a -> a -> b-chrono = Unsafe.ghylo (distCofreeT id) (Unsafe.seqFreeT id)+chrono = Unsafe.ghylo (distCofreeT id) (seqFreeT id) -codyna :: (Functor f) => Algebra (->) f b -> GCoalgebra (->) (Free f) f a -> a -> b-codyna φ = Unsafe.ghylo distIdentity (Unsafe.seqFreeT id) (φ . fmap runIdentity)+codyna ::+ ( Functor f,+ forall x. Recursive (->) (freef x) (FreeF f x),+ forall x. Steppable (->) (freef x) (FreeF f x),+ Monad freef+ ) =>+ Algebra (->) f b ->+ GCoalgebra (->) freef f a ->+ a ->+ b+codyna φ = Unsafe.ghylo distIdentity (seqFreeT id) (φ . fmap runIdentity) --- | [Recursion Schemes for Dynamic Programming](https://www.researchgate.net/publication/221440162_Recursion_Schemes_for_Dynamic_Programming)-dyna :: (Functor f) => GAlgebra (->) (Cofree f) f b -> Coalgebra (->) f a -> a -> b+-- | [Recursion Schemes for Dynamic+-- Programming](https://www.researchgate.net/publication/221440162_Recursion_Schemes_for_Dynamic_Programming)+dyna ::+ ( Functor f,+ forall x. Corecursive (->) (cofreef x) (EnvT x f),+ forall x. Projectable (->) (cofreef x) (EnvT x f),+ Comonad cofreef+ ) =>+ GAlgebra (->) cofreef f b ->+ Coalgebra (->) f a ->+ a ->+ b dyna φ ψ = Unsafe.ghylo (distCofreeT id) seqIdentity φ (fmap Identity . ψ) -- | Unlike most `Unsafe.hylo`s, `elgot` composes an algebra and coalgebra in a -- way that allows information to move between them. The coalgebra can return, -- effectively, a pre-folded branch, short-circuiting parts of the process.-elgot :: (Functor f) => Algebra (->) f b -> ElgotCoalgebra (->) (Either b) f a -> a -> b+elgot ::+ (Functor f) =>+ Algebra (->) f b ->+ ElgotCoalgebra (->) (Either b) f a ->+ a ->+ b elgot φ ψ = Unsafe.hylo (fromEither . second φ . getCompose) (Compose . ψ) -- | The dual of `elgot`, `coelgot` allows the /algebra/ to short-circuit in -- some cases – operating directly on a part of the seed.-coelgot :: (Functor f) => ElgotAlgebra (->) (Pair a) f b -> Coalgebra (->) f a -> a -> b+coelgot ::+ (Functor f) => ElgotAlgebra (->) (Pair a) f b -> Coalgebra (->) f a -> a -> b coelgot φ ψ = Unsafe.hylo (φ . getCompose) (Compose . second ψ . diagonal) -futu :: (Corecursive (->) t f, Functor f) => GCoalgebra (->) (Free f) f a -> a -> t-futu = gana (Unsafe.seqFreeT id)- gprepro :: (Steppable (->) t f, Recursive (->) t f, Functor f, Comonad w) => DistributiveLaw (->) f w ->@@ -152,11 +189,18 @@ m u cotraverse f = Unsafe.anaM (bitraverse f pure . project) --- | Zygohistomorphic prepromorphism – everyone’s favorite recursion scheme joke.+-- | Zygohistomorphic prepromorphism – everyone’s favorite recursion scheme+-- joke. zygoHistoPrepro ::- (Steppable (->) t f, Recursive (->) t f, Functor f) =>+ ( Steppable (->) t f,+ Recursive (->) t f,+ forall x. Corecursive (->) (cofreef x) (EnvT x f),+ forall x. Projectable (->) (cofreef x) (EnvT x f),+ Functor f,+ Comonad cofreef+ ) => (f b -> b) ->- (f (EnvT b (Cofree f) a) -> a) ->+ (f (EnvT b cofreef a) -> a) -> (forall c. f c -> f c) -> t -> a
tests/Test/Fold.hs view
@@ -5,7 +5,7 @@ module Test.Fold (tests) where -import safe "base" Control.Category (Category (id))+import safe "base" Control.Category (id) import safe "base" Control.Monad ((=<<)) import safe "base" Data.Bool (Bool) import safe "base" Data.Function (($))
yaya-unsafe.cabal view
@@ -3,7 +3,7 @@ -- exception. name: yaya-unsafe-version: 0.5.0.0+version: 1.0.0.0 synopsis: Non-total extensions to the Yaya recursion scheme library. description: Yaya is designed as a _total_ library. However, it is often expedient to use partial operations in some cases, and this package@@ -55,7 +55,7 @@ location: https://github.com/sellout/yaya.git subdir: unsafe -- NB: This is the repo version, which is distinct from the package version.- tag: v4.0.0+ tag: v5.0.0 custom-setup setup-depends:@@ -149,8 +149,6 @@ base ^>= {4.13.0, 4.14.0, 4.15.0, 4.16.0, 4.17.0, 4.18.0, 4.19.0, 4.20.0, 4.21.0, 4.22.0}, ghc-options: -Weverything- -- This one just reports unfixable things, AFAICT.- -Wno-all-missed-specialisations -- Type inference good. -Wno-missing-local-signatures -- Warns even when `Unsafe` is explicit, not inferred. See@@ -176,6 +174,12 @@ -Wno-missing-poly-kind-signatures -- Inference good. -Wno-missing-role-annotations+ -- remove if the oldest supported version is GHC 9.14.1++ if impl(ghc >= 9.14.1)+ ghc-options:+ -- See+ -- https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0581-namespace-specified-imports.rst#deprecate-use-of-pattern-in-import-export-lists+ -Wno-pattern-namespace-specifier default-extensions: BlockArguments DefaultSignatures@@ -214,8 +218,7 @@ build-depends: comonad ^>= 5.0.7, free ^>= {5.1.5, 5.2},- lens ^>= {5, 5.1, 5.2, 5.3},- yaya ^>= {0.5.1, 0.6.0, 0.7.0},+ yaya ^>= {0.5.1, 0.6.0, 0.7.0, 1.0.0}, exposed-modules: Yaya.Unsafe.Applied Yaya.Unsafe.Fold@@ -263,8 +266,8 @@ Test.Fold build-depends: hedgehog ^>= {1.0.1, 1.1, 1.2, 1.4, 1.5, 1.7},- yaya ^>= {0.5.1, 0.6.0, 0.7.0},- yaya-hedgehog ^>= {0.2.1, 0.3.0, 0.4.0},+ yaya ^>= {0.5.1, 0.6.0, 0.7.0, 1.0.0},+ yaya-hedgehog ^>= {0.2.1, 0.3.0, 0.4.0, 1.0.0}, yaya-unsafe, ghc-options: -- NB: Need `-fno-omit-yields` so that `timeout` can interrupt native