Hoogle Search
Within LTS Haskell 24.33 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
boundedEnumCodec :: (Eq enum, Enum enum, Bounded enum) => (enum -> Text) -> JSONCodec enumautodocodec Autodocodec.Codec A codec for a Bounded Enum that uses the provided function to have the values correspond to literal Text values.
Example usage
>>> data Fruit = Apple | Orange deriving (Show, Eq, Enum, Bounded) >>> :{ let c = boundedEnumCodec $ \case Apple -> "foo" Orange -> "bar" :}>>> toJSONVia c Apple String "foo" >>> JSON.parseMaybe (parseJSONVia c) (String "bar") :: Maybe Fruit Just Orange
enumCodec :: Eq enum => NonEmpty (enum, Codec context enum enum) -> Codec context enum enumautodocodec Autodocodec.Codec A codec for an enum that can be written each with their own codec.
WARNING
If you don't provide a string for one of the type's constructors, the last codec in the list will be used instead.shownBoundedEnumCodec :: (Show enum, Eq enum, Enum enum, Bounded enum) => JSONCodec enumautodocodec Autodocodec.Codec A codec for a Bounded Enum that uses its Show instance to have the values correspond to literal Text values.
Example usage
>>> data Fruit = Apple | Orange deriving (Show, Eq, Enum, Bounded) >>> let c = shownBoundedEnumCodec >>> toJSONVia c Apple String "Apple" >>> JSON.parseMaybe (parseJSONVia c) (String "Orange") :: Maybe Fruit Just Orange
-
network-bsd Network.BSD Port number. Use the Num instance (i.e. use a literal) to create a PortNumber value.
>>> 1 :: PortNumber 1 >>> read "1" :: PortNumber 1 >>> show (12345 :: PortNumber) "12345" >>> 50000 < (51000 :: PortNumber) True >>> 50000 < (52000 :: PortNumber) True >>> 50000 + (10000 :: PortNumber) 60000
-
network-bsd Network.BSD Protocol number.
getProtocolByNumber :: ProtocolNumber -> IO ProtocolEntrynetwork-bsd Network.BSD getprotobynumber(3).
getProtocolNumber :: ProtocolName -> IO ProtocolNumbernetwork-bsd Network.BSD getprotobyname(3).
getServicePortNumber :: ServiceName -> IO PortNumbernetwork-bsd Network.BSD Get the PortNumber corresponding to the ServiceName.
protoNumber :: ProtocolEntry -> ProtocolNumbernetwork-bsd Network.BSD Protocol number
DecimalNumber :: GeneralCategoryrio RIO.Char Nd: Number, Decimal