10
AleCx04
6y

One language that I have always wanted to give more attentio to but felt as if I was in a constant fight was Haskell.

To me it felt unintuitive, and required a MAJOR shift in practice to get going. I really wanted to give it a chance but could not.

Every other language felt natural(even Lisp) but haskell for some reason seemed like a major mindfuck)

Comments
  • 1
    I would love to have any example of software in production from Haskell code.

    If it's so fucking great. Why isn't it everywhere? Why do people want to learn it?
    So they can be "cool" and say you're not a real developer unless you know Haskell?

    I'm fucking clueless and I would love for someone to show me the way.
  • 0
    @BigBoo same here. Complexity is one thing, people swear for it but I have yet to find one killer app built in it.
  • 1
    The type system is very strong and flexible, which in turn offloads some of the effort required to validate correctness of a program by the user to the compiler
  • 1
    @BigBoo Let me google that for you:
    https://wiki.haskell.org/Haskell_in...

    If you want I can try to defend Haskell and more generally FP as well to you.

    I'm sure there's some people who are learning how to write hello world in Haskell and then stroking their egos about it but they're not that many.

    Maybe if you ask a few specific questions I can help with getting some of that ego-driven bullshit out of the way and tell you what's actually true about the paradigm or the language.
  • 0
    @PetarP i didn't get any ego from what he said. Nor did I place any in mine btw. I am legitimately curious as to what value Haskell would have in the real world(you provided a link) no need to get offensive about it. People are more willing to accept and adapt their mindsets to new concepts when the delivery is not through inyoface statements
  • 2
    @AleCx04
    I meant ego of the aforementioned people who say haskell is the only real language or whatever. I wasn't talking about him or you.
  • 2
    @AleCx04 I just like FP and really hate those same elitists who think that if you know what a Monoid is people have to stand out of your way and roll a red carpet. It harms the discussion. Sorry if I didn't express myself correctly.
  • 1
    @PetarP Okey, so. This is a list of companies who use Haskell and they bring subjective reasons to why they use it or they just state that they use it.

    I know that it is FP, but none of these for examples, (I'm going to quote in the middle of a sentence, but it's a company's motivation to why Haskell is good for them.

    "... allowing for faster development, better code sharing and ultimately faster implementations. Above all, we value static type checking for minimizing runtime errors in applications that run in unknown ... "

    a) It's faster than developing C/C++ in their case, congratulations.

    b) Better code sharing is subjective without a metric. And if there is a metric for , what I guess is code reusability I would love to see that.

    c) Faster implementations is point [a] again.

    d) They value static type checking. Personally I get that, but that's also their values so subjective as well.

    So my question still stands, why should I care about Haskell?
  • 1
    @BigBoo
    I would agree with you that the first few points there are irrelevant or probably wrong on the performance one. Haskell generally doesn't get better performance than C/C++.

    The main difference between Haskell and other FP langs is the complex, static type system.

    With non-FP static vs dynamic benefits and downsides are obvious- less boilerplate in dynamic and functions are more general, but you have to write a lot of tests and you can almost never guarantee not to get runtime errors. With non-FP static languages this problem only gets pushed one level down. C#, Java and similar langs have a very superficial type system which allows you to structure your thinking a bit better, but doesn't prevent these problems.

    In Haskell, on the other hand there are many complex types, which the language hides from you, but strictly enforces to the point where in combination with the immutability and purity you can non-sarcastically make the statement "If it compiles, ship it!"
  • 1
    @BigBoo

    Of course, the strict compiler means that during development you're going to have many errors to work out before having a working product. So the initial phase of getting something running is going to be a lot longer than other languages. This can be thought of as a future investment in stability, ease of modification and ease of testing.

    If you want to push something 80% complete with bugs Haskell won't let you do that easily. Now, whether this is a benefit will depend on the type of project you're doing and personal preference. If you're going to be constantly updating and touching up parts of your code for years and don't want to end up doing 20x more work afterwards and eventually rewriting everything because of inevitable spaghetti code that future investment might sound good.

    Another slight benefit, this one more for companies, is that if you're going to be introducting new programmers to FP, Haskell will help immensely since it limits deviation in style.
  • 0
    @PetarP Yes this is the main advantage with strong statically typed languages. But there has to be other languages like that. It's just one property of the language.

    What else than preference makes it "good" aides from this one point? Or is this the one thing that makes the language good?

    For example. If I'm good at C++. For what projects should I consider using Haskell instead? And why?
  • 1
    @BigBoo

    On the point of code reusability - this is not a Haskell-specific point but rather one of the main FP benefits in general. I am completely unaware of your personal experience and knowledge of FP so I can't correctly judge how to explain that point, but the main reason for the much-easier code reusability in FP languages is the widespread use of abstract higher-order functions and partial application.

    In a big project, this results in your code being about ~1/3rd of the length and looking like a huge library of generic utility functions and one main pipeline of logic, which calls all of them.

    With best practices these functions become abstract enough, to the point that more than 50% of them can probably be used in another completely separate project, since they don't rely on any context whatsoever.
  • 1
    @BigBoo

    If you're good at C++ and haven't done anything serious with FP you won't get any immediate benefits. You don't get to just switch to a functional language, because everything is going to be completely foreign and you'll feel like you're learning to code all over again.

    Now, if you're comfortable with both paradigms then the main striking things is that Haskell is a lot higher-level than C++. So that choice will depend on how much you value performance optimization.

    If we're talking about a comparison of languages at similar levels of abstraction, for example Java and Haskell, then the arguments now revolve around the differences between FP and OOP. That's a whole other discussion.

    And the actual comparison where we can talk about the language of Haskell itself is in contrast to a dynamic FP like Clojure or Lisp or a similar static FP like F# or Scala.

    What am I actually defending? FP or Haskell?
  • 0
    @PetarP I mean, for some projects it's more beneficial to use Java than C++. Like where C++ is lacking any libraries for the core problem you want to solve.

    I just want like one example where Haskell is more beneficial than for example C++. From a practical standpoint. Not because they are "different" yes, I know that they are different. From my viewpoint, you have had zero arguments so far of why it's good. And you have expanend a lot on the argument that I brought in of it being statically typed.

    Idk. I'm just not convinced about anything you or anyone have said so far. You only expand on it being FP and strong statically typed. I know what those things are.

    So what's the nice thing with Haskell in an objective view? Since those points are subjective. Does it have a strong community? Is the language ever updated? Is the tooling really good? I don't need a primer on the things I already know.
  • 1
    @BigBoo You're not going to find any unique functionality which hasn't been implemented in more popular languages, because of the size of the community.

    It's currently small and dedicated, with a lot of mathematicians, computer scientists and engineers, but there's a big influx currently of JS devs who are riding the FP-style wave.

    Tools are being built, most things are not as refined as age-old C libraries are, but there's increasing interest. For example John Carmack has been pushing Haskell for game development and showed great enthusiasm in his 2013 Quakecon keynote. He directly compares it to C++ development.

    Web frameworks are already here with things like Yesod or Snap.

    Most of the objective excitement is coming in regards to the possibility of parallelising functional code easily over new multi-core CPU's for better performance.

    And if you want to discount subjective experience of the programmer, that's your choice, but for me that is the main selling point.
  • 0
    @PetarP You made some points in paragraph 4 and 5. The other ones missed the point or was contradictory to itself.

    But thanks for you trying. I might seem stubborn but I genuinely don't get it and it's irritating me that I can't see what I'm missing out on.

    I gave some more thought to what the problem is and I came down to this.

    What does Haskell solve? For Haskell to make sense, it has to solve some problem. Otherwise it's just another programming language for me to ignore.

    What was the intention of haskells creation? And if the answer is just to create a FP language because someone wanted that rather than something else. I'm out 😐

    I'll just go on not knowing what this greatness I'm missing out on.
  • 1
    @BigBoo I haven't used Haskell personally, but I've gotten fairly comfortable with Clojure. Immutability is pretty great, its saved me a few times and makes async code easier if you don't have to worry about values changing out from underneath you. Using higher order functions too can really simplify code and you can end up with some really short elegant solutions. Lazy evaluation is also pretty nice, and I find being able to develop with a repl really speeds up the dev process.

    I didn't care at all for functional programming until I gave it a good shot and I'd suggest you at least try for some time. It'll be tough to start since it's very different. I think it's changed my way of thinking for the better. I've ran into situations in other languages now where I wish I could use a higher order function or maybe even a macro, but I don't think I've had the reverse where I wish I wasn't using a functional language.
  • 0
    @ThatTallNerd But you can do higher order functions in java, c++ and python to name a few.

    Why do I need a whole language which the main point is higher order functions?

    Same goes for immutability.
  • 2
    @BigBoo

    https://youtube.com/watch/...

    Haskell was invented by a committee of computer scientists, working on the functional paradigm in the 90's because there was no widely accepted alternative. It was solid, it was good so it stuck as the flagship static functional language. So Haskell itself wasn't invented to solve any problem.

    The people who were working on the paradigm though, were seeing it as a way to solve parallelism, remove the necessity of unexpected side effects, make programs easier to reason about and predict effects, mathematically prove a program will always work for any input (useful in high-risk areas such as military, nuclear, space, etc.), optimize code re-usability, allow for greater abstraction and so on and so forth.

    People have built code for military helicopters, mathematically proven to be unhackable using FP and formal logic...

    FP just solves an entirely different set of problems than imperative. That's why it's fascinating.
  • 0
    @PetarP Unhackable sounds like a bunch of bullshit. Just because you haven't found a flaw in the logic doesn't mean that there is none.
  • 1
    @BigBoo I really don't find using higher order functions in those languages as nice, and yes you can make things immutable in other languages but you have to go out of your way to do so, it's not the default behaviour
  • 2
    @BigBoo

    Formal Verification of functional programs is a whole topic you can research and read about. And no, it's not bullshit. It sounds amazing because it is.
  • 0
  • 0
    @PetarP What's your source for this? If it's some magazine I can probably just disregard everything you say because you seem naive.

    Great claims require great proofs.
  • 0
    @ThatTallNerd Yeah, you have to use a boxed type in java and a keyword in c++.

    Ok, I don't care about what people "feel". I want stats. You feeling one way does not persuade me to your point. Quite the contrary.
  • 0
    @PetarP Nothing about an Unhackable helicopter here.
  • 1
    @BigBoo

    This is the github repo for the kernel: https://github.com/seL4/l4v/

    This is about the proof:

    http://sel4.systems/Info/FAQ/...

    It was first used in an unmanned Boeing Little Bird helicopter.
  • 0
    @PetarP Unhackable, lists 7 assumptions.

    Yeah. Sure. It's Unhackable unless you hack it in some of these ways.
  • 0
    @PetarP Jesus.

    "We assume the axioms of higher-order logic are logically consistent.

    We assume our prover checks this particular proof correctly."
  • 1
    @BigBoo what stats do you want? You're not going to find stats like x language is 2x better than y language at z unless it's something like speed. How do you measure ease of use, developer happiness, quality of solutions?
  • 2
    @BigBoo

    @BigBoo

    "We assume the axioms of higher-order logic are logically consistent." literally just means 'We assume the branch of mathematics known as formal logic works...'

    Dude... if you're just gonna argue for the sake of arguing there's no point. If you don't find this at least a little bit cool you have no soul.

    And BTW if you discount subjective experience the best language by every objective measurement is clearly machine code. Best performance, you can do everything, unhackable, parallelizable...

    First you call me naive, then you question formal logic. As a fan of mathematics I'm gonna just stop writing now before I say something rude.
  • 0
    @ThatTallNerd

    Throughput. How much do you get done. Tasks, user stories, epics.

    Happiness seems highly irrelevant since you can't prove one over the other. Haskell could make you more depressed on average.
    Happiness seems to subjective.

    There's research on how to measure quality but if it was good then we'd have a good metric. I guess how many edgecases you cover and pass in tests can be a good indicator atleast.

    How it goes through QA. How many issues, where they basic mistakes that could have been caught in the compiler maybe?

    Is that an ok answer?
  • 0
    @PetarP That was one assumption out of 9.

    Machinecode isn't Unhackable by a long shot. And there are other reasons to not develop in it. Usually it's because the compiler is better at writing that for you than you are.

    Btw, all code become machine code. So it's like saying. This vulnerable software isn't vulnerable because it's machine code 😐

    I would suggest you read about Werner Cipher. It's a mathematically proven uncrackable cipher which is super fast.

    And then you think about why we don't use it ALL the time.
  • 1
    It's already been brought up that developing with functional languages is quick. Happiness isn't irrelevant, if developers are happy using a language, there's probably reasons why, and these reasons have been brought up but you don't seem to want to accept answers :/
  • 0
    @ThatTallNerd All that you have done is to confirm that it's just another language and there isn't really anything particular to it.

    Now, it might be. And I might be wrong. But fast or faster doesn't mean anything without a comparison. It's like.

    Hey, I'm an awesome dev. You should hire me because I'm faster.

    Faster than what?

    But yeah. I'm not convinced why haskell is anything special. I might be wrong as hell though. But I've heard nothing to change my mind.
  • 1
    It's a whole different approach to thinking and approaching problems, the only thing that's going to change your mind is actually trying it
  • 0
    @ThatTallNerd I might try it out if I get some time for it and come up with any suitable project. I know you didn't say you did a lot of Haskell. But do you have any tips for tooling? Any package manager or so?
  • 1
    @BigBoo I read through the whole thread. Still can't really find a way to justify using Haskell over something like C++(for example) it seems like you and me might be missing on something great yet we really can't see anything great from what others say.

    Normally, some languages justify being used over others for certain things. But for the life of me I can't see the niche in Haskell.

    Language research maybe?
  • 0
    @AleCx04 Also felt like a lot of my questions went unanswered. For example, I still have no clue if the tooling is good or shit. 🤷‍♂️
  • 0
    It's "unhackable" in a sense that the program does 100% what it is supposed to, essentially totally bug-free. I don't think there is anything similar available for main stream languages.

    Honestly, for me the reasons to try Haskell were conciseness and much higher level of abstraction than anything in popular languages.

    Re-usability in FP is actually true, not like in OPP where is everything in practise so coupled and riddled with side effects to a point it's easier to rewrite it from scratch.

    For tooling, you might want to check Stack (handles packages, project setup), I don't recommend using Cabal. But I am not sure you should be trying getting into Haskell, because it's very hard for people who are enthusiastic about it, while you seem determined to fail just to "prove" Haskell is bad.
  • 0
Add Comment