No, you're right about that. I'm not too clear on what a right shift of a negative number not represented with 2's complement is supposed to mean (or what any of these shifts should mean for a non-binary representation). And you're right that I missed a key test. One possibility is just to test the high order bit directly and test with that, and use the complement of 0 instead of -1.

On Jul 13, 2014 4:18 PM, "John Meacham" <john@repetae.net> wrote:
On Sun, Jul 13, 2014 at 12:47 PM, David Feuer <david.feuer@gmail.com> wrote:
> ShiftRArithmetic x c = if (isSigned x)
>                                       then shiftR x c
>                                       else (-1 `shiftR` c) .|. (x `shiftR`
> c)


hmm... that isn't quite it because it will always add in the ones on
the left when you only want to do it when the high bit is set, plus it
assumes a specific representation for -1.

   John

--
John Meacham - http://notanumber.net/