Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upcounter example behavior unclear or buggy #54
Comments
Thanks for pointing out this bug! I can confirm that this indeed is a bug, and that it occurs in the C output as well. We will be looking into this problem and keep you updated. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If the counter example is changed to run more steps than 270, it behaves in a way that was surprising to me. It resets once, at 256, but after counting back up from 0, it then continues past 256.
That might be what was intended, the comment that it "resets when it reaches 256" is perhaps just unclear. Since this was the second copilot program I tried, my impression was that it wasn't working right somehow.
Here's a version that behaved how I expected it to behave.
bytecounter :: Stream Int32
bytecounter = counter true reset where
reset = let n = counter true false
in n
mod
256 == 0(And I'm very impressed, BTW, that I was able to write the natural haskell code there, and it just worked in the copilot EDSL!)