Is it possible to type a function to accept only literal values?
Daneel Yaitskov <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.cafe |
|---|---|
| Message-ID | <CACNT4y7WGOwZ_zCPkKT7JguynvsnMMGUQ_cbmjXPjyc5did2SA@mail.gmail.com> |
Hi List, Recently I was experimenting with a GCC intrinsic functions for x86 SMID instructions to write a fast CSV parser and noticed that some arguments are required to be literal values (known at compile time), which makes live hard, e.g. bit shift operation expects number of bits to shift in such a way. Nonetheless the intel manual defines function prototypes as normal: __m128i _mm_bsrli_si128 (__m128i a, int imm8) Using a variable as second argument in _mm_bsrli_si128 produces unclear, but compilation error with exact line number. Definitely some magic happens here, because it is not possible to express this constraint type system of C language. Haskell is known as one of the best languages in type acrobatics, but could it beat C here? -- Best regards, Daniil Iaitskov _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.