ekmett / ekmett/semigroups

Modulo Semigroup?

Open
#98 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
62
Forks
28
PR merge metrics
No merged PRs in 30d

Description

Would you guys be interested in a PR adding a `Semigroup` for modular arithmetic?

Something like this:
``` haskell
data Mod (k :: Nat) (f :: * -> *) (a :: *) = Mod (f a)

instance (KnownNat k, Semigroup (f a), Applicative f, Integral a) => Semigroup (Mod k f a) where
(<>) (Mod fx) (Mod fy) = Mod $
mod <$> (fx <> fy) <*> (pure $ fromIntegral $ natVal $ Proxy @k)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the proposed Haskell `Mod` definition and the requested `Semigroup` instance in the issue. Confirm the intended modular-arithmetic semantics and project location before proceeding; the issue is complete only when the maintainers agree on the design and the instance is integrated with appropriate verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.