Remove bitSize from MINIMAL pragma of class Bits

Open Beginner friendly
#441 2 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
haskell

Research direction

Start at the class Bits declaration and inspect the MINIMAL pragma shown in the issue, along with the default implementation of bitSize. Remove bitSize from the pragma while preserving the other requirements, then verify that the resulting declaration allows Bits instances to omit bitSize without an incomplete-instance warning.

Written by the indexing model from the issue text.

Description

bitSize is a member of class Bits, deprecated because of being partial in favor of total bitSizeMaybe and finiteBitSize back in base-4.7 (GHC 7.8, 2014).

Yet despite being deprecated bitSize remained a member of

    {-# MINIMAL (.&.), (.|.), xor, complement,
                (shift | (shiftL, shiftR)),
                (rotate | (rotateL, rotateR)),
                bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount #-}

which is very awkward: anyone defining instance Bits Foo has either define bitSize and receive a deprecation warning, or not define it and receive a warning about incomplete instance declaration.

Even when bitSize got a default implementation in base-4.12, it still remained a mandatory {-# MINIMAL #-} member of class Bits.

The proposal thus is to remove bitSize from {-# MINIMAL #-} of class Bits, allowing library authors finally to act on the deprecation warning and stop defining this function in their instances of Bits.

The proposal is meant to be a first step to a future removal of bitSize from class Bits as discussed in #440.

This proposal is not a breaking change.

Dominant language
Haskell
Stars
109
Forks
20
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from haskell/core-libraries-committee

All issues in haskell/core-libraries-committee

Similar issues

More Haskell issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.