4 ms·
Haskell allows unsafe pointer arithmetic and manipulation (of course, the functions are all named 'unsafe'!). But, you can write safe interfaces on top of it. I
by tathougies 8y ago
Haskell allows unsafe pointer arithmetic and manipulation (of course, the functions are all named 'unsafe'!). But, you can write safe interfaces on top of it. I have an example of an external sort using the standard fibonacci merge algorithm, which uses raw pointers and memory mapped IO under the hood, but which exposes a safe API. I've done some basic benchmarking, and it's about as fast as Postgres's sort on my machine, for simple binary doubles and ints.
Here it is: https://github.com/tathougies/extsort/blob/master/Data/External/Sort.hs https://github.com/tathougies/extsort/blob/master/Data/Exter... .
I think it's a good example of 'low-level' Haskell.