News for hackers. Stuff that matters.
Re:What I Want from a Type System (2016) by uryga on Monday July 01, 2019 @10:01AM (#20325295)
edit: misread the parent as saying the opposite of what it actually meant

> The Haskellite approach would also say that "what operations are available on that thing" is the wrong way round; you define your operation, and the type signature tells you what kind of things will work with it.

i'm not sure if i understand. using typeclasses i can define a Haskell function for summing collections:

  sum :: (Foldable f, Monoid a) => f a -> a
  sum x = foldr (<>) mempty x
and it'll work for any Foldable collection (supporting `reduce`) of Monoidal values (supporting "addition", or the `<>` operator) - lists of strings, trees of ints, etc. that sounds a lot like "define your operation, and the type signature tells you what kind of things will work with it"
Re:What I Want from a Type System (2016) by pjc50 on Monday July 01, 2019 @10:04AM (#20325318)
Yes, that's what I meant. This is very different from having to extend Foldable to achieve the same thing.
Re:What I Want from a Type System (2016) by uryga on Monday July 01, 2019 @10:10AM (#20325367)
ah sorry, i was skimming and misread your comment as

> The Haskellite approach that says "what operations are available on that thing" is the wrong way round

which left me pretty confused!