module Data.MediaBus.Media.Channels
( KnownChannelLayout(..)
, ChannelLayoutProxy(..)
, HasChannelLayout(..)
, EachChannel(..)
, type EachChannelL
, type EachChannelL'
, type EachChannel'
, eachChannel'
) where
import Control.Lens
import Data.Typeable
class Typeable c =>
KnownChannelLayout c where
numberOfChannels :: proxy c -> Int
data ChannelLayoutProxy c where
MkChannelLayoutProxy :: ChannelLayoutProxy c
ConvertChannelLayoutProxy :: proxy c -> ChannelLayoutProxy c
instance KnownChannelLayout c =>
Show (ChannelLayoutProxy c) where
showsPrec d px = showParen (d > 10)
(showsPrec 11 (typeRep px) .
showString " " .
showsPrec 11 (numberOfChannels px))
class (SetChannelLayout s (ChannelLayout s) ~ s) =>
HasChannelLayout s where
type ChannelLayout s
type SetChannelLayout s b
class EachChannel s t where
type ChannelsFrom s
type ChannelsTo t
eachChannel :: Traversal s t (ChannelsFrom s) (ChannelsTo t)
type EachChannelL s t a b = (EachChannel s t, ChannelsFrom s ~ a, ChannelsTo t ~ b)
type EachChannelL' s a = (EachChannel s s, ChannelsFrom s ~ a, ChannelsTo s ~ a)
type EachChannel' s = (ChannelsFrom s ~ ChannelsTo s, EachChannel s s)
eachChannel' :: EachChannel' i => Traversal' i (ChannelsFrom i)
eachChannel' = eachChannel