yaya-unsafe 0.3.3.0 → 0.3.3.1
raw patch · 4 files changed
+183/−1 lines, 4 filesdep +hedgehogdep +yaya-hedgehogdep ~yayadep ~yaya-unsafe
Dependencies added: hedgehog, yaya-hedgehog
Dependency ranges changed: yaya, yaya-unsafe
Files
- CHANGELOG.md +22/−0
- tests/Test/Fold.hs +111/−0
- tests/test.hs +8/−0
- yaya-unsafe.cabal +42/−1
CHANGELOG.md view
@@ -5,6 +5,28 @@ 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.3.3.1 – 2024–03–11++### Added++- The tests for this package were previously in their own `yaya-unsafe-test` package, but that has been folded into this package. Presumably, they were only separated to parallel the separation between `yaya` and `yaya-test`, which had better motivation.++## 0.3.3.0++Unknown changes.++## 0.3.2.0++Unknown changes.++## 0.3.1.0++Unknown changes.++## 0.3.0.0++Unknown changes.+ ## 0.2.0.2 – 2023–12–21 ### Changed
+ tests/Test/Fold.hs view
@@ -0,0 +1,111 @@+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE Unsafe #-}+{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}++module Test.Fold (tests) where++import safe "base" Control.Category (Category (id))+import safe "base" Control.Monad ((=<<))+import safe "base" Data.Bool (Bool)+import safe "base" Data.Function (($))+import safe "base" Data.Int (Int)+import safe "base" Data.Proxy (Proxy (Proxy))+import safe "base" System.IO (IO)+import safe "hedgehog" Hedgehog+ ( Property,+ checkParallel,+ discover,+ forAll,+ property,+ )+import safe qualified "hedgehog" Hedgehog.Gen as Gen+import safe "yaya" Yaya.Fold (Mu, Nu)+import safe "yaya" Yaya.Fold.Common (size)+import safe "yaya" Yaya.Fold.Native (Cofix, Fix)+import safe "yaya-hedgehog" Yaya.Hedgehog.Expr+ ( Expr,+ genCofixExpr,+ genExpr,+ genFixExpr,+ genMuExpr,+ genNuExpr,+ )+import safe "yaya-hedgehog" Yaya.Hedgehog.Fold+ ( corecursiveIsUnsafe,+ law_anaRefl,+ law_cataCancel,+ law_cataCompose,+ law_cataRefl,+ recursiveIsUnsafe,+ )+import safe qualified "yaya-unsafe" Yaya.Unsafe.Fold.Instances ()++-- TODO: For some reason HLint is complaining that TemplateHaskell is unused.+{-# HLINT ignore "Unused LANGUAGE pragma" #-}++prop_fixAnaRefl :: Property+prop_fixAnaRefl =+ property $ law_anaRefl =<< forAll (Gen.sized genFixExpr)++-- | NB: Only in yaya-unsafe instead of yaya because the `Eq (Cofix f)` instance+-- is needed.+prop_cofixAnaRefl :: Property+prop_cofixAnaRefl =+ property $ law_anaRefl =<< forAll (Gen.sized genCofixExpr)++prop_cofixCataCancel :: Property+prop_cofixCataCancel =+ property $ law_cataCancel size =<< forAll (genExpr (Gen.sized genCofixExpr))++prop_cofixCataRefl :: Property+prop_cofixCataRefl =+ property $ law_cataRefl =<< forAll (Gen.sized genCofixExpr)++prop_cofixCataCompose :: Property+prop_cofixCataCompose =+ property $+ law_cataCompose (Proxy :: Proxy (Fix Expr)) size id+ =<< forAll (Gen.sized genCofixExpr)++-- | 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 (Proxy :: Proxy (Nu Expr)) size id+ =<< forAll (Gen.sized genNuExpr)++prop_muAnaRefl :: Property+prop_muAnaRefl =+ property $ law_anaRefl =<< forAll (Gen.sized genMuExpr)++-- * These tests try to verify non-termination behavior.++prop_muIsntCorecursive :: Property+prop_muIsntCorecursive = corecursiveIsUnsafe (Proxy :: Proxy Mu) (1 :: Int)++prop_nuIsntRecursive :: Property+prop_nuIsntRecursive = recursiveIsUnsafe (Proxy :: Proxy Nu) (1 :: Int)++-- TODO: Figure out why this hangs during compilation.+-- prop_fixIsntCorecursive :: Property+-- prop_fixIsntCorecursive = corecursiveIsUnsafe (Proxy :: Proxy Fix) (1 :: Int)++prop_cofixIsntRecursive :: Property+prop_cofixIsntRecursive = recursiveIsUnsafe (Proxy :: Proxy Cofix) (1 :: Int)++tests :: IO Bool+tests = checkParallel $$discover
+ tests/test.hs view
@@ -0,0 +1,8 @@+{-# LANGUAGE Unsafe #-}++import safe "base" System.IO (IO)+import safe "hedgehog" Hedgehog.Main (defaultMain)+import qualified "this" Test.Fold as Fold++main :: IO ()+main = defaultMain [Fold.tests]
yaya-unsafe.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0 name: yaya-unsafe-version: 0.3.3.0+version: 0.3.3.1 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@@ -212,3 +212,44 @@ -- “Build_doctests.hs”, we set it here, and that means it has to match -- doctests.hs, which is `Unsafe`. Unsafe++test-suite yaya-unsafe+ import: defaults+ type: exitcode-stdio-1.0+ hs-source-dirs:+ tests+ main-is: test.hs+ other-modules:+ Test.Fold+ build-depends:+ hedgehog,+ yaya >= 0.5.0,+ yaya-hedgehog >= 0.2.1,+ yaya-unsafe >= 0.3.0,+ ghc-options:+ -- NB: Need `-fno-omit-yields` so that `timeout` can interrupt native+ -- recursion in non-termination tests.+ -fno-omit-yields+ -rtsopts+ -threaded+ -trust adjunctions+ -trust array+ -trust base-orphans+ -trust binary+ -trust bytestring+ -trust containers+ -trust distributive+ -trust exceptions+ -trust ghc-prim+ -trust hashable+ -trust lens+ -trust profunctors+ -trust semigroupoids+ -trust stm+ -trust template-haskell+ -trust text+ -trust transformers-compat+ -with-rtsopts=-N+ if impl(ghc < 9.6)+ ghc-options:+ -trust foldable1-classes-compat