Hoogle Search

Within LTS Haskell 24.6 (ghc-9.10.2)

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

  1. constructorIsLabelDeriver :: Deriver

    domain Domain

    Generates instances of IsLabel for wrappers, enums and sums, providing mappings from labels to constructors.

    Sum Example

    Having the following schema:
    Host:
    sum:
    ip: Ip
    name: Text
    
    The following instances will be generated:
    instance a ~ Ip => IsLabel "ip" (a -> Host) where
    fromLabel = IpHost
    
    instance a ~ Text => IsLabel "name" (a -> Host) where
    fromLabel = NameHost
    
    In case you're wondering what this tilde (~) constraint business is about, refer to the Type Equality Constraint section.

    Enum Example

    Having the following schema:
    TransportProtocol:
    enum:
    - tcp
    - udp
    
    The following instances will be generated:
    instance IsLabel "tcp" TransportProtocol where
    fromLabel = TcpTransportProtocol
    
    instance IsLabel "udp" TransportProtocol where
    fromLabel = UdpTransportProtocol
    

  2. dataDeriver :: Deriver

    domain Domain

    Derives Data. Requires to have the StandaloneDeriving and DeriveDataTypeable compiler extensions enabled.

  3. enumDeriver :: Deriver

    domain Domain

    Derives Enum for enums or sums having no members in all variants. Requires to have the StandaloneDeriving compiler extension enabled.

  4. eqDeriver :: Deriver

    domain Domain

    Derives Eq. Requires to have the StandaloneDeriving compiler extension enabled.

  5. genericDeriver :: Deriver

    domain Domain

    Derives Generic. Requires to have the StandaloneDeriving and DeriveGeneric compiler extensions enabled.

  6. hasFieldDeriver :: Deriver

    domain Domain

    Derives HasField with unprefixed field names. For each field of a product generates instances mapping to their values. For each constructor of a sum maps to a Maybe tuple of members of that constructor, unless there's no members, in which case it maps to Bool. For each variant of an enum maps to Bool signaling whether the value equals to it. Please notice that if you choose to generate unprefixed record field accessors, it will conflict with this deriver, since it's gonna generate duplicate instances.

  7. hashableDeriver :: Deriver

    domain Domain

    Generates Generic-based instances of Hashable.

  8. liftDeriver :: Deriver

    domain Domain

    Derives Lift. Requires to have the StandaloneDeriving and DeriveLift compiler extensions enabled.

  9. mapperIsLabelDeriver :: Deriver

    domain Domain

    Generates instances of IsLabel for sums and products, providing mappers over their components.

    Product Example

    Having the following schema:
    NetworkAddress:
    product:
    protocol: TransportProtocol
    host: Host
    port: Word16
    
    The following instances will be generated:
    instance
    mapper ~ (TransportProtocol -> TransportProtocol) =>
    IsLabel "protocol" (mapper -> NetworkAddress -> NetworkAddress)
    where
    fromLabel mapper (NetworkAddress a b c) =
    NetworkAddress (mapper a) b c
    
    instance
    mapper ~ (Host -> Host) =>
    IsLabel "host" (mapper -> NetworkAddress -> NetworkAddress)
    where
    fromLabel mapper (NetworkAddress a b c) =
    NetworkAddress a (mapper b) c
    
    instance
    mapper ~ (Word16 -> Word16) =>
    IsLabel "port" (mapper -> NetworkAddress -> NetworkAddress)
    where
    fromLabel mapper (NetworkAddress a b c) =
    NetworkAddress a b (mapper c)
    
    In case you're wondering what this tilde (~) constraint business is about, refer to the Type Equality Constraint section.

    Sum Example

    Having the following schema:
    Host:
    sum:
    ip: Ip
    name: Text
    
    The following instances will be generated:
    instance
    mapper ~ (Ip -> Ip) =>
    IsLabel "ip" (mapper -> Host -> Host)
    where
    fromLabel fn (IpHost a) = IpHost (fn a)
    fromLabel _ a = a
    
    instance
    mapper ~ (Text -> Text) =>
    IsLabel "name" (mapper -> Host -> Host)
    where
    fromLabel fn (NameHost a) = NameHost (fn a)
    fromLabel _ a = a
    
    In case you're wondering what this tilde (~) constraint business is about, refer to the Type Equality Constraint section.

  10. ordDeriver :: Deriver

    domain Domain

    Derives Ord. Requires to have the StandaloneDeriving compiler extension enabled.

Page 92 of many | Previous | Next