News for hackers. Stuff that matters.
Re:A simple ray tracer in Lean 4 by ivanbakel on Monday February 01, 2021 @09:18AM (#25988876)
A similar-but-different approach exists in (largely Dutch) research around uniqueness typing, which uses static analysis guarantees to allow for destructive updates wherever the compiler can prove something is uniquely referenced. To my knowledge, efforts have been made to integrate that approach into GHC.
Re:A simple ray tracer in Lean 4 by orbifold on Monday February 01, 2021 @09:42AM (#25989068)
I think the novel thing is that this is doing it dynamically, which bypasses the static analysis and makes it applicable to situations where static analysis wouldn't be useful.
Re:A simple ray tracer in Lean 4 by kmill on Monday February 01, 2021 @03:29PM (#25993422)
As I understand it, it does some static analysis still. The big idea with the Perseus algorithm, I think, is that instead of lending a reference at a function call, it is given. This leads to numerous optimizations where memory can statically be reused. They still do dynamic checks that an object has only one reference, too, when it's not statically known.
Re:A simple ray tracer in Lean 4 by creata on Monday February 01, 2021 @11:32AM (#25990143)
Are you referring to Linear Haskell[0] or some other effort? Linear Haskell can definitely express destructive updates, but IIRC it needs unsightly stuff like constructors which take continuations and method signatures along the lines of

    length : Array a -o (Array a, Unrestricted Int)
which have to thread the unique value through them, since there's no notion of borrowing.

[0]: https://gitlab.haskell.org/ghc/ghc/-/wikis/linear-types

Re:A simple ray tracer in Lean 4 by ivanbakel on Monday February 01, 2021 @04:02PM (#25993901)
I'm talking about uniqueness typing. It's similar to linear types, but not the same. If you search the term, you can find a few research papers from Dutch universities, particularly around Clean, a programming languages which uses uniqueness typing instead of monads for IO.
Re:A simple ray tracer in Lean 4 by creata on Monday February 01, 2021 @11:52PM (#25997551)
Thanks. I'm aware of that, but I can't find any such efforts for Haskell in particular.