TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Higher-kinded types: the difference between giving up and moving forward

139 pointsby dmitalmost 9 years ago

7 comments

tveitaalmost 9 years ago
So tuple() for lists takes two lists and gives all combinations with one item from each list. We could call it product.<p>For options it takes two options and return an option with a tuple of values if both are set, otherwise it return None. We could call it bothOrNone.<p>For Either... It&#x27;s not unambiguous, but presumably it&#x27;s similar to option, returning either a tuple of Rights, or the first Left of the arguments, following convention of using Left for errors. We could call it bothRightsOrALeft.<p>For State I&#x27;m just guessing. getBothWithStateOfLast?<p>These may all have interesting mathematical similarities, but the way you would use them in a program would be pretty different. I don&#x27;t think you are making your program clearer by giving them all the same name.<p>Sometimes reading &quot;overabstracted&quot; code can feel similar to reading assembly code. Sure, add and mov are simple operations with a clear definition of input and output, just like flatMap and fold, but they say very little about the programmer&#x27;s intent in using them. If you give me a chain of them without any comment, I&#x27;ll need to work backwards to figure out what you&#x27;re actually trying to accomplish.
评论 #12339916 未加载
评论 #12339346 未加载
评论 #12341955 未加载
justuswalmost 9 years ago
Interesting article and funny to see the shout out to Elm. I think the first few code samples made it very clear that Elm is missing something, at least for this type of generic programming, namely higher order types. Too many times I had to re-implement something that could have been solved in a generic fashion. Kind of similar to how Go programmers have to reimplement instead of generalise.<p>It is actively discussed in the Elm community (<a href="https:&#x2F;&#x2F;github.com&#x2F;elm-lang&#x2F;elm-compiler&#x2F;issues&#x2F;1039" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;elm-lang&#x2F;elm-compiler&#x2F;issues&#x2F;1039</a>), but with a Wait-And-See-Approach. In my opinion, this is really laudable, as it signals readiness to add higher order types, and at the same time keeps developer friendliness of the resulting feature extension in mind.
chowesalmost 9 years ago
What I wish to see in these blog posts are real-world examples. My day job is coding an MVC app in Rails &#x2F; Ember. Fine, I won&#x27;t be able to get past Chapter 11 in a book, but what am I REALLY missing out on? Are these solutions meant for a different problem set, or would I be able to use these concepts in my day-to-day (assuming we were written in a Scala, Haskell, etc.)?
评论 #12338156 未加载
评论 #12338058 未加载
评论 #12338099 未加载
评论 #12337928 未加载
评论 #12337983 未加载
评论 #12337812 未加载
tengbretsonalmost 9 years ago
I really hope that higher-kinded types can be brought to TypeScript. I really want that kind of power on the front-end, but I can&#x27;t count on getting an entire team up to speed with PureScript.
评论 #12338136 未加载
评论 #12339040 未加载
评论 #12337927 未加载
vorotatoalmost 9 years ago
I&#x27;m really confused is he saying that fsharp can&#x27;t have functional combinators? That seems incorrect. Also the title is just generally abrasive. I could just as well say scala doesn&#x27;t natively support dependent types, so clearly it&#x27;s between F* and giving up.
评论 #12339082 未加载
评论 #12338859 未加载
premium-concernalmost 9 years ago
Jesus Christ, don&#x27;t be so salty.
评论 #12349158 未加载
rjdevereuxalmost 9 years ago
I thought this was gong to be an article on hiring kind people and that the title was screwed up.