Tests for foldable
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user