The Exact and Max constructors require a nonnegative Int. Denotationally, Exact 0 is the same as Max 0. There's also unknown. This means you can fit an entire Size into the same space as an Int:
Exact n is represented by a non-negative n.
Max n is represented by a negative n, where n <= maxBound.
Unknown is minBound, because minBound == negate minBound.
Doing so would allow Size to be unpacked in Bundle and various functions. Exact, Max, and Unknown can be pattern synonyms. I feel like this would improve performance somewhat.
The
ExactandMaxconstructors require a nonnegativeInt. Denotationally,Exact 0is the same asMax 0. There's also unknown. This means you can fit an entireSizeinto the same space as anInt:Exact nis represented by a non-negativen.Max nis represented by a negativen, wheren<=maxBound.UnknownisminBound, becauseminBound == negate minBound.Doing so would allow
Sizeto be unpacked inBundleand various functions.Exact,Max, andUnknowncan be pattern synonyms. I feel like this would improve performance somewhat.