3 ms·
You make it sound like Haskell doesn’t have the capability to do things like “writing to memory, and express basic operations like assigning a value to a positi
by kccqzy 9y ago
You make it sound like Haskell doesn’t have the capability to do things like “writing to memory, and express basic operations like assigning a value to a position in an array.” That’s utterly false. It’s not impossible or unusual in performance critical code to deal with mutable bytes strings and mutable arrays extensively. If you want you can just write to arbitrary locations in memory and cause segfaults in Haskell.
Mutable arrays (this is used more often than you thought): http://hackage.haskell.org/package/vector-0.12.0.1/docs/Data-Vector-Generic-Mutable.html http://hackage.haskell.org/package/vector-0.12.0.1/docs/Data...
Raw pointers (types, casts, and pointer arithmetic): http://hackage.haskell.org/package/base-4.10.0.0/docs/Foreign-Ptr.html http://hackage.haskell.org/package/base-4.10.0.0/docs/Foreig...
Raw pointers (dereferencing them, reading and writing memory): http://hackage.haskell.org/package/base-4.10.0.0/docs/Foreign-Storable.html http://hackage.haskell.org/package/base-4.10.0.0/docs/Foreig...
Manual memory management (malloc/free style): http://hackage.haskell.org/package/base-4.10.0.0/docs/Foreign-Marshal-Alloc.html http://hackage.haskell.org/package/base-4.10.0.0/docs/Foreig...