Do people actually like this weird shitty language?

Do people actually like this weird shitty language?

I've been looking into it online and I have no idea what this would be used for or what someone would find appealing about it

Other urls found in this thread:

web.cecs.pdx.edu/~apt/cs457_2005/hudak-jones.pdf
github.com/haasn/hsbooru
github.com/haasn/heroline
github.com/haasn/-/blob/master/server.hs
github.com/haasn/DiabloM6
github.com/haasn/random_haskell_stuff
aosabook.org/en/posa/warp.html
hackage.haskell.org/package/discrimination-0.2.1/docs/Data-Discrimination-Sorting.html
github.com/inorichi/tachiyomi)
stackoverflow.com/questions/36927169/ml-modules-vs-haskell-type-classes.
downloads.haskell.org/~ghc/master/users-guide/lang.html
circleci.com/blog/why-were-no-longer-using-core-typed/.
twitter.com/NSFWRedditImage

thats because you are not smart.

>weird shitty language
Sucks to be dumb.

this is the same attitude that got donald trump elected

I'm ok with that.

That's ok. It's not for everybody. Stick with the ones you can understand.

I am tho

Try a Hitler analogy for more (You)'s.

>Do people actually like this weird shitty language?
Yes.
>I have no idea what this would be used for
Mostly for saying you wrote something in it. For CS profs/grads it is useful for modelling ideas and systems that they design on paper.
>What someone would find appealing about it
The type system abstractions are very nice, it makes generic programming a lot easier to reason about. Again it is for Computer sic Information Science people, they don't care how computers _actually_ work, they just want to model the pure logic their field depends on.

I'll also mention it's really good for complex math, especially when you venture outside of the high school/college freshman "algebra" and calc.

>I've been looking into it online and I have no idea what this would be used for or what someone would find appealing about it

Types and type classes, abstract data types with built in pattern matching, static typing, polymorphism, first class functions, monads, lazy evaluation.
Also functional languages can make the programmer more efficient.
See this case study:
web.cecs.pdx.edu/~apt/cs457_2005/hudak-jones.pdf

>Do people actually like this weird shitty language?
Yes. Once you get to learn it, it's neither weird nor shitty.

To me, non-Haskell languages are weird and shitty. It's all a matter of perspective.

agreed, just try simply transposing a matrix in any object oriented language.
then do it haskell.
the haskell code will probably be a lot easier.

I like it but I was using it only for small toy projects. It's good to know the basics of FP if you're a programmer.

I use it for my day-to-day scripting and computation. I use it for almost everything I do, although I'll fall back to other languages for when I want to use C libraries that don't have Haskell bindings already.

Some examples of projects I recently wrote in Haskell, if you want an idea of kinds of things I apply it to:

github.com/haasn/hsbooru (gelbooru scraper based on xapian)
github.com/haasn/heroline (DPS simulator and brute-force optimizer for Hero Line wars)
github.com/haasn/-/blob/master/server.hs (server-side component of my personal file hosting service)
github.com/haasn/DiabloM6 (M6 sentry DPS simulator for Diablo 3)
github.com/haasn/random_haskell_stuff (large dump of little files that didn't make the cut for their own repo)
and more stuff like that

Usually small 1-file projects, and anything there the answer to my question requires more code than just a few lines. Everything else I do interactively in GHCi, from simple mathematical expressions to more complex evaluations.

GHCi is pretty much my go-to calculator for day-to-day computation.

I hope that gives you some insight as to what Haskell that is actually used in the real world looks like.

I understand Haskell reasonably well.
But I can't say I don't like it, rather I'm not impressed.

>it's really good for complex math
You mean Coq or Mathmatica right? No mathematician I know uses Haskell.

Recursion is easy
Good type systems are a blessing
Immutability is actually just fine

I'm currently reading Learn You a Haskell.
For some reason, it all makes sense. Though, I'm still at the 'Syntax in Functions' chapter.

As for why I like Haskell, it just makes everything so easy - in the way that it actually makes development faster (unlike e.g. python which really cripple your efficiency)

For example, to make the gelbooru scraper that I mentioned scrape pages concurrently instead of one at a time, I had to change

retry retryCount $ scrapePage

to
forConcurrently [1..n] $ retry retryCount . scrapePage


(And unlike python, I didn't have to test the program 10 times and debug various runtime type errors until it worked)

Do you know how fast Haskell is?
Is it Python fast? Or more like Java?

I'd say it's about as fast as Java in practice

Would you write a web application or any long-running service in Haskell? I appreciate that it has the most advanced type system in a somewhat mainstream language (that is not a mess like Scala's) but I can't get over the fact that it's lazy. I haven't used it much but I'd expect it to gobble up memory due to subtle programmer errors. Am I wrong?

Disclaimer: It depends very strongly on how much you're willing to optimize your code

“elegant” one-liners can be stupidly slow (python-tier), but optimized haskell can be stupidly fast (faster than C).

Like most things, it depends strongly on how much effort you're willing to make it fast. But GHC is a low-level compiler that directly targets machine code, so there's no runtime interpreter overhead.

Also, most of the haskell features are static only, like the entire type system, meaning it has no runtime cost at all.

What are some good resources for learning Haskell?

>No mathematician I know uses Haskell.
Do you know any mathematicians who use Coq? In my six years as a math major I never met one.

>optimized haskell can be stupidly fast (faster than C).
That's incorrect. (If you did comparisons yourself, then you did something wrong in C.)

>faster than C
Yeah I doubt that.

In practice I almost always write strict-by-default Haskell. In GHC 8's terms, this would mean turning on the Strict and StrictData extensions. This is usually not only better for memory use but also performance. I also agree that laziness-by-default makes for nice and elegant theory but not the best programs in practice.

As for memory leaks, Haskell is garbage collected - so a memory leak in Haskell is pretty much equivalent to a memory leak in other garbage collected languages, meaning you left around a reference to some big chunk of memory you no longer need.

Fortunately, since haskell is entirely pure and and lexically scoped, it's much harder to leave around references, because all resources are generally tied to their scope unless you're using some sort of mutatable state. I wouldn't worry too much about memory leaks in long-running services, but I would worry much more about memory *inefficiency* (e.g. large thunks and poor in-memory representations)

Strictness helps for that, as does using the right datatypes (e.g. Text instead of String for anything where you care at all about memory use)

aosabook.org/en/posa/warp.html is an example of where Haskell ended up faster than equivalent C, due to Haskell's inherent ability to reuse shared data in a 0-copy manner.

In the nginx version, a copy was mandated not by any language architectural reason, but simply due to not knowing what the downstream functions are going to do with data. Basically, the fact that you can pick more powerful abstractions in Haskell lets you cascade information about what is and isn't required, which you struggle doing in less powerful languages.

The thing to realize when talking about languages being faster or slower is not necessarily what's _possible_ in that language. Of course you can take any optimized x86 fragment and transliterate it to compiler intrinsics in C to get the exact same runtime as any other language. But that's not the point.

The language is a fad for hipsters. It's useless in production on real machines.

The point is comparing _idiomatic_ code written in a given language. And often, C's idioms mandates inefficient code due to code simplicity reasons (where the more efficient algorithm would be very difficult to implement correctly in C)

As a C programmer myself, I'm fully aware of how many sacrifices I have to make when writing real-world, complex C programers - because the language is so shitty and unsafe that you need to be extremely careful about what you do.

Very often, that means taking a hit in code runtime just to make sure you're doing the right thing. For example unnecessarily freeing and reallocating resources during a reinitilization, copying around data even in cases where downstream would only use it in a read-only manner, or recomputing shared state just to avoid having to synchronize the results.

Also, another thing to never forget is how stupidly easy Haskell makes parallel computation and concurrency, which alone can be a big boost to your performance where doing the equivalent in C would require lots of complicated pthread API usage, synchronization overhead, thread spawning / governing logic, and more annoyances.

in what language is this not trivially implementable as a nested loop?

it is great for circlejerking

Why don't they use python? The way python is written is almost syntactically the same as how math is written and it's got great math libraries

could any haskell bros post online learning stuff? already reading LYAH.

I mean fast as in: suitable for general purpose applications (web servers, scrapers etc.).
I'm a Java (Android) developer, but I don't like the syntax. It mostly boils down to being too verbose. The same goes for C++. Python is cool, but is too slow. Rc is meh. You pay too much for memory safety. I don't know about D though. It looks OK, but it doesn't wow me. Go is a complete joke.
So my bet is now on Haskell as a comfy language that I can use for my pet projects.

work through the typeclassopedia.

>you struggle doing
You don't struggle in C. It's just laziness.
You can't benchmark languages by comparing complex pieces of software because they depend on decision of the design: the bigger software is, the stronger they depend.

On the other hand, analyzing how data model of the language is translated to machine code is much more enlightening.
Haskell must be slower, than C, because it endows each data type from the default kind with an additional value. That means every top-level function operates on boxed data and returns boxed data which incurs a performance penalty.
Polymorphism is implemented the same way as c++'s virtual functions. That's passing pointer tables around. Not the fastest way, but probably, the only possible with separate compilation.

>I mean fast as in: suitable for general purpose applications (web servers, scrapers etc.).
Most general purpose applications are not at all computationally intensive, and most people scale horizontally instead of trying to micro-optimize their code either way.

That said, I wouldn't try and write HEVC decoder in Haskell, for example. I would do that in x86 assembly and call it _from_ Haskell. Same for most low-level performance intensive stuff. If you need some particular algorithm done very efficiently, you can write it in optimized C and call it from higher-level Haskell very easily.

As for whether people run web servers in Haskell, they sure do. That seems to be one of the most popular ways to use Haskell in practice, actually. (Judging by how many web server-related questions from newcomers in #haskell I see)

Look up warp, yesod, snap, happstack, scotty, etc. to name-drop a few.

>So my bet is now on Haskell as a comfy language that I can use for my pet projects.
The important thing to realize about Haskell is that if you're a primarily imperative-learned programmer (which judging by your language list it's safe to say you are), you don't want to approach Haskell as “just another language”, since it will be your first time doing functional programming at all. You have to approach it as a completely new world view and way of thinking about problems.

Had you already mastered the art of functional programming, Haskell would become “just another language” to you, but that's something you can only realize in hindsight. Anyway, if you want to learn Haskell, forget about everything you know about programming and approach it from a fresh point of view.

i studied it in college (i mean, functional programming using haskell, not haskell itself, as always in college the language is just a tool to learn a concept) and damn its the best. its so much more interesting to solve problems with that than with the usual programming style

for some reason normies hated the shit out of it, but if you're smart its very interesting

>You don't struggle in C. It's just laziness.
I don't really see a difference between the two. If something is difficult to do, then it's difficult to do. Doesn't matter whether you want to call it being too lazy to go the roundabout way, or whether you want to call it the language being difficult - the net effect is the same.

When I write C, and I'm not a new C programmer by the way, I routinely struggle doing basic things over and over again. It's the curse of any low-level language. The less you get from the language, the more you have to do yourself - and due to the low abstraction ceiling I often find myself doing it over and over again. It just gets tiring, and since my time and energy budget is limited, that means I end up doing less than I could do in another language for the same amount of effort.

I realize that C is _capable_ of some amounts of abstraction, in the sense that you can pass around void* and function pointers, but the problem is that the cost of shoehorning your problem onto these abstractions is usually just as high and annoying as the cost of reimplementing your data structure or whatever from scratch every time.

Plus, by using void* you often lose something in exchange, for example safety (is my pointer cast safe? What pointer was this originally? Can I guarantee that? etc.) or even performance (since the compiler can't readily inline your comparison function or whatever).

Haskell comes pretty close to the dream of “write once, reuse all the time”, which many other languages fail at in a variety of different ways. (For example, enterprise Java fails in the sense that reuse and generalization are both extremely verbose and often require hacks to shoehorn it into the type system, which is why you get abstractboilerplatefactory nonsense)

For an example of just how powerful Haskell's abstraction ceiling is, this library implementants O(n) sorting and grouping for arbitrary (algebraic) data types:

hackage.haskell.org/package/discrimination-0.2.1/docs/Data-Discrimination-Sorting.html

What other language gives you a sort :: Sorting a => [a] -> [a] function that works in O(n) time no matter what ‘a’ is?

Enjoy your free performance boost out of using this library instead of the standard O(n log n) comparison sorts.

tl;dr lol

It parametrized only by one method.
Just write it in C and pass a function pointer.
Not impressed.

If you want to understand why things aren't as easy as you make it sound, feel free to write the same in C. I'll wait.

>Most general purpose applications are not at all computationally intensive, and most people scale horizontally instead of trying to micro-optimize their code either way.
That's true, but it's 'free' performance you get by simply using another language. Obviously, it doesn't justify rewriting an entire codebase, but it could be a good selling point when starting a new project. Aside from Google shilling, that's why Go gains so much traction. It's much faster than Python, and as long as you have all the libraries you need, so why not use that?
>As for whether people run web servers in Haskell, they sure do.
It makes sense to me writing a REST API in Haskell. Properly implemented, those applications are stateless. The database determines the state.
>you're a primarily imperative-learned programmer
That's correct. The most FP I've done, is in Rust.
Obviously, I can use Python for all my work, but I want a challenge. I'm a professional code monkey, so I want some challenge when I work on my own projects.

>transposing a matrix
I thought you said high level math.

And in OOP a matrix transpose is as simple as returning .get(j,i) instead of .get(i,j)

A few other options for you to consider:
1. Practical today
- Kotlin - it's an improved Java with a better syntax
- Elixir specifically for web/socket stuff
- OCaml, which is like a working class Haskell
2. Give them a year or two
- Swift - a well-rounded curly brace language with generics, etc. Unlike D it stands a chance in the market.
- Nim - a fast, statically typed language somewhat like Python
- Crystal - a fast, statically typed language a lot like Ruby

And that's your argument?

Haskell won't be a challenge to your ability to write code per se (in fact, the goal of Haskell is to make it *easy*, not hard) - but Haskell will be a challenge to your ability to break the mold and think from a new perspective.

And that will be a great benefit to any programmer who succeeds in doing so. Prolog would be another good language to try and learn, simply for its didactic purpose (forcing you to think outside the imperative box)

>Kotlin
I'd like to use that language in a new Android project if my boss allows it. I know Tachiyomi (github.com/inorichi/tachiyomi) and the PostNL apps are written in Kotlin. The syntax looks familiar and it looks a lot better than Java.
>Swift
I don't know about that one. One of my coworkers told me it's a pain in the ass to work with because the spec keeps changing.

I'll look into the other programming languages, thanks. I know that FFTW is written in OCaml and the rest I know by name.

I meant with challenge, the change of mindset you need in order to write Haskell compared to imperative programming languages.
Captcha: negro spencer

Personally I don't think OCaml is really worth learning, especially not as your first FP language. Haskell is much more modern and advanced than OCaml, which is limited by its object-oriented shoehorning

It will also be 10000 times slower unless you're using mutable array libraries which are a mess in Haskell.

you have to learn to look for resources
try haskell.org

> muh category theory

Haskell is for "elitists" that like to pretend they're mathematicians. Actual mathematicians working in the field don't ever use Haskell.

Much closer to Python than Haskellers like to admit. They rarely benchmark things properly though so they don't usually get exposed like Snap and Yesod did.

I use Haskell and I have no idea of category theory doe

Pretending Haskell is for category theory elitists is for “elitists” that like to pretend they're computer scientists

>is an example of where Haskell ended up faster

That paper was debunked and nobody can reproduce the results. Odd that actual Haskell web servers and web frameworks are Python/Ruby tier in terms of speed.

>claims Haskell is not sufficietnly benchmarked
>claims to know how Haskell performs in the real world
one of these contradicts the other. which is it, shitposter?

>debunked
got a link for that?

Techempower Web Frameworks benchmarks and the Debian Benchmarks Game (before Haskell faggots rewrote everything using the FFI) basically prove that Haskell is not a fast language.

>claims Haskell is not sufficietnly benchmarked

The claim is that benchmarks by Dons and other Haskellers aren't reliable. Remember when Snap and Yesod were incredibly fast? Where are those Haskellers now that everyone knows they're both slow as shit? Neither of them could even handle file uploads without leaking memory for years. Pathetic.

I literally don't see how, it feels so primitive. There's not even a for loop.

>Remember when Snap and Yesod were incredibly fast?
No

I always remember snap being a shittier version of warp and yesod being a gigantic bloated clusterfuck

Just trust me, it's debunked.

Odd, people who wrote a language based on their needs, decided to use preexisting tools that meet their needs when available? That's not odd, that's sensible. People who demand everything be done in their favored language are generally idiot fanboys, or insane zealots.

>Just trust me you dumb fucks
“okay”

> Haskell web server 10x faster than C web server that is used by almost every major company/website on the planet!

Google is hard. Even Dons doesn't try to defend this shit anymore.

>your first FP language
IMO nothing beats Standard ML for that.
>limited by its object-oriented shoehorning
How? Most projects written in OCaml ignore its object system and it causes them exactly zero issues. It is not Scala where inheritance messes with the type inference or anything like that.

As for Haskell being more advanced over all (especially when it comes to concurrency and parallelism), I agree, but mind that ML modules have one major advantage: stackoverflow.com/questions/36927169/ml-modules-vs-haskell-type-classes.

>that answer
Modern Haskell can actually pretty much do all of this, e.g. that Monoid example particular can be solved using ‘constraints’ and ‘reflection’ (haskell packages)

e.g. letting you write code like
withMonoid (+) 0 $ mappend 3 5


The thing to realize about Haskell is that it moves stupidly quickly. every single GHC version brings new and advanced features with it. With the advent of GHC 8, for example, Haskell even killed off the distinction between types and kinds - it's now pretty much almost a fully dependently typed language (like idris or agda), lacking only dependent pairs

>kotlin
what a useless fucking language. Like, Scala offers a seamless integration of OOP features with the purely functional ones, Clojure is a functional lisp that just werks out of the box, and this abomination?
>its jus bettur java wid bettur sintacs
yeah, fuck off you russian intellij marketer

haskell is a meme

Kotlin compiles faster, has no implicit conversions and uses Java's stock collections. Also note that its primary competitor is Android's freak fork of Java 6, not Scala.

>With the advent of GHC 8, for example, Haskell even killed off the distinction between types and kinds
Whoa.
>The thing to realize about Haskell is that it moves stupidly quickly
No kidding. Do major releases break old code badly?

Why is there a need for yet another JVM language? I mean, what's the niche?

Because Scala is a mess and a lot of Android developers would prefer to work in something better than Java 5.

and what about clojure?

Dynamic typing is a mistake and it uses far too much memory for serious Android development.

But it gives you an ungodly amount of flexibility in your code. The slow startup is a bitch though, the author is working on it.

>Dynamic typing is a mistake
True. If it's your thing Clojure is one of the best dynamically typed languages if not the best one but everyone who enjoys Clojure should check out statically typed FP.

...

>No kidding. Do major releases break old code badly?
No, because it's hidden behind 100 billion language extensions

There are a few breaking changes to major versions, but they are usually changes that were announced years earliar and hardly break production code

For example, Applicative was made a superclass of Monad after many years of deliberating and advance preparation

Startup time is just one serious problem. The biggest issue is that it generates too much garbage at runtime to be used for Android development. Clojure apps tend to be really memory hungry and they spend much more time in garbage collection than Java and Kotlin.

Java apps rarely spend more than 4-5% of their runtime on garbage collection. Clojure apps are basically always 20-30% or slightly more.

...

Thanks, user. You've convinced me to give Haskell another look.

re: 100 billion language extensions

downloads.haskell.org/~ghc/master/users-guide/lang.html

Typing is just a way to validate your variables - and to tell the compiler how to optimize your code. To validate stuff clojure uses specs, which are currently in the beta release. While, for the compiler optimization - well, it has a lot of type inference going on (that eliminates the problem of Integer and int present in java, for instance) and the complex types are java code anyways (take any object from any java API as an example). If properly optimized, clojure is almost as fast as java itself.
I'm currently work on the development of a server-side app in clojure. We've not yet at the optimization part, but we're getting there; will post results then.

I'm pretty sure was pointing out GC pressure as a problem on Android, not so much the server.

Yeah, but it's always about the JVM. Which is the main reason any fucking android phone ever has a stupid amount of RAM (2GB on a 2014 nexus 4...)

It's not nearly as much of a problem on the server. You usually have a lot more memory to work with, the memory is faster, and the Oracle JVM garbage collector is significantly faster than Android's especially when it comes to the short lived objects that Clojure tends to create. You'll notice that Clojure still spends more time in garbage collection that you're typical Java app but not so much that it's a problem.

Haskell threads are the best. They are like an alternative really Sup Forums (or /prog/).

see It's about the JVM - even if you have dalvik (now ART, I suppose) and I have the official oracle one.
By the way, you're right about GC not being a problem in the application I'm working on - but apparently clojure is not trying to target mobile devices, so probably it's not really usable on them without any kind of preprocessing.

so concurrency and parallelism are off the charts in haskell?

anyways, how do I into gui

I had hopes for core.typed but apparently it's a pain in the ass.

circleci.com/blog/why-were-no-longer-using-core-typed/.

can somebody walk me through the applicative instance of ((->) r)

Sure

First thing's first, do you understand the functor instance?

I learned C#, Haskell and C++ in university.
I liked learning Haskell and had a ton of fun doing the practicals. Had a lot of those moments where everything suddenly clicked. Since I'm more interested in game development I now pretty much only still use C++, but learning Haskell definitely made me a better overall programmer. Just gives you a radically different perspective on programming languages which is very valuable.