{-# LANGUAGE TypeOperators #-}

module ZkFold.Base.Data.Product where

import           Data.Function (const, id)
import           GHC.Generics  ((:*:) (..))

uncurryP :: (f a -> g a -> b) -> (f :*: g) a -> b
uncurryP :: forall {k} (f :: k -> Type) (a :: k) (g :: k -> Type) b.
(f a -> g a -> b) -> (:*:) f g a -> b
uncurryP f a -> g a -> b
f (f a
x :*: g a
y) = f a -> g a -> b
f f a
x g a
y

fstP :: (f :*: g) a -> f a
fstP :: forall {k} (f :: k -> Type) (g :: k -> Type) (a :: k).
(:*:) f g a -> f a
fstP = (f a -> g a -> f a) -> (:*:) f g a -> f a
forall {k} (f :: k -> Type) (a :: k) (g :: k -> Type) b.
(f a -> g a -> b) -> (:*:) f g a -> b
uncurryP f a -> g a -> f a
forall a b. a -> b -> a
const

sndP :: (f :*: g) a -> g a
sndP :: forall {k} (f :: k -> Type) (g :: k -> Type) (a :: k).
(:*:) f g a -> g a
sndP = (f a -> g a -> g a) -> (:*:) f g a -> g a
forall {k} (f :: k -> Type) (a :: k) (g :: k -> Type) b.
(f a -> g a -> b) -> (:*:) f g a -> b
uncurryP ((g a -> g a) -> f a -> g a -> g a
forall a b. a -> b -> a
const g a -> g a
forall a. a -> a
id)