How can we emulate variadic templates in Haskell? -


in c++ can define function takes variable number of statically typed arguments, using variadic templates, so:

template<typename... params> void f(params... parameters); 

(alternatively have create struct variadic number of fields , used argument f.)

we can use type traits inspect values. similar in haskell.

i'd define data type , family of functions parameterized number of statically typed arguments:

data t ??? = ... mkt :: ... -> t ??? f :: t ??? -> ... 

f needs able convert parameter types values can generic them (think printf).

perhaps job hlists?


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -