{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
module Network.Ethereum.ABI.Prim.Tuple (
Singleton(..)
) where
import Data.Proxy (Proxy (..))
import Generics.SOP (Generic)
import qualified GHC.Generics as GHC (Generic)
import Network.Ethereum.ABI.Class (ABIGet, ABIPut,
ABIType (..))
import Network.Ethereum.ABI.Generic ()
import Network.Ethereum.ABI.Prim.Tuple.TH (tupleDecs)
newtype Singleton a = Singleton { unSingleton :: a }
deriving GHC.Generic
deriving instance Eq a => Eq (Singleton a)
deriving instance Show a => Show (Singleton a)
instance Generic (Singleton a)
instance ABIType a => ABIType (Singleton a) where
isDynamic _ = isDynamic (Proxy :: Proxy a)
instance ABIGet a => ABIGet (Singleton a)
instance ABIPut a => ABIPut (Singleton a)
$(fmap concat $ sequence $ map tupleDecs [2..20])