Hoogle Search

Within LTS Haskell 24.46 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

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

    autodocodec Autodocodec

    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.

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

    autodocodec Autodocodec

    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
    

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

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

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

  6. DecimalNumber :: GeneralCategory

    rio RIO.Char

    Nd: Number, Decimal

  7. LetterNumber :: GeneralCategory

    rio RIO.Char

    Nl: Number, Letter

  8. OtherNumber :: GeneralCategory

    rio RIO.Char

    No: Number, Other

  9. isAlphaNum :: Char -> Bool

    rio RIO.Char

    Selects alphabetic or numeric Unicode characters. Note that numeric digits outside the ASCII range, as well as numeric characters which aren't digits, are selected by this function but not by isDigit. Such characters may be part of identifiers but are not used by the printer and reader to represent numbers, e.g., Roman numerals like V, full-width digits like '1' (aka '65297'). This function returns True if its argument has one of the following GeneralCategorys, or False otherwise:

  10. isNumber :: Char -> Bool

    rio RIO.Char

    Selects Unicode numeric characters, including digits from various scripts, Roman numerals, et cetera. This function returns True if its argument has one of the following GeneralCategorys, or False otherwise:

    These classes are defined in the Unicode Character Database, part of the Unicode standard. The same document defines what is and is not a "Number".

    Examples

    Basic usage:
    >>> isNumber 'a'
    False
    
    >>> isNumber '%'
    False
    
    >>> isNumber '3'
    True
    
    ASCII '0' through '9' are all numbers:
    >>> and $ map isNumber ['0'..'9']
    True
    
    Unicode Roman numerals are "numbers" as well:
    >>> isNumber 'Ⅸ'
    True
    

Page 190 of many | Previous | Next