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.

  1. boundedEnumCodec :: (Eq enum, Enum enum, Bounded enum) => (enum -> Text) -> JSONCodec enum

    autodocodec 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
    

  2. enumCodec :: Eq enum => NonEmpty (enum, Codec context enum enum) -> Codec context enum enum

    autodocodec 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.

  3. shownBoundedEnumCodec :: (Show enum, Eq enum, Enum enum, Bounded enum) => JSONCodec enum

    autodocodec 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
    

  4. data PortNumber

    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
    

  5. type ProtocolNumber = CInt

    network-bsd Network.BSD

    Protocol number.

  6. getProtocolByNumber :: ProtocolNumber -> IO ProtocolEntry

    network-bsd Network.BSD

    getprotobynumber(3).

  7. getProtocolNumber :: ProtocolName -> IO ProtocolNumber

    network-bsd Network.BSD

    getprotobyname(3).

  8. getServicePortNumber :: ServiceName -> IO PortNumber

    network-bsd Network.BSD

    Get the PortNumber corresponding to the ServiceName.

  9. protoNumber :: ProtocolEntry -> ProtocolNumber

    network-bsd Network.BSD

    Protocol number

  10. DecimalNumber :: GeneralCategory

    rio RIO.Char

    Nd: Number, Decimal

Page 187 of many | Previous | Next