{-# OPTIONS_GHC -Wno-orphans #-}
module Hydra.CBOR.Orphans () where
import Hydra.Prelude
import Codec.CBOR.JSON (decodeValue, encodeValue)
import Data.Aeson qualified as Aeson
import Network.Socket (PortNumber)
instance ToCBOR Aeson.Value where
toCBOR :: Value -> Encoding
toCBOR = Value -> Encoding
encodeValue
instance FromCBOR Aeson.Value where
fromCBOR :: forall s. Decoder s Value
fromCBOR = Bool -> Decoder s Value
forall s. Bool -> Decoder s Value
decodeValue Bool
False
instance ToCBOR PortNumber where
toCBOR :: PortNumber -> Encoding
toCBOR = Word16 -> Encoding
forall a. ToCBOR a => a -> Encoding
toCBOR (Word16 -> Encoding)
-> (PortNumber -> Word16) -> PortNumber -> Encoding
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (PortNumber -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral :: PortNumber -> Word16)
instance FromCBOR PortNumber where
fromCBOR :: forall s. Decoder s PortNumber
fromCBOR = (Word16 -> PortNumber
forall a b. (Integral a, Num b) => a -> b
fromIntegral :: Word16 -> PortNumber) (Word16 -> PortNumber) -> Decoder s Word16 -> Decoder s PortNumber
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s Word16
forall s. Decoder s Word16
forall a s. FromCBOR a => Decoder s a
fromCBOR