Skip to content

cyclic and finite cyclic groups #12

Closed
@matthewleon

Description

@matthewleon

This might seem a bit backward, but I'll start this proposal with the finite cyclic groups. They seem to be the more useful ones, because they give you principled conversion from Int.

class (Cyclic g, BoundedEnum g) <= FiniteCyclic g where
  fromInt :: Int -> g

The Cyclic superclass gives us:

class (Group g) <= CyclicGroup g where
  generator :: g

You can define a defaultFromInt that uses the generator.

The most immediate problem I see this resolving is that BoundedEnum's fromInt has a Maybe, and no sensible default implementation.

Curious for others' thoughts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions