
Do you have a use case for this instance? I don't think I would ever want
it. Also I think the behavior is too unspecified, and trying to specify it
more precisely will inevitably lead to a much less useful instance. In this
instance I might prefer we focus on problems we have already rather make
new ones.
Also +1 for rotate acting like shift for infinite types, for the reasons
Milan gave.
John L.
On Sep 29, 2014 11:28 AM, "David Feuer"
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. _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries