{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StaticPointers #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}

module Control.Distributed.Dataset.Internal.Class where

import Codec.Serialise
import Control.Distributed.Closure
import Control.Distributed.Dataset.ShuffleStore
import Control.Distributed.Fork (Backend)
import Control.Lens
import Control.Monad.Catch
import Control.Monad.IO.Unlift
import Control.Monad.Logger
import Control.Monad.Reader
import Data.HashSet (HashSet)
import Data.Hashable
import Data.Monoid
import Data.Ord
import Data.Semigroup
import Data.Text
import Data.Typeable

data DDEnv
  = DDEnv
      { DDEnv -> Backend
_ddBackend :: Backend,
        DDEnv -> ShuffleStore
_ddShuffleStore :: ShuffleStore,
        DDEnv -> LogLevel
_ddLogLevel :: LogLevel
      }

makeLenses ''DDEnv

newtype DD a = DDT (ReaderT DDEnv (LoggingT IO) a)
  deriving
    ( a -> DD b -> DD a
(a -> b) -> DD a -> DD b
(forall a b. (a -> b) -> DD a -> DD b)
-> (forall a b. a -> DD b -> DD a) -> Functor DD
forall a b. a -> DD b -> DD a
forall a b. (a -> b) -> DD a -> DD b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> DD b -> DD a
$c<$ :: forall a b. a -> DD b -> DD a
fmap :: (a -> b) -> DD a -> DD b
$cfmap :: forall a b. (a -> b) -> DD a -> DD b
Functor,
      Functor DD
a -> DD a
Functor DD
-> (forall a. a -> DD a)
-> (forall a b. DD (a -> b) -> DD a -> DD b)
-> (forall a b c. (a -> b -> c) -> DD a -> DD b -> DD c)
-> (forall a b. DD a -> DD b -> DD b)
-> (forall a b. DD a -> DD b -> DD a)
-> Applicative DD
DD a -> DD b -> DD b
DD a -> DD b -> DD a
DD (a -> b) -> DD a -> DD b
(a -> b -> c) -> DD a -> DD b -> DD c
forall a. a -> DD a
forall a b. DD a -> DD b -> DD a
forall a b. DD a -> DD b -> DD b
forall a b. DD (a -> b) -> DD a -> DD b
forall a b c. (a -> b -> c) -> DD a -> DD b -> DD c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: DD a -> DD b -> DD a
$c<* :: forall a b. DD a -> DD b -> DD a
*> :: DD a -> DD b -> DD b
$c*> :: forall a b. DD a -> DD b -> DD b
liftA2 :: (a -> b -> c) -> DD a -> DD b -> DD c
$cliftA2 :: forall a b c. (a -> b -> c) -> DD a -> DD b -> DD c
<*> :: DD (a -> b) -> DD a -> DD b
$c<*> :: forall a b. DD (a -> b) -> DD a -> DD b
pure :: a -> DD a
$cpure :: forall a. a -> DD a
$cp1Applicative :: Functor DD
Applicative,
      Applicative DD
a -> DD a
Applicative DD
-> (forall a b. DD a -> (a -> DD b) -> DD b)
-> (forall a b. DD a -> DD b -> DD b)
-> (forall a. a -> DD a)
-> Monad DD
DD a -> (a -> DD b) -> DD b
DD a -> DD b -> DD b
forall a. a -> DD a
forall a b. DD a -> DD b -> DD b
forall a b. DD a -> (a -> DD b) -> DD b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> DD a
$creturn :: forall a. a -> DD a
>> :: DD a -> DD b -> DD b
$c>> :: forall a b. DD a -> DD b -> DD b
>>= :: DD a -> (a -> DD b) -> DD b
$c>>= :: forall a b. DD a -> (a -> DD b) -> DD b
$cp1Monad :: Applicative DD
Monad,
      MonadReader DDEnv,
      Monad DD
Monad DD -> (forall a. IO a -> DD a) -> MonadIO DD
IO a -> DD a
forall a. IO a -> DD a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
liftIO :: IO a -> DD a
$cliftIO :: forall a. IO a -> DD a
$cp1MonadIO :: Monad DD
MonadIO,
      Monad DD
e -> DD a
Monad DD -> (forall e a. Exception e => e -> DD a) -> MonadThrow DD
forall e a. Exception e => e -> DD a
forall (m :: * -> *).
Monad m -> (forall e a. Exception e => e -> m a) -> MonadThrow m
throwM :: e -> DD a
$cthrowM :: forall e a. Exception e => e -> DD a
$cp1MonadThrow :: Monad DD
MonadThrow,
      MonadThrow DD
MonadThrow DD
-> (forall e a. Exception e => DD a -> (e -> DD a) -> DD a)
-> MonadCatch DD
DD a -> (e -> DD a) -> DD a
forall e a. Exception e => DD a -> (e -> DD a) -> DD a
forall (m :: * -> *).
MonadThrow m
-> (forall e a. Exception e => m a -> (e -> m a) -> m a)
-> MonadCatch m
catch :: DD a -> (e -> DD a) -> DD a
$ccatch :: forall e a. Exception e => DD a -> (e -> DD a) -> DD a
$cp1MonadCatch :: MonadThrow DD
MonadCatch,
      Monad DD
Monad DD
-> (forall msg.
    ToLogStr msg =>
    Loc -> LogSource -> LogLevel -> msg -> DD ())
-> MonadLogger DD
Loc -> LogSource -> LogLevel -> msg -> DD ()
forall msg.
ToLogStr msg =>
Loc -> LogSource -> LogLevel -> msg -> DD ()
forall (m :: * -> *).
Monad m
-> (forall msg.
    ToLogStr msg =>
    Loc -> LogSource -> LogLevel -> msg -> m ())
-> MonadLogger m
monadLoggerLog :: Loc -> LogSource -> LogLevel -> msg -> DD ()
$cmonadLoggerLog :: forall msg.
ToLogStr msg =>
Loc -> LogSource -> LogLevel -> msg -> DD ()
$cp1MonadLogger :: Monad DD
MonadLogger,
      MonadIO DD
DD (UnliftIO DD)
MonadIO DD
-> DD (UnliftIO DD)
-> (forall b. ((forall a. DD a -> IO a) -> IO b) -> DD b)
-> MonadUnliftIO DD
((forall a. DD a -> IO a) -> IO b) -> DD b
forall b. ((forall a. DD a -> IO a) -> IO b) -> DD b
forall (m :: * -> *).
MonadIO m
-> m (UnliftIO m)
-> (forall b. ((forall a. m a -> IO a) -> IO b) -> m b)
-> MonadUnliftIO m
withRunInIO :: ((forall a. DD a -> IO a) -> IO b) -> DD b
$cwithRunInIO :: forall b. ((forall a. DD a -> IO a) -> IO b) -> DD b
askUnliftIO :: DD (UnliftIO DD)
$caskUnliftIO :: DD (UnliftIO DD)
$cp1MonadUnliftIO :: MonadIO DD
MonadUnliftIO
    )

runDD :: Backend -> ShuffleStore -> DD a -> IO a
runDD :: Backend -> ShuffleStore -> DD a -> IO a
runDD = LogLevel -> Backend -> ShuffleStore -> DD a -> IO a
forall a. LogLevel -> Backend -> ShuffleStore -> DD a -> IO a
runDDWith LogLevel
LevelInfo

runDDWith :: LogLevel -> Backend -> ShuffleStore -> DD a -> IO a
runDDWith :: LogLevel -> Backend -> ShuffleStore -> DD a -> IO a
runDDWith LogLevel
level Backend
backend ShuffleStore
shuffleStore (DDT ReaderT DDEnv (LoggingT IO) a
act) = do
  let env :: DDEnv
env = Backend -> ShuffleStore -> LogLevel -> DDEnv
DDEnv Backend
backend ShuffleStore
shuffleStore LogLevel
level
      logFilter :: LoggingT m a -> LoggingT m a
logFilter = (LogSource -> LogLevel -> Bool) -> LoggingT m a -> LoggingT m a
forall (m :: * -> *) a.
(LogSource -> LogLevel -> Bool) -> LoggingT m a -> LoggingT m a
filterLogger ((LogSource -> LogLevel -> Bool) -> LoggingT m a -> LoggingT m a)
-> (LogSource -> LogLevel -> Bool) -> LoggingT m a -> LoggingT m a
forall a b. (a -> b) -> a -> b
$ \LogSource
_ LogLevel
l -> LogLevel
l LogLevel -> LogLevel -> Bool
forall a. Ord a => a -> a -> Bool
>= LogLevel
level
  LoggingT IO a -> IO a
forall (m :: * -> *) a. MonadIO m => LoggingT m a -> m a
runStderrLoggingT (LoggingT IO a -> IO a) -> LoggingT IO a -> IO a
forall a b. (a -> b) -> a -> b
$ LoggingT IO a -> LoggingT IO a
forall (m :: * -> *) a. LoggingT m a -> LoggingT m a
logFilter (LoggingT IO a -> LoggingT IO a) -> LoggingT IO a -> LoggingT IO a
forall a b. (a -> b) -> a -> b
$ ReaderT DDEnv (LoggingT IO) a -> DDEnv -> LoggingT IO a
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT ReaderT DDEnv (LoggingT IO) a
act DDEnv
env

class (Typeable a, Serialise a) => StaticSerialise a where
  staticSerialise :: Closure (Dict (Typeable a, Serialise a))

instance StaticSerialise () where
  staticSerialise :: Closure (Dict (Typeable (), Serialise ()))
staticSerialise = static Dict (Typeable (), Serialise ())
forall (a :: Constraint). a => Dict a
Dict

instance StaticSerialise Bool where
  staticSerialise :: Closure (Dict (Typeable Bool, Serialise Bool))
staticSerialise = static Dict (Typeable Bool, Serialise Bool)
forall (a :: Constraint). a => Dict a
Dict

instance StaticSerialise Char where
  staticSerialise :: Closure (Dict (Typeable Char, Serialise Char))
staticSerialise = static Dict (Typeable Char, Serialise Char)
forall (a :: Constraint). a => Dict a
Dict

instance StaticSerialise Double where
  staticSerialise :: Closure (Dict (Typeable Double, Serialise Double))
staticSerialise = static Dict (Typeable Double, Serialise Double)
forall (a :: Constraint). a => Dict a
Dict

instance StaticSerialise Float where
  staticSerialise :: Closure (Dict (Typeable Float, Serialise Float))
staticSerialise = static Dict (Typeable Float, Serialise Float)
forall (a :: Constraint). a => Dict a
Dict

instance StaticSerialise Int where
  staticSerialise :: Closure (Dict (Typeable Int, Serialise Int))
staticSerialise = static Dict (Typeable Int, Serialise Int)
forall (a :: Constraint). a => Dict a
Dict

instance StaticSerialise Integer where
  staticSerialise :: Closure (Dict (Typeable Integer, Serialise Integer))
staticSerialise = static Dict (Typeable Integer, Serialise Integer)
forall (a :: Constraint). a => Dict a
Dict

instance StaticSerialise Text where
  staticSerialise :: Closure (Dict (Typeable LogSource, Serialise LogSource))
staticSerialise = static Dict (Typeable LogSource, Serialise LogSource)
forall (a :: Constraint). a => Dict a
Dict

instance StaticSerialise a => StaticSerialise [a] where
  staticSerialise :: Closure (Dict (Typeable [a], Serialise [a]))
staticSerialise = static (\Dict (Typeable a, Serialise a)
Dict -> Dict (Typeable [a], Serialise [a])
forall (a :: Constraint). a => Dict a
Dict) Closure
  (Dict (Typeable a, Serialise a)
   -> Dict (Typeable [a], Serialise [a]))
-> Closure (Dict (Typeable a, Serialise a))
-> Closure (Dict (Typeable [a], Serialise [a]))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticSerialise a => Closure (Dict (Typeable a, Serialise a))
forall a.
StaticSerialise a =>
Closure (Dict (Typeable a, Serialise a))
staticSerialise @a

instance (StaticHashable a, StaticSerialise a) => StaticSerialise (HashSet a) where
  staticSerialise :: Closure (Dict (Typeable (HashSet a), Serialise (HashSet a)))
staticSerialise = static (\Dict (Typeable a, Serialise a)
Dict Dict (Typeable a, Eq a, Hashable a)
Dict -> Dict (Typeable (HashSet a), Serialise (HashSet a))
forall (a :: Constraint). a => Dict a
Dict) Closure
  (Dict (Typeable a, Serialise a)
   -> Dict (Typeable a, Eq a, Hashable a)
   -> Dict (Typeable (HashSet a), Serialise (HashSet a)))
-> Closure (Dict (Typeable a, Serialise a))
-> Closure
     (Dict (Typeable a, Eq a, Hashable a)
      -> Dict (Typeable (HashSet a), Serialise (HashSet a)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticSerialise a => Closure (Dict (Typeable a, Serialise a))
forall a.
StaticSerialise a =>
Closure (Dict (Typeable a, Serialise a))
staticSerialise @a Closure
  (Dict (Typeable a, Eq a, Hashable a)
   -> Dict (Typeable (HashSet a), Serialise (HashSet a)))
-> Closure (Dict (Typeable a, Eq a, Hashable a))
-> Closure (Dict (Typeable (HashSet a), Serialise (HashSet a)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticHashable a => Closure (Dict (Typeable a, Eq a, Hashable a))
forall a.
StaticHashable a =>
Closure (Dict (Typeable a, Eq a, Hashable a))
staticHashable @a

instance StaticSerialise a => StaticSerialise (Maybe a) where
  staticSerialise :: Closure (Dict (Typeable (Maybe a), Serialise (Maybe a)))
staticSerialise = static (\Dict (Typeable a, Serialise a)
Dict -> Dict (Typeable (Maybe a), Serialise (Maybe a))
forall (a :: Constraint). a => Dict a
Dict) Closure
  (Dict (Typeable a, Serialise a)
   -> Dict (Typeable (Maybe a), Serialise (Maybe a)))
-> Closure (Dict (Typeable a, Serialise a))
-> Closure (Dict (Typeable (Maybe a), Serialise (Maybe a)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticSerialise a => Closure (Dict (Typeable a, Serialise a))
forall a.
StaticSerialise a =>
Closure (Dict (Typeable a, Serialise a))
staticSerialise @a

instance StaticSerialise a => StaticSerialise (Sum a) where
  staticSerialise :: Closure (Dict (Typeable (Sum a), Serialise (Sum a)))
staticSerialise = static (\Dict (Typeable a, Serialise a)
Dict -> Dict (Typeable (Sum a), Serialise (Sum a))
forall (a :: Constraint). a => Dict a
Dict) Closure
  (Dict (Typeable a, Serialise a)
   -> Dict (Typeable (Sum a), Serialise (Sum a)))
-> Closure (Dict (Typeable a, Serialise a))
-> Closure (Dict (Typeable (Sum a), Serialise (Sum a)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticSerialise a => Closure (Dict (Typeable a, Serialise a))
forall a.
StaticSerialise a =>
Closure (Dict (Typeable a, Serialise a))
staticSerialise @a

instance StaticSerialise a => StaticSerialise (Down a) where
  staticSerialise :: Closure (Dict (Typeable (Down a), Serialise (Down a)))
staticSerialise = static (\Dict (Typeable a, Serialise a)
Dict -> Dict (Typeable (Down a), Serialise (Down a))
forall (a :: Constraint). a => Dict a
Dict) Closure
  (Dict (Typeable a, Serialise a)
   -> Dict (Typeable (Down a), Serialise (Down a)))
-> Closure (Dict (Typeable a, Serialise a))
-> Closure (Dict (Typeable (Down a), Serialise (Down a)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticSerialise a => Closure (Dict (Typeable a, Serialise a))
forall a.
StaticSerialise a =>
Closure (Dict (Typeable a, Serialise a))
staticSerialise @a

instance StaticSerialise a => StaticSerialise (Max a) where
  staticSerialise :: Closure (Dict (Typeable (Max a), Serialise (Max a)))
staticSerialise = static (\Dict (Typeable a, Serialise a)
Dict -> Dict (Typeable (Max a), Serialise (Max a))
forall (a :: Constraint). a => Dict a
Dict) Closure
  (Dict (Typeable a, Serialise a)
   -> Dict (Typeable (Max a), Serialise (Max a)))
-> Closure (Dict (Typeable a, Serialise a))
-> Closure (Dict (Typeable (Max a), Serialise (Max a)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticSerialise a => Closure (Dict (Typeable a, Serialise a))
forall a.
StaticSerialise a =>
Closure (Dict (Typeable a, Serialise a))
staticSerialise @a

instance StaticSerialise a => StaticSerialise (Min a) where
  staticSerialise :: Closure (Dict (Typeable (Min a), Serialise (Min a)))
staticSerialise = static (\Dict (Typeable a, Serialise a)
Dict -> Dict (Typeable (Min a), Serialise (Min a))
forall (a :: Constraint). a => Dict a
Dict) Closure
  (Dict (Typeable a, Serialise a)
   -> Dict (Typeable (Min a), Serialise (Min a)))
-> Closure (Dict (Typeable a, Serialise a))
-> Closure (Dict (Typeable (Min a), Serialise (Min a)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticSerialise a => Closure (Dict (Typeable a, Serialise a))
forall a.
StaticSerialise a =>
Closure (Dict (Typeable a, Serialise a))
staticSerialise @a

instance (StaticSerialise a, StaticSerialise b) => StaticSerialise (a, b) where
  staticSerialise :: Closure (Dict (Typeable (a, b), Serialise (a, b)))
staticSerialise = static (\Dict (Typeable a, Serialise a)
Dict Dict (Typeable b, Serialise b)
Dict -> Dict (Typeable (a, b), Serialise (a, b))
forall (a :: Constraint). a => Dict a
Dict) Closure
  (Dict (Typeable a, Serialise a)
   -> Dict (Typeable b, Serialise b)
   -> Dict (Typeable (a, b), Serialise (a, b)))
-> Closure (Dict (Typeable a, Serialise a))
-> Closure
     (Dict (Typeable b, Serialise b)
      -> Dict (Typeable (a, b), Serialise (a, b)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticSerialise a => Closure (Dict (Typeable a, Serialise a))
forall a.
StaticSerialise a =>
Closure (Dict (Typeable a, Serialise a))
staticSerialise @a Closure
  (Dict (Typeable b, Serialise b)
   -> Dict (Typeable (a, b), Serialise (a, b)))
-> Closure (Dict (Typeable b, Serialise b))
-> Closure (Dict (Typeable (a, b), Serialise (a, b)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticSerialise b => Closure (Dict (Typeable b, Serialise b))
forall a.
StaticSerialise a =>
Closure (Dict (Typeable a, Serialise a))
staticSerialise @b

instance (StaticSerialise a, StaticSerialise b, StaticSerialise c) => StaticSerialise (a, b, c) where
  staticSerialise :: Closure (Dict (Typeable (a, b, c), Serialise (a, b, c)))
staticSerialise = static (\Dict (Typeable a, Serialise a)
Dict Dict (Typeable b, Serialise b)
Dict Dict (Typeable c, Serialise c)
Dict -> Dict (Typeable (a, b, c), Serialise (a, b, c))
forall (a :: Constraint). a => Dict a
Dict) Closure
  (Dict (Typeable a, Serialise a)
   -> Dict (Typeable b, Serialise b)
   -> Dict (Typeable c, Serialise c)
   -> Dict (Typeable (a, b, c), Serialise (a, b, c)))
-> Closure (Dict (Typeable a, Serialise a))
-> Closure
     (Dict (Typeable b, Serialise b)
      -> Dict (Typeable c, Serialise c)
      -> Dict (Typeable (a, b, c), Serialise (a, b, c)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticSerialise a => Closure (Dict (Typeable a, Serialise a))
forall a.
StaticSerialise a =>
Closure (Dict (Typeable a, Serialise a))
staticSerialise @a Closure
  (Dict (Typeable b, Serialise b)
   -> Dict (Typeable c, Serialise c)
   -> Dict (Typeable (a, b, c), Serialise (a, b, c)))
-> Closure (Dict (Typeable b, Serialise b))
-> Closure
     (Dict (Typeable c, Serialise c)
      -> Dict (Typeable (a, b, c), Serialise (a, b, c)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticSerialise b => Closure (Dict (Typeable b, Serialise b))
forall a.
StaticSerialise a =>
Closure (Dict (Typeable a, Serialise a))
staticSerialise @b Closure
  (Dict (Typeable c, Serialise c)
   -> Dict (Typeable (a, b, c), Serialise (a, b, c)))
-> Closure (Dict (Typeable c, Serialise c))
-> Closure (Dict (Typeable (a, b, c), Serialise (a, b, c)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticSerialise c => Closure (Dict (Typeable c, Serialise c))
forall a.
StaticSerialise a =>
Closure (Dict (Typeable a, Serialise a))
staticSerialise @c

class (Typeable a, Eq a, Hashable a) => StaticHashable a where
  staticHashable :: Closure (Dict (Typeable a, Eq a, Hashable a))

instance StaticHashable () where
  staticHashable :: Closure (Dict (Typeable (), Eq (), Hashable ()))
staticHashable = static Dict (Typeable (), Eq (), Hashable ())
forall (a :: Constraint). a => Dict a
Dict

instance StaticHashable Bool where
  staticHashable :: Closure (Dict (Typeable Bool, Eq Bool, Hashable Bool))
staticHashable = static Dict (Typeable Bool, Eq Bool, Hashable Bool)
forall (a :: Constraint). a => Dict a
Dict

instance StaticHashable Char where
  staticHashable :: Closure (Dict (Typeable Char, Eq Char, Hashable Char))
staticHashable = static Dict (Typeable Char, Eq Char, Hashable Char)
forall (a :: Constraint). a => Dict a
Dict

instance StaticHashable Double where
  staticHashable :: Closure (Dict (Typeable Double, Eq Double, Hashable Double))
staticHashable = static Dict (Typeable Double, Eq Double, Hashable Double)
forall (a :: Constraint). a => Dict a
Dict

instance StaticHashable Float where
  staticHashable :: Closure (Dict (Typeable Float, Eq Float, Hashable Float))
staticHashable = static Dict (Typeable Float, Eq Float, Hashable Float)
forall (a :: Constraint). a => Dict a
Dict

instance StaticHashable Int where
  staticHashable :: Closure (Dict (Typeable Int, Eq Int, Hashable Int))
staticHashable = static Dict (Typeable Int, Eq Int, Hashable Int)
forall (a :: Constraint). a => Dict a
Dict

instance StaticHashable Integer where
  staticHashable :: Closure (Dict (Typeable Integer, Eq Integer, Hashable Integer))
staticHashable = static Dict (Typeable Integer, Eq Integer, Hashable Integer)
forall (a :: Constraint). a => Dict a
Dict

instance StaticHashable Text where
  staticHashable :: Closure
  (Dict (Typeable LogSource, Eq LogSource, Hashable LogSource))
staticHashable = static Dict (Typeable LogSource, Eq LogSource, Hashable LogSource)
forall (a :: Constraint). a => Dict a
Dict

instance StaticHashable a => StaticHashable [a] where
  staticHashable :: Closure (Dict (Typeable [a], Eq [a], Hashable [a]))
staticHashable = static (\Dict (Typeable a, Eq a, Hashable a)
Dict -> Dict (Typeable [a], Eq [a], Hashable [a])
forall (a :: Constraint). a => Dict a
Dict) Closure
  (Dict (Typeable a, Eq a, Hashable a)
   -> Dict (Typeable [a], Eq [a], Hashable [a]))
-> Closure (Dict (Typeable a, Eq a, Hashable a))
-> Closure (Dict (Typeable [a], Eq [a], Hashable [a]))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticHashable a => Closure (Dict (Typeable a, Eq a, Hashable a))
forall a.
StaticHashable a =>
Closure (Dict (Typeable a, Eq a, Hashable a))
staticHashable @a

instance (StaticHashable a, StaticHashable b) => StaticHashable (a, b) where
  staticHashable :: Closure (Dict (Typeable (a, b), Eq (a, b), Hashable (a, b)))
staticHashable = static (\Dict (Typeable a, Eq a, Hashable a)
Dict Dict (Typeable b, Eq b, Hashable b)
Dict -> Dict (Typeable (a, b), Eq (a, b), Hashable (a, b))
forall (a :: Constraint). a => Dict a
Dict) Closure
  (Dict (Typeable a, Eq a, Hashable a)
   -> Dict (Typeable b, Eq b, Hashable b)
   -> Dict (Typeable (a, b), Eq (a, b), Hashable (a, b)))
-> Closure (Dict (Typeable a, Eq a, Hashable a))
-> Closure
     (Dict (Typeable b, Eq b, Hashable b)
      -> Dict (Typeable (a, b), Eq (a, b), Hashable (a, b)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticHashable a => Closure (Dict (Typeable a, Eq a, Hashable a))
forall a.
StaticHashable a =>
Closure (Dict (Typeable a, Eq a, Hashable a))
staticHashable @a Closure
  (Dict (Typeable b, Eq b, Hashable b)
   -> Dict (Typeable (a, b), Eq (a, b), Hashable (a, b)))
-> Closure (Dict (Typeable b, Eq b, Hashable b))
-> Closure (Dict (Typeable (a, b), Eq (a, b), Hashable (a, b)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticHashable b => Closure (Dict (Typeable b, Eq b, Hashable b))
forall a.
StaticHashable a =>
Closure (Dict (Typeable a, Eq a, Hashable a))
staticHashable @b

instance (StaticHashable a, StaticHashable b, StaticHashable c) => StaticHashable (a, b, c) where
  staticHashable :: Closure
  (Dict (Typeable (a, b, c), Eq (a, b, c), Hashable (a, b, c)))
staticHashable = static (\Dict (Typeable a, Eq a, Hashable a)
Dict Dict (Typeable b, Eq b, Hashable b)
Dict Dict (Typeable c, Eq c, Hashable c)
Dict -> Dict (Typeable (a, b, c), Eq (a, b, c), Hashable (a, b, c))
forall (a :: Constraint). a => Dict a
Dict) Closure
  (Dict (Typeable a, Eq a, Hashable a)
   -> Dict (Typeable b, Eq b, Hashable b)
   -> Dict (Typeable c, Eq c, Hashable c)
   -> Dict (Typeable (a, b, c), Eq (a, b, c), Hashable (a, b, c)))
-> Closure (Dict (Typeable a, Eq a, Hashable a))
-> Closure
     (Dict (Typeable b, Eq b, Hashable b)
      -> Dict (Typeable c, Eq c, Hashable c)
      -> Dict (Typeable (a, b, c), Eq (a, b, c), Hashable (a, b, c)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticHashable a => Closure (Dict (Typeable a, Eq a, Hashable a))
forall a.
StaticHashable a =>
Closure (Dict (Typeable a, Eq a, Hashable a))
staticHashable @a Closure
  (Dict (Typeable b, Eq b, Hashable b)
   -> Dict (Typeable c, Eq c, Hashable c)
   -> Dict (Typeable (a, b, c), Eq (a, b, c), Hashable (a, b, c)))
-> Closure (Dict (Typeable b, Eq b, Hashable b))
-> Closure
     (Dict (Typeable c, Eq c, Hashable c)
      -> Dict (Typeable (a, b, c), Eq (a, b, c), Hashable (a, b, c)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticHashable b => Closure (Dict (Typeable b, Eq b, Hashable b))
forall a.
StaticHashable a =>
Closure (Dict (Typeable a, Eq a, Hashable a))
staticHashable @b Closure
  (Dict (Typeable c, Eq c, Hashable c)
   -> Dict (Typeable (a, b, c), Eq (a, b, c), Hashable (a, b, c)))
-> Closure (Dict (Typeable c, Eq c, Hashable c))
-> Closure
     (Dict (Typeable (a, b, c), Eq (a, b, c), Hashable (a, b, c)))
forall a b.
Typeable a =>
Closure (a -> b) -> Closure a -> Closure b
`cap` StaticHashable c => Closure (Dict (Typeable c, Eq c, Hashable c))
forall a.
StaticHashable a =>
Closure (Dict (Typeable a, Eq a, Hashable a))
staticHashable @c