summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsellout <>2019-11-08 17:35:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2019-11-08 17:35:00 (GMT)
commit2eb23b1086314fa642f19264c467ab80767174dc (patch)
treea0be9fc195a293f2df8618feaf30fa8c600a44ab
parent095f43f197260c250a8a48cab017334b513507e2 (diff)
version 0.1.1.2HEAD0.1.1.2master
-rw-r--r--CHANGELOG.md8
-rw-r--r--src/Yaya/Unsafe/Zoo.hs12
-rw-r--r--test/Test/Fold.hs50
-rw-r--r--test/test.hs15
-rw-r--r--yaya-unsafe.cabal15
5 files changed, 15 insertions, 85 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5109a44..974ca36 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to the [Haskell Package Versioning Policy](https://pvp.haskell.org/).
+## 0.1.1.2 – 2019–11–08
+### Changed
+- improved documentation
+
+## 0.1.1.1 – 2019–11–08
+### Added
+- tests for `law_cataCompose` (which bumps the yaya-hedgehog dependency for tests)
+
## 0.1.1.0 – 2019–01–08
### Added
- lower bounds on internal yaya dependencies
diff --git a/src/Yaya/Unsafe/Zoo.hs b/src/Yaya/Unsafe/Zoo.hs
index 902ac6e..70d4455 100644
--- a/src/Yaya/Unsafe/Zoo.hs
+++ b/src/Yaya/Unsafe/Zoo.hs
@@ -29,13 +29,13 @@ codyna φ = Unsafe.ghylo distIdentity (Unsafe.seqFreeT id) (φ . fmap runIdentit
dyna :: Functor f => GAlgebra (Cofree f) f b -> Coalgebra f a -> a -> b
dyna φ ψ = Unsafe.ghylo (distCofreeT id) seqIdentity φ (fmap Identity . ψ)
--- | Unlike most 'hylo's, 'elgot' composes an algebra and coalgebra in a way
--- that allows information to move between them. The coalgebra can return,
+-- | 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 φ ψ = Unsafe.hylo ((id ||| φ) . getCompose) (Compose . ψ)
--- | The dual of 'elgot', 'coelgot' allows the _algebra_ to short-circuit in
+-- | 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 ((,) a) f b -> Coalgebra f a -> a -> b
coelgot φ ψ = Unsafe.hylo (φ . getCompose) (Compose . (id &&& ψ))
@@ -67,8 +67,8 @@ gpostpro k e =
stream :: Coalgebra (XNor c) b -> (b -> a -> b) -> b -> [a] -> [c]
stream f g = fstream f g (const Neither)
--- | Basically the definition from Gibbons’ paper, except the flusher (`h`) is a
--- 'Coalgebra' instead of an 'unfold'.
+-- | Basically the definition from Gibbons’ paper, except the flusher (@h@) is a
+-- `Coalgebra` instead of an `unfold`.
fstream
:: Coalgebra (XNor c) b
-> (b -> a -> b)
@@ -92,7 +92,7 @@ fstream f g h =
-- x :: [Int]
-- x = stream project snoc [] [1, 2, 3, 4, 5]
--- TODO: Weaken 'Monad' constraint to 'Applicative'.
+-- TODO: Weaken `Monad` constraint to `Applicative`.
cotraverse
:: ( Steppable t (f a)
, Steppable u (f b)
diff --git a/test/Test/Fold.hs b/test/Test/Fold.hs
deleted file mode 100644
index 5c7b974..0000000
--- a/test/Test/Fold.hs
+++ /dev/null
@@ -1,50 +0,0 @@
-{-# LANGUAGE TemplateHaskell #-}
-
-module Test.Fold where
-
-import Hedgehog
-import qualified Hedgehog.Gen as Gen
-
-import Yaya.Fold.Common
-import Yaya.Hedgehog.Expr
-import Yaya.Hedgehog.Fold
-import qualified Yaya.Unsafe.Fold.Instances ()
-
--- | NB: Only in yaya-unsafe instead of yaya because the `Eq (Fix f)` instance
--- is needed.
-prop_fixAnaRefl :: Property
-prop_fixAnaRefl =
- property $ law_anaRefl =<< forAll (Gen.sized genFixExpr)
-
-prop_fixCataCancel :: Property
-prop_fixCataCancel =
- property $ law_cataCancel size =<< forAll (genExpr (Gen.sized genFixExpr))
-
-prop_fixCataRefl :: Property
-prop_fixCataRefl =
- property $ law_cataRefl =<< forAll (Gen.sized genFixExpr)
-
--- prop_fixCataCompose :: Property
--- prop_fixCataCompose =
--- property $ law_cataCompose size id =<< forAll (Gen.sized genFixExpr)
-
--- | NB: Only in yaya-unsafe instead of yaya because the `Eq (Nu f)` instance is
--- needed.
-prop_nuAnaRefl :: Property
-prop_nuAnaRefl =
- property $ law_anaRefl =<< forAll (Gen.sized genNuExpr)
-
-prop_nuCataCancel :: Property
-prop_nuCataCancel =
- property $ law_cataCancel size =<< forAll (genExpr (Gen.sized genNuExpr))
-
-prop_nuCataRefl :: Property
-prop_nuCataRefl =
- property $ law_cataRefl =<< forAll (Gen.sized genNuExpr)
-
--- prop_nuCataCompose :: Property
--- prop_nuCataCompose =
--- property $ law_cataCompose size id =<< forAll (Gen.sized genNuExpr)
-
-tests :: IO Bool
-tests = checkParallel $$(discover)
diff --git a/test/test.hs b/test/test.hs
deleted file mode 100644
index 61e5f3d..0000000
--- a/test/test.hs
+++ /dev/null
@@ -1,15 +0,0 @@
-import Control.Monad
-import System.Exit (exitFailure)
-import System.IO (BufferMode(..), hSetBuffering, stdout, stderr)
-
-import qualified Test.Fold as Fold
-
-main :: IO ()
-main = do
- hSetBuffering stdout LineBuffering
- hSetBuffering stderr LineBuffering
-
- results <- sequence [ Fold.tests
- ]
-
- unless (and results) exitFailure
diff --git a/yaya-unsafe.cabal b/yaya-unsafe.cabal
index 4c75327..a319546 100644
--- a/yaya-unsafe.cabal
+++ b/yaya-unsafe.cabal
@@ -1,5 +1,5 @@
name: yaya-unsafe
-version: 0.1.1.0
+version: 0.1.1.2
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
@@ -46,19 +46,6 @@ library
, TupleSections
default-language: Haskell2010
-test-suite yaya-unsafe-test
- type: exitcode-stdio-1.0
- hs-source-dirs: test
- main-is: test.hs
- other-modules: Test.Fold
- build-depends: base
- , hedgehog
- , yaya >= 0.1.0
- , yaya-hedgehog >= 0.1.1
- , yaya-unsafe >= 0.1.0
- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
- default-language: Haskell2010
-
source-repository head
type: git
location: https://github.com/sellout/yaya