logoalt Hacker News

nh2yesterday at 10:19 PM1 replyview on HN

In Haskell they are a little less annoying. It is just easier to reason about (including proving) pure functions.


Replies

inigyouyesterday at 10:44 PM

I meant the constrained types by hiding the constructors. Super annoying, not automatically convertible, in Haskell you have to remember what the fake constructor is called, and write it every time you use it, but at least it's efficiently implemented with newtype, unlike the Java OOP version. Think about writing a value with several nested constrained types, like NonEmptyListOne (makeNonZeroNumber 42, 'h' `NonEmptyString` "ello world"). It's just really annoying.

show 1 reply