I’m new to programming, but I’ve been reading about tech for a while. I noticed that one language that gets mentioned quite often is Haskell. Could someone explain what’s the big deal with Haskell? Why do people push it so much? Trying to learn.

  • Ravn
    link
    10
    edit-2
    3 years ago

    In addition to my other comment (which is more about paradigms than Haskell in particular), I think the main draws of Haskell is that it’s the most well-known statically typed and pure functional language out there. It’s mature, has a reasonably large community and an OK ecosystem. (I say OK rather than good because it’s rather lacking in some areas like GUI bindings and gamedev but sort of makes up for it with solid “backend”-oriented libraries.)

    It strikes a nice balance of type safety, convenience and readability compared to other languages that feature more expressive type systems and safety guarantees, or impure and untyped functional languages which may be more “straight forward” to use but may bite you in more complex projects with hard to find IO- and type-related bugs.

    The syntax is clean and terse, reducing boilerplate and visual noise for reading and writing, letting you allocate your mental energy to the concepts and semantics more than the details of implementation and technicalities. You spend more time thinking than looking when reading source code, or typing while writing it.

    The type system is expressive enough to act as documentation in their own right (not to say they replace comments and actual documentation!), while also offering escapes for when you think yourself cleverer than the type checker, such as when an edge case really isn’t much of a problem, or when you know something makes sense but don’t wish to prove it.

    It’s lazily evaluated, which enables you to think less about the operational semantics and more about the concept you’re trying to encode. You can compose and chain operations on very large lists or sets without having to worry about the programme iterating over all of it and evaluating everything; it will only evaluate exactly what you need and no more than that.

    I would write more but I’ve procrastinated enough for today…