Skip to content

Derive instance {Enum, Bounded, Num, Real, Integral} Compose f g a #160

@Bodigrim

Description

@Bodigrim

Let's add

deriving instance Enum (f (g a)) => Enum (Compose f g a)
deriving instance Bounded (f (g a)) => Bounded (Compose f g a)
deriving instance Num (f (g a)) => Num (Compose f g a)
deriving instance Real (f (g a)) => Real (Compose f g a)
deriving instance Integral (f (g a)) => Integral (Compose f g a)

I'd argue that the absense of such instances is just an omission, but if anyone is curious, my particular use case deals with things like Compose Odd Positive Integer, where newtype Odd a and newtype Positive a are wrappers with desired Arbitrary instances.

Metadata

Metadata

Assignees

No one assigned

    Labels

    approvedApproved by CLC votebase-4.19Implemented in base-4.19 (GHC 9.8)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions