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

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -