News for hackers. Stuff that matters.
Re:Things I Was Wrong About: Types by eru on Sunday September 27, 2020 @10:14AM (#24606759)
Sum types even work when you actually have the multiple of the same return types. (Ie in Haskell `Either String String` works just as well as `Either String Int`; the types don't have to be distinctive.)
Re:Things I Was Wrong About: Types by a1369209993 on Sunday September 27, 2020 @07:48PM (#24611235)
Also, `Maybe (Maybe a)` works correctly, contra possibly-null values in dynamically-typed languages. It's a surprisingly significant issue given how seemingly trivial it can sound.
Re:Things I Was Wrong About: Types by karmakaze on Sunday September 27, 2020 @11:12AM (#24607211)
That follows from the definition being tagged 'Left'/'Right':

  Either a b = Left a | Right b
Re:Things I Was Wrong About: Types by eru on Monday September 28, 2020 @12:21AM (#24612928)
Yes, the magic is in the tagging. Tagging also solve the issue of `Maybe (Maybe a)` that the other reply mentioned.