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. deriveLiftMany :: [Name] -> Q [Dec]

    th-lift Language.Haskell.TH.Lift

    Derive Lift instances for many datatypes.

  2. deriveLiftMany' :: [([Role], Info)] -> Q [Dec]

    th-lift Language.Haskell.TH.Lift

    No documentation available.

  3. deriveListable :: Name -> DecsQ

    leancheck Test.LeanCheck

    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.

  4. deriveListableCascading :: Name -> DecsQ

    leancheck Test.LeanCheck

    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
    

  5. deriveList :: Name -> ExpQ

    leancheck Test.LeanCheck.Derive

    Given a type Name, derives an expression to be placed as the result of list:

    concat $ consN C1 \/ consN C2 \/ ... \/ consN CN
    

  6. deriveListable :: Name -> DecsQ

    leancheck Test.LeanCheck.Derive

    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.

  7. deriveListableCascading :: Name -> DecsQ

    leancheck Test.LeanCheck.Derive

    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
    

  8. deriveListableIfNeeded :: Name -> DecsQ

    leancheck Test.LeanCheck.Derive

    Same as deriveListable but does not warn when the requested instance already exists. The function deriveListable is preferable in most situations.

  9. deriveTiers :: Name -> ExpQ

    leancheck Test.LeanCheck.Derive

    Given a type Name, derives an expression to be placed as the result of tiers:

    consN C1 \/ consN C2 \/ ... \/ consN CN
    
    This function can be used in the definition of Listable instances:
    instance Listable MyType where
    tiers  =  $(deriveTiers)
    

  10. deriveListable :: Name -> DecsQ

    leancheck Test.LeanCheck.Error

    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.

Page 8 of many | Previous | Next