{-# LANGUAGE UndecidableInstances #-}

module ZkFold.Base.Protocol.Plonkup.Prover.Secret where

import           GHC.Generics                            (Generic)
import           Prelude                                 hiding (Num (..), drop, length, sum, take, (!!), (/), (^))
import           Test.QuickCheck                         (Arbitrary (..))

import           ZkFold.Base.Algebra.EllipticCurve.Class (EllipticCurve (..))
import           ZkFold.Base.Data.Vector                 (Vector)

newtype PlonkupProverSecret c = PlonkupProverSecret (Vector 19 (ScalarField c))
    deriving (forall x. PlonkupProverSecret c -> Rep (PlonkupProverSecret c) x)
-> (forall x.
    Rep (PlonkupProverSecret c) x -> PlonkupProverSecret c)
-> Generic (PlonkupProverSecret c)
forall x. Rep (PlonkupProverSecret c) x -> PlonkupProverSecret c
forall x. PlonkupProverSecret c -> Rep (PlonkupProverSecret c) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (c :: k) x.
Rep (PlonkupProverSecret c) x -> PlonkupProverSecret c
forall k (c :: k) x.
PlonkupProverSecret c -> Rep (PlonkupProverSecret c) x
$cfrom :: forall k (c :: k) x.
PlonkupProverSecret c -> Rep (PlonkupProverSecret c) x
from :: forall x. PlonkupProverSecret c -> Rep (PlonkupProverSecret c) x
$cto :: forall k (c :: k) x.
Rep (PlonkupProverSecret c) x -> PlonkupProverSecret c
to :: forall x. Rep (PlonkupProverSecret c) x -> PlonkupProverSecret c
Generic

instance Show (ScalarField c) => Show (PlonkupProverSecret c) where
    show :: PlonkupProverSecret c -> String
show (PlonkupProverSecret Vector 19 (ScalarField c)
v) =
        String
"PlonkupProverSecret: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Vector 19 (ScalarField c) -> String
forall a. Show a => a -> String
show Vector 19 (ScalarField c)
v

instance Arbitrary (ScalarField c) => Arbitrary (PlonkupProverSecret c) where
    arbitrary :: Gen (PlonkupProverSecret c)
arbitrary = Vector 19 (ScalarField c) -> PlonkupProverSecret c
forall {k} (c :: k).
Vector 19 (ScalarField c) -> PlonkupProverSecret c
PlonkupProverSecret (Vector 19 (ScalarField c) -> PlonkupProverSecret c)
-> Gen (Vector 19 (ScalarField c)) -> Gen (PlonkupProverSecret c)
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen (Vector 19 (ScalarField c))
forall a. Arbitrary a => Gen a
arbitrary