mirror of
https://github.com/github/semantic.git
synced 2024-12-23 14:54:16 +03:00
Define a lifting of cons3.
This commit is contained in:
parent
e5f4aed989
commit
8d9562e94e
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user