Hoogle Search

Within LTS Haskell 24.32 (ghc-9.10.3)

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

  1. gtoEnum :: (Generic a, GEnum StandardEnum (Rep a)) => Int -> a

    generic-data Generic.Data

    Generic toEnum generated with the StandardEnum option.

    instance Enum MyType where
    toEnum = gtoEnum
    fromEnum = gfromEnum
    enumFrom = genumFrom
    enumFromThen = genumFromThen
    enumFromTo = genumFromTo
    enumFromThenTo = genumFromThenTo
    

  2. gtoFiniteEnum :: (Generic a, GEnum FiniteEnum (Rep a)) => Int -> a

    generic-data Generic.Data

    Generic toEnum generated with the FiniteEnum option.

    instance Enum MyType where
    toEnum = gtoFiniteEnum
    fromEnum = gfromFiniteEnum
    enumFrom = gfiniteEnumFrom
    enumFromThen = gfiniteEnumFromThen
    enumFromTo = gfiniteEnumFromTo
    enumFromThenTo = gfiniteEnumFromThenTo
    

  3. data FiniteEnum

    generic-data Generic.Data.Internal.Enum

    Extends the StandardEnum option for GEnum to allow all constructors to have arbitrary many fields. Each field type must be an instance of both Enum and Bounded. Avoid fields of types Int and Word.

    Details

    Two restrictions require the user's attention:
    • The Enum instances of the field types need to start enumerating from 0. In particular, Int is an unfit field type, because the enumeration of the negative values starts before 0.
    • There can only be up to maxBound :: Int values (because the implementation represents the cardinality explicitly as an Int). This restriction makes Word an invalid field type as well. Notably, it is insufficient for each individual field types to stay below this limit. Instead it applies to the generic type as a whole.
    Elements are numbered by toEnum, from 0 up to (cardinality - 1). The resulting ordering matches the generic Ord instance defined by gcompare. The values from different constructors are enumerated sequentially.
    data Example = C0 Bool Bool | C1 Bool
    deriving (Eq, Ord, Show, Generic)
    
    cardinality = 6  -- 2    * 2    + 2
    -- Bool * Bool | Bool
    
    enumeration =
    [ C0 False False
    , C0 False  True
    , C0  True False
    , C0  True  True
    , C1 False
    , C1 True
    ]
    
    enumeration == map gtoFiniteEnum [0 .. 5]
    [0 .. 5] == map gfromFiniteEnum enumeration
    

  4. class GEnum opts (f :: Type -> Type)

    generic-data Generic.Data.Internal.Enum

    Generic representation of Enum types. The opts parameter is a type-level option to select different implementations.

  5. data StandardEnum

    generic-data Generic.Data.Internal.Enum

    Standard option for GEnum: derive Enum for types with only nullary constructors (the same restrictions as in the Haskell 2010 report).

  6. gFromEnum :: GEnum opts f => f p -> Int

    generic-data Generic.Data.Internal.Enum

    No documentation available.

  7. gToEnum :: GEnum opts f => Int -> f p

    generic-data Generic.Data.Internal.Enum

    No documentation available.

  8. genumFrom :: (Generic a, GEnum StandardEnum (Rep a)) => a -> [a]

    generic-data Generic.Data.Internal.Enum

    Generic enumFrom generated with the StandardEnum option. See also gtoEnum.

  9. genumFrom' :: forall opts a . (Generic a, GEnum opts (Rep a)) => a -> [a]

    generic-data Generic.Data.Internal.Enum

    Generic enumFrom. Use genumFrom or gfiniteEnumFrom instead.

  10. genumFromThen :: (Generic a, GEnum StandardEnum (Rep a)) => a -> a -> [a]

    generic-data Generic.Data.Internal.Enum

    Generic enumFromThen generated with the StandardEnum option. See also gtoEnum.

Page 155 of many | Previous | Next