Skip to content

Semiring Maybe instance is badly behaved #18

Closed
@hdgarrood

Description

@hdgarrood

Semiring has the following law:

  • zero * a = zero

With the instance (Semiring a) => Semiring (Maybe a), neither of these hold for a = Nothing - since mul is defined as liftA2 mul, zero * Nothing = Nothing, but zero = Just zero. Changing the definition of zero to be Nothing could fix this but might break other laws, I'm not sure. Maybe we should just remove this instance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions