this post was submitted on 04 Oct 2023
4 points (100.0% liked)

Haskell

65 readers
3 users here now

**The Haskell programming language community.** Daily news and info about all things Haskell related: practical stuff, theory, types, libraries, jobs, patches, releases, events and conferences and more... ### Links - Get Started with Haskell

founded 1 year ago
 

This was already featured in the Weekly News a couple of weeks back, but I think maybe it deserves it's own thread. I've tried to explain this approach to some people before, but I think this article does a much better job than I have.

I do think the "Defeating" in the title might be a little bit negative, it's have preferred something neutral like "When your result type depends on your argument values", but it's still something useful to know from retaining your type safety.

This existentials and GADTs can be converted into a CPS style without type equality constraints (usually, with enough work) so that you can start from this description but use it in languages with less sophisticated type systems -- as long as they have parametricity -- like Haskell 2010.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 1 points 11 months ago (1 children)

Ah, that's interesting. Although I can imagine not many people would want to write code in that style. And I also wonder how many languages support higher rank polymorphism in the first place.

[โ€“] [email protected] 1 points 11 months ago

Yeah, I generally prefer pattern matching and constructor calls, but often languages don't have GADTs or existentials. Even in GHC, existentials are still a bit "wonky", though still generally nicer to use than CPS/Codensity.