Skip to content

Conversation

@zliu41
Copy link

@zliu41 zliu41 commented Jul 25, 2021

Fixes #90

start = Scanr1 $ \_ -> VNil

step :: forall m. N.SNatI m => Scanr1 m a -> Scanr1 ('S m) a
step (Scanr1 go) = Scanr1 $ \(x ::: xs) -> case N.snat :: N.SNat m of
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't feel right. You shouldn't need to check length in the step case. I can take a look myself if you cannot find a way to avoid it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In scanr1, the last element is special (it is the zero element), and so the 0 -> 1 step and the m -> m + 1 step (where m > 0) are different. But yeah please let me know if there's a better way to write this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phadej - let me know if you have any updates on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add scanl/scanr/scanl1/scanr1

2 participants