module Control.Applicative.HT where import qualified Data.Tuple.HT as Tuple import Control.Applicative (Applicative, liftA2, liftA3, (<$>), (<*>), ) mapPair :: (Applicative f) => (a -> f c, b -> f d) -> (a,b) -> f (c,d) mapPair :: forall (f :: * -> *) a c b d. Applicative f => (a -> f c, b -> f d) -> (a, b) -> f (c, d) mapPair (a -> f c, b -> f d) fg = forall a b c. (a -> b -> c) -> (a, b) -> c uncurry (forall (f :: * -> *) a b c. Applicative f => (a -> b -> c) -> f a -> f b -> f c liftA2 (,)) forall b c a. (b -> c) -> (a -> b) -> a -> c . forall a c b d. (a -> c, b -> d) -> (a, b) -> (c, d) Tuple.mapPair (a -> f c, b -> f d) fg mapTriple :: (Applicative m) => (a -> m d, b -> m e, c -> m f) -> (a,b,c) -> m (d,e,f) mapTriple :: forall (m :: * -> *) a d b e c f. Applicative m => (a -> m d, b -> m e, c -> m f) -> (a, b, c) -> m (d, e, f) mapTriple (a -> m d, b -> m e, c -> m f) fgh = forall a b c d. (a -> b -> c -> d) -> (a, b, c) -> d Tuple.uncurry3 (forall (f :: * -> *) a b c d. Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d liftA3 (,,)) forall b c a. (b -> c) -> (a -> b) -> a -> c . forall a d b e c f. (a -> d, b -> e, c -> f) -> (a, b, c) -> (d, e, f) Tuple.mapTriple (a -> m d, b -> m e, c -> m f) fgh curry :: (Applicative f) => (f (a,b) -> g) -> f a -> f b -> g curry :: forall (f :: * -> *) a b g. Applicative f => (f (a, b) -> g) -> f a -> f b -> g curry f (a, b) -> g f f a a f b b = f (a, b) -> g f forall a b. (a -> b) -> a -> b $ forall (m :: * -> *) a b r. Applicative m => (a -> b -> r) -> m a -> m b -> m r lift2 (,) f a a f b b curry3 :: (Applicative f) => (f (a,b,c) -> g) -> f a -> f b -> f c -> g curry3 :: forall (f :: * -> *) a b c g. Applicative f => (f (a, b, c) -> g) -> f a -> f b -> f c -> g curry3 f (a, b, c) -> g f f a a f b b f c c = f (a, b, c) -> g f forall a b. (a -> b) -> a -> b $ forall (f :: * -> *) a b c d. Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d lift3 (,,) f a a f b b f c c {-# INLINE lift #-} lift :: Applicative m => (a -> r) -> m a -> m r lift :: forall (m :: * -> *) a r. Applicative m => (a -> r) -> m a -> m r lift = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap {-# INLINE lift2 #-} lift2 :: Applicative m => (a -> b -> r) -> m a -> m b -> m r lift2 :: forall (m :: * -> *) a b r. Applicative m => (a -> b -> r) -> m a -> m b -> m r lift2 = forall (f :: * -> *) a b c. Applicative f => (a -> b -> c) -> f a -> f b -> f c liftA2 {-# INLINE lift3 #-} lift3 :: Applicative m => (a -> b -> c -> r) -> m a -> m b -> m c -> m r lift3 :: forall (f :: * -> *) a b c d. Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d lift3 = forall (f :: * -> *) a b c d. Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d liftA3 {-# INLINE lift4 #-} lift4 :: Applicative m => (a -> b -> c -> d -> r) -> m a -> m b -> m c -> m d -> m r lift4 :: forall (m :: * -> *) a b c d r. Applicative m => (a -> b -> c -> d -> r) -> m a -> m b -> m c -> m d -> m r lift4 a -> b -> c -> d -> r fn m a a m b b m c c m d d = a -> b -> c -> d -> r fn forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> m a a forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> m b b forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> m c c forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> m d d {-# INLINE lift5 #-} lift5 :: Applicative m => (a -> b -> c -> d -> e -> r) -> m a -> m b -> m c -> m d -> m e -> m r lift5 :: forall (m :: * -> *) a b c d e r. Applicative m => (a -> b -> c -> d -> e -> r) -> m a -> m b -> m c -> m d -> m e -> m r lift5 a -> b -> c -> d -> e -> r fn m a a m b b m c c m d d m e e = a -> b -> c -> d -> e -> r fn forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> m a a forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> m b b forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> m c c forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> m d d forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> m e e {-# INLINE lift6 #-} lift6 :: Applicative m => (a -> b -> c -> d -> e -> f -> r) -> m a -> m b -> m c -> m d -> m e -> m f -> m r lift6 :: forall (m :: * -> *) a b c d e f r. Applicative m => (a -> b -> c -> d -> e -> f -> r) -> m a -> m b -> m c -> m d -> m e -> m f -> m r lift6 a -> b -> c -> d -> e -> f -> r fn m a a m b b m c c m d d m e e m f f = a -> b -> c -> d -> e -> f -> r fn forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> m a a forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> m b b forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> m c c forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> m d d forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> m e e forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> m f f {-# DEPRECATED liftA4 "use App.lift4" #-} {-# INLINE liftA4 #-} liftA4 :: Applicative f => (a -> b -> c -> d -> e) -> f a -> f b -> f c -> f d -> f e liftA4 :: forall (m :: * -> *) a b c d r. Applicative m => (a -> b -> c -> d -> r) -> m a -> m b -> m c -> m d -> m r liftA4 a -> b -> c -> d -> e f f a a f b b f c c f d d = a -> b -> c -> d -> e f forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> f a a forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> f b b forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> f c c forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> f d d {-# DEPRECATED liftA5 "use App.lift5" #-} {-# INLINE liftA5 #-} liftA5 :: Applicative f => (a -> b -> c -> d -> e -> g) -> f a -> f b -> f c -> f d -> f e -> f g liftA5 :: forall (m :: * -> *) a b c d e r. Applicative m => (a -> b -> c -> d -> e -> r) -> m a -> m b -> m c -> m d -> m e -> m r liftA5 a -> b -> c -> d -> e -> g f f a a f b b f c c f d d f e e = a -> b -> c -> d -> e -> g f forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> f a a forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> f b b forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> f c c forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> f d d forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> f e e {-# DEPRECATED liftA6 "use App.lift6" #-} {-# INLINE liftA6 #-} liftA6 :: Applicative f => (a -> b -> c -> d -> e -> g -> h) -> f a -> f b -> f c -> f d -> f e -> f g -> f h liftA6 :: forall (m :: * -> *) a b c d e f r. Applicative m => (a -> b -> c -> d -> e -> f -> r) -> m a -> m b -> m c -> m d -> m e -> m f -> m r liftA6 a -> b -> c -> d -> e -> g -> h f f a a f b b f c c f d d f e e f g g = a -> b -> c -> d -> e -> g -> h f forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> f a a forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> f b b forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> f c c forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> f d d forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> f e e forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> f g g