From the 9.12.1-alpha2 release notes:
New vector shuffle instructions, such as
shuffleFloatX4# :: FloatX4# -> FloatX4# -> (# Int#, Int#, Int#, Int# #) -> FloatX4#
. These instructions take two input vectors and a collection of indices (which must be compile-time literal integers)
I thought it is interesting that they are required to be literals. I suppose literals are required because they are guaranteed to be available at compile-time. However, there are other approaches to provide compile time computation:
- TemplateSyntax, which I imagine the GHC team might want to avoid, given that it has been so hard to get it working with JavaScript and cross compilation?
- Singletons, which I imagine can’t be used in boot libraries, as it is not considered elegant enough? With singletons, the function itself would be indexed by the unboxed tuple. I haven’t used singletons, so I am not sure whether this would work?
It’s interesting that GHC is improving support for type-level programming, but at the same time, ‘magic’ functions are able to verify whether its inputs are arguments. I use the term ‘magic’ because I imagine that only hardwired functions are able to do something like this. Is that true?