Hoogle Search

Within LTS Haskell 24.4 (ghc-9.10.2)

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

  1. deriveTypeElim :: Name -> Q [Dec]

    eliminators Data.Eliminator.TH

    deriveTypeElim dataName generates a type-level eliminator for the datatype dataName. The eliminator will follow these naming conventions:

    • If the datatype has an alphanumeric name, its eliminator will have that name with Elim prepended.
    • If the datatype has a symbolic name, its eliminator will have that name with ~> prepended.

  2. deriveTypeElimNamed :: String -> Name -> Q [Dec]

    eliminators Data.Eliminator.TH

    deriveTypeElimNamed funName dataName generates a type-level eliminator named funName for the datatype dataName.

  3. deriveClasses :: OptionsT (f :: Type -> Type) -> [Name]

    enum-subset-generate Data.MakeEnum.Options

    No documentation available.

  4. deriveGeneralizable :: Name -> DecsQ

    extrapolate Test.Extrapolate

    Derives a Generalizable instance for a given type Name. If needed, this function also automatically derivates Listable, Express and Name instances using respectively deriveListable, deriveExpress and deriveName. Consider the following Stack datatype:

    data Stack a = Stack a (Stack a) | Empty
    
    Writing
    deriveGeneralizable ''Stack
    
    will automatically derive the following Generalizable instance:
    instance Generalizable a => Generalizable (Stack a) where
    instances s = this "s" s
    $ let Stack x y = Stack undefined undefined `asTypeOf` s
    in instances x
    . instances y
    
    This function needs the TemplateHaskell extension.

  5. deriveGeneralizableCascading :: Name -> DecsQ

    extrapolate Test.Extrapolate

    Derives a Generalizable instance for a given type Name cascading derivation of type arguments as well.

  6. deriveGeneralizableIfNeeded :: Name -> DecsQ

    extrapolate Test.Extrapolate

    Same as deriveGeneralizable but does not warn when instance already exists (deriveGeneralizable is preferable).

  7. deriveListable :: Name -> DecsQ

    extrapolate Test.Extrapolate

    Derives a Listable instance for a given type Name. Consider the following Stack datatype:

    data Stack a  =  Stack a (Stack a) | Empty
    
    Writing
    deriveListable ''Stack
    
    will automatically derive the following Listable instance:
    instance Listable a => Listable (Stack a) where
    tiers  =  cons2 Stack \/ cons0 Empty
    
    Warning: if the values in your type need to follow a data invariant, the derived instance won't respect it. Use this only on "free" datatypes. Needs the TemplateHaskell extension.

  8. deriveListableCascading :: Name -> DecsQ

    extrapolate Test.Extrapolate

    Derives a Listable instance for a given type Name cascading derivation of type arguments as well. Consider the following series of datatypes:

    data Position  =  CEO | Manager | Programmer
    
    data Person  =  Person
    {  name :: String
    ,  age :: Int
    ,  position :: Position
    }
    
    data Company  =  Company
    {  name :: String
    ,  employees :: [Person]
    }
    
    Writing
    deriveListableCascading ''Company
    
    will automatically derive the following three Listable instances:
    instance Listable Position where
    tiers  =  cons0 CEO \/ cons0 Manager \/ cons0 Programmer
    
    instance Listable Person where
    tiers  =  cons3 Person
    
    instance Listable Company where
    tiers  =  cons2 Company
    

  9. deriveListable :: Name -> DecsQ

    extrapolate Test.Extrapolate.Core

    Derives a Listable instance for a given type Name. Consider the following Stack datatype:

    data Stack a  =  Stack a (Stack a) | Empty
    
    Writing
    deriveListable ''Stack
    
    will automatically derive the following Listable instance:
    instance Listable a => Listable (Stack a) where
    tiers  =  cons2 Stack \/ cons0 Empty
    
    Warning: if the values in your type need to follow a data invariant, the derived instance won't respect it. Use this only on "free" datatypes. Needs the TemplateHaskell extension.

  10. deriveListableCascading :: Name -> DecsQ

    extrapolate Test.Extrapolate.Core

    Derives a Listable instance for a given type Name cascading derivation of type arguments as well. Consider the following series of datatypes:

    data Position  =  CEO | Manager | Programmer
    
    data Person  =  Person
    {  name :: String
    ,  age :: Int
    ,  position :: Position
    }
    
    data Company  =  Company
    {  name :: String
    ,  employees :: [Person]
    }
    
    Writing
    deriveListableCascading ''Company
    
    will automatically derive the following three Listable instances:
    instance Listable Position where
    tiers  =  cons0 CEO \/ cons0 Manager \/ cons0 Programmer
    
    instance Listable Person where
    tiers  =  cons3 Person
    
    instance Listable Company where
    tiers  =  cons2 Company
    

Page 38 of many | Previous | Next