diff --git a/src/Data/Functor/Listable.hs b/src/Data/Functor/Listable.hs index f847c8d11..e5dcc727f 100644 --- a/src/Data/Functor/Listable.hs +++ b/src/Data/Functor/Listable.hs @@ -14,6 +14,7 @@ module Data.Functor.Listable , tiers2 , liftCons1 , liftCons2 +, liftCons3 ) where import Prologue @@ -39,6 +40,10 @@ liftCons1 tiers f = mapT f tiers `addWeight` 1 liftCons2 :: [[a]] -> [[b]] -> (a -> b -> c) -> [[c]] liftCons2 tiers1 tiers2 f = mapT (uncurry f) (productWith (,) tiers1 tiers2) `addWeight` 1 +liftCons3 :: [[a]] -> [[b]] -> [[c]] -> (a -> b -> c -> d) -> [[d]] +liftCons3 tiers1 tiers2 tiers3 f = mapT (uncurry3 f) (productWith (\ x (y, z) -> (x, y, z)) tiers1 (liftCons2 tiers2 tiers3 (,)) ) `addWeight` 1 + where uncurry3 f (a, b, c) = f a b c + -- Instances