julia-challenge icon indicating copy to clipboard operation
julia-challenge copied to clipboard

Tips for a Haskell version

Open Qqwy opened this issue 7 years ago • 1 comments

After reading this challenge (and the nice Medium post about a C++ implementation), I immediately thought back to the paper APLicative programming with Naperian Functors, which talks about how you can much of the functionality you describe in your challenge in a type-safe way in a language that is expressive enough without creating all kinds of crazy constructs:

  • N-dimensional data structures whose contents are lazily evaluated.
  • Arbitrary types of elements can be stored inside.
  • Operations work on these N-dimensional datastructures without extra work, as long as they make sense for their element type.
  • Broadcasting to combine data structures, and re-use slices rather than duplicating data. (7. 'Symbolic Transformations')
  • Everything is statically typed, so the compiler will bark at you when you try to combine incompatible data structures, as well as being able to perform crazy loop fusions and optimizations. (Probably. It should. But of course, I don't have a benchmark for you yet to make this point :stuck_out_tongue_winking_eye: )

It's well-worth the read, written to be understandable even for people who are not well-versed in Haskell, in literate-programming style. I'm unfortunately short on time, so I don't think I'll be able to develop a specific implementation of the challenge for Haskell, but this might inspire some other people to make it.

Qqwy avatar Oct 16 '18 11:10 Qqwy

Well, if Haskell has the same developer productivity as Julia, it shouldn't take you much longer than 0.5-1.5 hours :trollface:

Fun aside, I'd love to see such an implementation come alive! Are you active in the Haskell community and could you post it there? :)

SimonDanisch avatar Oct 16 '18 12:10 SimonDanisch