From ad81f4f6051f737a7432e8f291fb27b6b394ade1 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 14 Feb 2017 11:59:42 -0500 Subject: [PATCH] Add weight to every layer of Free/Cofree. --- src/Data/Functor/Listable.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data/Functor/Listable.hs b/src/Data/Functor/Listable.hs index cea07a89d..7a2aaf8bf 100644 --- a/src/Data/Functor/Listable.hs +++ b/src/Data/Functor/Listable.hs @@ -114,7 +114,7 @@ instance Listable2 These where liftTiers2 this that = liftCons1 this This \/ liftCons1 that That \/ liftCons2 this that These instance Listable1 f => Listable2 (CofreeF f) where - liftTiers2 annotationTiers recurTiers = liftCons2 annotationTiers (liftTiers recurTiers) (:<) + liftTiers2 annotationTiers recurTiers = liftCons2 annotationTiers (liftTiers recurTiers `addWeight` 1) (:<) instance (Listable1 f, Listable a) => Listable1 (CofreeF f a) where liftTiers = liftTiers2 tiers @@ -124,7 +124,7 @@ instance (Functor f, Listable1 f) => Listable1 (Cofree f) where where go = liftCons1 (liftTiers2 annotationTiers go) cofree instance Listable1 f => Listable2 (FreeF f) where - liftTiers2 pureTiers recurTiers = liftCons1 pureTiers Pure \/ liftCons1 (liftTiers recurTiers) Free + liftTiers2 pureTiers recurTiers = liftCons1 pureTiers Pure \/ liftCons1 (liftTiers recurTiers `addWeight` 1) Free instance (Listable1 f, Listable a) => Listable1 (FreeF f a) where liftTiers = liftTiers2 tiers