1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 14:54:16 +03:00

Define a lifting of cons2.

This commit is contained in:
Rob Rix 2017-01-05 14:40:16 -05:00
parent fe6a0852c5
commit e5f4aed989

View File

@ -13,6 +13,7 @@ module Data.Functor.Listable
, Listable2(..) , Listable2(..)
, tiers2 , tiers2
, liftCons1 , liftCons1
, liftCons2
) where ) where
import Prologue import Prologue
@ -35,6 +36,9 @@ tiers2 = liftTiers2 tiers tiers
liftCons1 :: [[a]] -> (a -> b) -> [[b]] liftCons1 :: [[a]] -> (a -> b) -> [[b]]
liftCons1 tiers f = mapT f tiers `addWeight` 1 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
-- Instances -- Instances