Nobody's preventing one from declaring types for functions at the top-level (and it is in fact considered Good Style in Haskell). I'm talking about declaring types for local/helper functions -- it's incredibly noisy and mostly pointless.
EDIT: Re: modules and subtyping (and I can't tell you how weird it feels to say this about !Haskell): IME this is largely a theoretical concern and has absolutely minimal impact in practice. If there were a dedicated "module language" (like in e.g. ML) then it might be a more valuable thing just because it would be less prone to abuse, but as it is, I'm mostly just seeing inheritance being abused :(.
(And the cake pattern which was touted as The Solution To Modularity(TM) is rightly seen as 'misguided' these days.)
EDIT: Re: modules and subtyping (and I can't tell you how weird it feels to say this about !Haskell): IME this is largely a theoretical concern and has absolutely minimal impact in practice. If there were a dedicated "module language" (like in e.g. ML)
The module system in ML (which they call function subsumption) is actually subtyping, its just very limited and tacked onto the language. Scala chose to do it properly
Its actually a big in problem in Haskell, its just one I don't think Haskellers realise. For example, XMonad (one of the few Haskell programs in the wild which has to work with a concept of modules) has to ship with GHC, because your XMonad configs have to be .hs files which need to compiled. This is actually unacceptable in a lot of software cases (shipping an entire compiler with your application)
then it might be a more valuable thing just because it would be less prone to abuse, but as it is, I'm mostly just seeing inheritance being abused :(.
Actually having the concept of modules is incredibly common. Haskell doesn't even have properly generic containers that can provide efficient operations because it doesn't allow for this kind of behaviour.
Granted in "OOP" languages its abused, but in Scala its not. People use subtyping when they want "module" or "plugin" style behaviour, otherwise people use ADT types/parametric polymorphism/typeclasses.
The module system in ML (which they call function subsumption) is actually subtyping
Yes, thank you, I'm aware, that's why I mentioned it. It's a limited and syntactically obvious form of subtyping... which was my point.
XMonad
Re: XMonad: What the hell are you talking about? I mean the facts are that you have to use GHC to compile your configuration, but that's just because the XMonad developers chose to make XMonad a library. You would have exactly the same thing in Scala if XMonad were made in Scala and chose Scala as the configuration language. So, what's your point?
(Well, I guess there's bytecode, but Scala bincompat is notoriously difficult.)
I really don't understand this XMonad thing. EDIT: Though, honestly, they did signal it really badly and perhaps fucked up by the whole "auto-recompile, dynamic reload" thing. This has nothing to do with limitations of Haskell, however.
Granted in "OOP" languages its abused, but in Scala its not.
You must have some sort of ideal programmers working for you. I don't.
(We do try to solve it through code review, but that doesn't catch all of it, unfortunately the "masters" cannot be everywhere.)
Re: XMonad: What the hell are you talking about? I mean the facts are that you have to use GHC to compile your configuration, but that's just because the XMonad developers chose to make XMonad a library. You would have exactly the same thing in Scala if XMonad were made in Scala and chose Scala as the configuration language. So, what's your point? (Well, I guess there's bytecode, but Scala bincompat is notoriously difficult.)
Its not hard to define an interface and load a JAR in scala. Also the bincompat issues are going away completely with Dotty (this and Scala maintains bincompat for years, they are taking this seriously now).
In any case, the point was to demonstrate that its an issue. I moved away from XMonad precisely of this point (i.e. how annoying it was to manage GHC at the time). BTW techie linux people how tinker with this stuff have a lot more patience compared to typical users, who probably wouldn't bothered and deleted it immediately
I really don't understand this XMonad thing. EDIT: Though, honestly, they did signal it really badly and perhaps fucked up by the whole "auto-recompile, dynamic reload" thing. This has nothing to do with limitations of Haskell, however.
It is, Haskell is globally and statically linked and the dynamic module isn't useful in practice because bin compat breaks constantly
You must have some sort of ideal programmers working for you. I don't. (We do try to solve it through code review, but that doesn't catch all of it, unfortunately the "masters" cannot be everywhere.)
This isn't a useful counter argument, and its the same kind of attitude that Go has (i.e. if something can be abused, we shouldn't have it at all). Then this causes huge amounts of issues in the language, and then you end up having to implement said features (after the absence of not having them have done enough damage), such as in this case of Go finally implementing a decent package manager. Or in the case of Haskell, just remain in obscurity, because features which other languages have solutions for (which are a requirement for certain kinds of software) basically don't exist or are too difficult to use.
Its not hard to define an interface and load a JAR in scala. Also the bincompat issues are going away completely with Dotty (this and Scala maintains bincompat for years, they are taking this seriously now).
This is the continual problem for me and my work situation: It's always "Yeah, we'll have that next year!". If e.g. Kotlin has it now, what am I supposed to think? Haskell, though it can always be improved, had most of what I need 2+ years ago. So, what am I supposed to do?
Sure, Scala and some libraries are taking bincompat seriously, but even that does not work, because you have to bump dependencies across all of your projects when bincompat changes and your dependencies include projects that don't take bincompat seriously! Even that is a ridiculous chore. Just ship source!
(Source code distribution helps immensely, but as I mentioned it's not a panacea.)
[Go snipe plus implications of Haskell's obscurity]
Oh, come on!
We're done, I think. I don't think any benefit can be derived from further discussion. I realize that the 'scala' subreddit is obviously biased, but you (personally) take the cake.
Good programming! (Even though we disagree vociferously!)
This is the continual problem for me and my work situation: It's always "Yeah, we'll have that next year!". If e.g. Kotlin has it now, what am I supposed to think? Haskell, though it can always be improved, had most of what I need 2+ years ago. So, what am I supposed to do? Sure, Scala and some libraries are taking bincompat seriously, but even that does not work, because you have to bump dependencies across all of your projects when bincompat changes and your dependencies include projects that don't take bincompat seriously! Even that is a ridiculous chore. Just ship source!
I am not sure what your point is here. This is something that isn't really practically possible and yet you are complaining its not perfect in Scala (even though in other languages with dynamic libraries, barring C, you have the same problem)
(Source code distribution helps immensely, but as I mentioned it's not a panacea.)
You can do source code dependencies in SBT if this is a problem (although its common practice for everyone to cross publishing)
We're done, I think. I don't any benefit can be derived from further discussion. I realize that the 'scala' subreddit is obviously biased, but you (personally) take the cake.
I actually have been more critical of Scala than most on the reddit, but I call a spade a spade. Haskell is a language that has very strong theoretical underpinnings which makes a deliberate choice not to deviate from these principles. This has benefits and disadvantages, I was merely listing one of them.
Good programming! (Even though we disagree vociferously!)
Sure, my point was just that (as mentioned before), subtyping doesn't play very well with global type inference (in fact it doesn't play well even with local type inference in non trivial languages). And Scala having subtyping is a deliberate design decision.
Its just a case of you can't have your cake and eat it too
We'll see, actually. There was a recent paper which demonstrated that you can combine inference and subtyping. (Though, I think that was structural subtyping?)
Can't remember the name off-hand, but it should be easy enough to find given the "subtyping" and "inference" keywords :)
We'll see, actually. There was a recent paper which demonstrated that you can combine inference and subtyping. (Though, I think that was structural subtyping?)
Yes, but Scala predominantly uses nominal typing, a language that predominantly uses structural typing is Go.
Again, yes, I already know this. That's the reason I mentioned structural subtyping. Btw, O'Caml did structural subtyping 15+ years ago. (For objects and modules and sort-of for Variant types. I think they've introduced proper row type polymorphism a few years ago as well... Frankly, I'd be using O'Caml right now if weren't for the unrestricted side effects.)
Personally I am actually a fan of structural subtyping, but it does have issues
Performance (you often are forced to use reflection in a lot of cases when dealing with structural typing, Go has this problem). You can avoid this with deep code analysis, but like with most things its hard
Some of the Scala community (ironically the pure FP kind) hate structural subtyping for some reason. Actually structural subtyping even exists in Scala now, although it got a bad name initially because it was based on reflection (back to point #1) which meant that it had terrible performance, especially in multi-threaded situations. And actually originally structural typing was broken in Scala in multi-threaded situations before they fixed it
Its being removed in Dotty because basically none of the community uses it, its being replaced with record types which do have some uses.
I still much prefers Scala combination of FP and OOP compared to OCaml. In OCaml the OOP seems tacked on, unnatural and actually a lot of people don't really use it (in OCaml you kind of have multiple camps because the 2 styles are too distinct). In Scala the merge of OOP and FP is more natural and fluent
1
u/theQuatcon Aug 24 '17 edited Aug 24 '17
Nobody's preventing one from declaring types for functions at the top-level (and it is in fact considered Good Style in Haskell). I'm talking about declaring types for local/helper functions -- it's incredibly noisy and mostly pointless.
EDIT: Re: modules and subtyping (and I can't tell you how weird it feels to say this about !Haskell): IME this is largely a theoretical concern and has absolutely minimal impact in practice. If there were a dedicated "module language" (like in e.g. ML) then it might be a more valuable thing just because it would be less prone to abuse, but as it is, I'm mostly just seeing inheritance being abused :(.
(And the cake pattern which was touted as The Solution To Modularity(TM) is rightly seen as 'misguided' these days.)