-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Differences between shiftInAt0
and shiftInAtN
#2836
Comments
Right, currently,
Which is why: rotateRightS' :: forall d n a. KnownNat n => Vec n a -> SNat d -> Vec n a
rotateRightS' input SNat = output
where
(output, feedback) = shiftInAt0 @n @_ @d input feedback diverges, as it uses its recursive result in the strict argument position. To make it not diverge you have to do: rotateRightS' :: forall d n a. KnownNat n => Vec n a -> SNat d -> Vec n a
rotateRightS' input SNat = output
where
(output, feedback) = shiftInAt0 @n @_ @d input (lazyV feedback) The reason for all of this is my/our desire to built functions within the
We can make the type arguments have the same order, so |
I'm fine with keeping the operations asymmetric with respect to their argument strictness, as long as this is clear to the user. It's just something that might be overseen easily otherwise.
👍 |
I noticed some unexpected differences between
shiftInAt0
andshiftInAtN
:shiftInAt0
requiresKnownNat n
, whileshiftInAtN
requiresKnownNat m
.shiftInAt0
is implicitly quantified viaforall n a m
, whileshiftInAtN
is implicitly quantified viaforall m n a
.rotateLeftS
androtateRightS
viashiftInAt0
andshiftInAtN
utilizing their duality (see some example code below), thenrotateLeftS'
definition returns on some input in the REPL, whilerotateRightS'
does not.We either should give both operations some symmetric behavior or we should explain, why we like them to be different on purpose.
The text was updated successfully, but these errors were encountered: