2 ExistentialQuantification
5 -- | WavPack metadata sub-blocks
6 module Codec.Audio.WavPack.Metadata
12 import Data.Binary.Put
14 import qualified Data.ByteString.Lazy as L
16 import Prelude.Unicode
18 class (Binary α, Eq α, Show α, Typeable α) ⇒ Metadata α where
22 metaSize = fromIntegral ∘ L.length ∘ runPut ∘ put
24 data SomeMetadata = ∀α. Metadata α ⇒ SomeMetadata α
26 instance Binary SomeMetadata where
28 = let size = metaSize a
29 oddBit = if odd size then 0x40 else 0
30 largeBit = if size > 255 then 0x80 else 0
31 idWord = metaID a .|. oddBit .|. largeBit
38 instance Eq SomeMetadata where
39 (SomeMetadata a) == (SomeMetadata b)
42 instance Show SomeMetadata where