Are HLists nothing more than a convoluted way of writing tuples?

后端 未结 4 1230
忘掉有多难
忘掉有多难 2020-11-30 16:49

I am really interested in finding out where the differences are, and more generally, to identify canonical use cases where HLists cannot be used (or rather, don\'t yield any

4条回答
  •  孤独总比滥情好
    2020-11-30 17:03

    There are a lot of things you can't do (well) with tuples:

    • write a generic prepend/append function
    • write a reverse function
    • write a concat function
    • ...

    You can do all of that with tuples of course, but not in the general case. So using HLists makes your code more DRY.

提交回复
热议问题