Discussion: Change the specification of rotateL for non-finite Bits, or move rotations to FiniteBits
David Feuer
david.feuer at gmail.com
Mon Sep 29 18:28:23 UTC 2014
Thinking about this some more, I ran into something else to chew on.
It would seem to make a certain amount of sense to have
instance (Bits b) => Bits (Seq b)
with .&., .|., and xor defined using a zero-prepending zipWith variant.
but there are a few challenges relating to size. Specifically:
1. The specification indicates that finiteBitSize and bitSizeMaybe are
supposed to return a result based only on the type of their argument.
Clearly, that will not work for this.
2. There is no obviously correct size to use for zeroBits and bit.
One approach, of course, is to define something wonky like
newtype SeqN (n::Nat) a = SeqN (Seq a)
and then use
instance (Bits b) => Bits (SeqN n b)
but that gives a different, more limited type than one might expect.
More information about the Libraries
mailing list