News for hackers. Stuff that matters.

Throwaway234590

Re:Time Travel in Haskell for Dummies on Saturday January 28, 2023 @10:01PM (#34564421)
This year's Advent of Code had a problem where you had to check the visibility of trees in a forest from both sides, (actually four sides, but consider two sides). You needed to read in an entire array of tree heights, and walk back from both sides into the centre to check if each tree was visible.

Because Haskell reads in the entire array before beginning processing, you can create semantics that walk backwards and forwards to solve this problem all in one go. That is what the Tardis monad is about.

Re:Idris: A Language for Type-Driven Development on Sunday January 22, 2023 @08:09AM (#34477006)
Was this blow up due to a dependency with an 'any' type somewhere, and your code the dependency library some garbage? That's what bit me, even with the strictest ts settings, this can't be picked up by tsc.
Re:Functional Programming – How and Why on Monday January 02, 2023 @02:54AM (#34215454)
It's a hairpulling experience trying to write functionally in javascript. All those imperative apis like sort as you mention. I will sometimes copy as in [...xs] but I always feel like I am swimming against the current. Plenty more to say but it appears this node has been flagged, it appears HN censors criticism. Saddening.
Re:Functional Programming – How and Why on Monday January 02, 2023 @01:03AM (#34214872)
Exactly. It's why this forum is toxic, if you disagree with the techbro herd, you get downvoted.
Re:MelonJS – a fresh and lightweight JavaScript game engine on Tuesday December 20, 2022 @08:32AM (#34065598)
Is the problem you mentioned not fixed by collision prediction?