Tests for foldable

This commit is contained in:
2021-01-03 00:05:16 +02:00
parent 3c1ea67566
commit 4112ed2aeb
4 changed files with 79 additions and 7 deletions

View File

@ -17,8 +17,16 @@ module Data.Functor.Foldable
)
where
import Data.Functor.Classes
newtype Fix f = Fix { getFix :: f (Fix f) }
instance Show1 f => Show (Fix f) where
showsPrec d (Fix f) = showString "Fix " . showsPrec1 d f
instance Eq1 f => Eq (Fix f) where
(Fix a) == (Fix b) = liftEq (==) a b
-- | Catamorphism or the fold
--
-- Fold a recursive structure into a value