module Sound.OSC.Class where
import Sound.OSC.Type
import Sound.OSC.Coding
class OSC o where
toPacket :: o -> Packet
fromPacket :: Packet -> Maybe o
instance OSC Message where
toPacket = Packet_Message
fromPacket = packet_to_message
instance OSC Bundle where
toPacket = Packet_Bundle
fromPacket = Just . packet_to_bundle
instance OSC Packet where
toPacket = id
fromPacket = Just
encodeOSC :: (Coding c,OSC o) => o -> c
encodeOSC = encodePacket . toPacket
decodeOSC :: (Coding c,OSC o) => c -> Maybe o
decodeOSC = fromPacket . decodePacket