module Frames.TypeLevel where
#if __GLASGOW_HASKELL__ < 800
import GHC.Prim (Constraint)
#else
import Data.Kind (Constraint)
#endif
type family RDelete r rs where
RDelete r (r ': rs) = rs
RDelete r (s ': rs) = s ': RDelete r rs
type family LAll c ts :: Constraint where
LAll c '[] = ()
LAll c (t ': ts) = (c t, LAll c ts)
type family AllAre a ts :: Constraint where
AllAre a '[] = ()
AllAre a (t ': ts) = (t ~ a, AllAre a ts)
type family HasInstances a cs :: Constraint where
HasInstances a '[] = ()
HasInstances a (c ': cs) = (c a, HasInstances a cs)
type family AllHave cs as :: Constraint where
AllHave cs '[] = ()
AllHave cs (a ': as) = (HasInstances a cs, AllHave cs as)