Skip to content

Exception thrown when using finiteBitSize that evaluates its argument #116

@chessai

Description

@chessai

In the Bits and FiniteBits documentation, bitSize, bitSizeMaybe, and finiteBitSize say that they do not evaluate their arguments. This makes sense for fixed-size types. For something like ByteString though, we need to get the length of the ByteString (e.g. finiteBitSize x = 8 * B.length x). However quickcheck-classes makes the assumption that finiteBitSize will never evaluate its argument, since it passes undefined to it everywhere. It is not clear to me that the documentation for Data.Bits is indicating that a valid implementation of these functions must not evaluate its argument, or if when defining these classes, only fixed-width types were in mind (and not necessarily just finite-sized types, like strict ByteString).

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