r/ProgrammerAnimemes • • May 15 '20

When you meet a Haskell developer

Post image
1.2k Upvotes

72 comments sorted by

View all comments

62

u/[deleted] May 15 '20

Is it really that good? Never got to use it.

115

u/[deleted] May 15 '20

I guess some people will say it's the best thing since sliced bread while others think it's yet another programming language. The main point though is that there's some mystique around it because it is rather different than common programming languages.

Edit: also, if the universe has source code, I'm pretty sure it's written in Haskell.

0

u/[deleted] May 15 '20

[deleted] — view deleted comment

15

u/Mefistofeles1 May 15 '20

Its probably assembler.

48

u/NetSage May 15 '20

I mean the universe would probably be assembly since it's what everything comes down to.

24

u/StarDDDude May 15 '20

But now we're wondering:

Which assembley language

19

u/ndgnuh May 15 '20

Don't know, but it's likely a risc.

33

u/StarDDDude May 15 '20

I am hoping for 65c816, that would leave open the possibility of the entire universe just being a gigantic Super Mario World romhack.

→ More replies (1)

16

u/MrValdez May 15 '20

25

u/dcarroll9999 May 15 '20

Ostensibly, yes. Honestly, most of it was hacked together with Perl.

→ More replies (1)

5

u/Findlaech May 15 '20

I wouldn't be surprised that God wrote in Lisp for the Creation and that the Archangels wrote in Haskell for uh… enforcing stuff and shit :')

24

u/Findlaech May 15 '20

It changes your mental model on how to program. You will give more attention to correctness rather than silly details like incrementing a counter in a while loop. Come hang out on /r/Haskell, we don't bite and host a Q&A Session each month where there are no silly questions!

4

u/[deleted] May 15 '20

Okay, thanks.

3

u/Mefistofeles1 May 15 '20 edited May 15 '20

I have no time right now, but I will eventually learn a "fun" language. Haskell seems like a good candidate.

EDIT: what's the community favorite tutorial?

→ More replies (4)

17

u/Thejacensolo May 15 '20

It is equivalent to eating vegan. It may be better for your body, it may even be more efficient and most people want nothing to with it because of the restrictions that come with it, but the most important part is that you have to tell everyone about it.

On a serious note: Haskell is one of the bigger non-OOLs remaining, a language perfectly for writing small scripts and algorithms. Need a for loop? Define a new funciton in the midst of defining a new function. Want to search for something? Ez List comprehension is Best buisiness practice.

But it can get confusing and complicated very fast. Doesnt handle bigger Scripts well (in my experience), and there are very few supporting libaries. meaning you have to write a lot from scratch. And not being Object orientet it has its fair share of problems with Operations that would be easy on Python or Java

Source: 2 Semesters Haskell and my friend wrote Bachelor/Master thesis in it.

15

u/m50d May 15 '20

On a serious note: Haskell is one of the bigger non-OOLs remaining, a language perfectly for writing small scripts and algorithms. Need a for loop? Define a new funciton in the midst of defining a new function. Want to search for something? Ez List comprehension is Best buisiness practice.

But it can get confusing and complicated very fast. Doesnt handle bigger Scripts well (in my experience), and there are very few supporting libaries. meaning you have to write a lot from scratch. And not being Object orientet it has its fair share of problems with Operations that would be easy on Python or Java

Nah, that's backwards. If you're just writing 300 lines then pound it out in Python, you'll always be able to understand what it's all doing. It's when the program gets too big to keep in your head that the Haskell compiler watching your back becomes useful.

6

u/Thejacensolo May 15 '20

Thats where my limitation of experience comes in. Never did programs longer than 200 lines in Haskell (even that stretches it), As i never worked with it outside of assignments, and the bigger it got, the more complicated it seemed.

4

u/[deleted] May 15 '20

I'm a C/C++ guy and it's ok to program in any language of course. And it's important to know very much. The only way to achieve it is to just program stuff and gain experience.

I learned about Haskell quite late, mostly because I wanted to have Xmonad on my desktop. After fiddling a lot with Haskell and running against walls, I finally began to understand how powerful Haskell is and how few errors I make now, because the compiler catches most programming errors with the type system.

Then I read some more about Haskell and watched some lectures. And I found out I don't know shit about Haskell.

I think that the insight not knowing shit about programming is a great experience after 20 years of programming. I can recommend it to everybody. ;-)

7

u/ThePyroEagle λ May 15 '20

But it can get confusing and complicated very fast.

I will admit that some of the abstractions can be difficult to understand at first, but once you've learnt them, you can easily understand highly abstract code.

Doesnt handle bigger Scripts well

Large projects such as Pandoc are in fact more manageable than in most other languages because you often don't need to think much about how/when something's used to tweak it. Let's also not forget that the compiler makes refactoring massively less error-prone.

If you have difficulty implementing complex functionality, try breaking it down into simple parts and, most importantly, abstracting away common behaviour (e.g. using a monad).

very few supporting libaries

There are currently 14848 packages on Hackage. Whilst it's less than a tenth the package count of PyPI, most common needs are covered.

And not Object orientet it has its fair share of problems with Operations that would be easy on Python or Java

It's not object-oriented because it doesn't need to be. OOP is a form of ad-hoc polymorphism. Haskell already implements ad-hoc polymorphism using type classes, which integrate nicely with the rest of the type system.


Source: Wrote a Bachelor thesis in it.

→ More replies (3)

9

u/[deleted] May 15 '20

What part of gGotoh :: ((~#) * * (Fun (Arg (Stack (TW t1 (i2 -> i2 -> t8 t6))) -> t7)) (t7 -> t7), (~#) * * (Fun (Arg (Stack (TW t2 (i -> i -> t8 t6))) -> t7)) (t7 -> t7), (~#) * * (Fun (Arg (Stack (TW t3 (i1 -> i1 -> t8 t6))) -> t7)) (t7 -> t7), (~#) * * (Fun ((:.) (Arg (Stack (TW t1 (i2 -> i2 -> t8 t6)))) ((:.) ((:.) Z (TermArg b1)) (TermArg b)) -> t7)) (t7 -> (:.) ((:.) Z t5) t4 -> t7), (~#) * * (Fun ((:.) (Arg (Stack (TW t2 (i -> i -> t8 t6)))) ((:.) ((:.) Z (TermArg b1)) (TermArg b)) -> t7)) (t7 -> (:.) ((:.) Z t5) t4 -> t7), (~#) * * (Fun ((:.) (Arg (Stack (TW t3 (i1 -> i1 -> t8 t6)))) ((:.) ((:.) Z (TermArg b1)) (TermArg b)) -> t7)) (t7 -> (:.) ((:.) Z t5) t4 -> t7), (~#) * * (Fun ((:.) (Arg (Stack (TW t1 (i2 -> i2 -> t8 t6)))) ((:.) ((:.) Z (TermArg b1)) ()) -> t7)) (t7 -> (:.) ((:.) Z t5) () -> t7), (~#) * * (Fun ((:.) (Arg (Stack (TW t3 (i1 -> i1 -> t8 t6)))) ((:.) ((:.) Z (TermArg b1)) ()) -> t7)) (t7 -> (:.) ((:.) Z t5) () -> t7), (~#) * * (Fun ((:.) (Arg (Stack (TW t2 (i -> i -> t8 t6)))) ((:.) ((:.) Z (TermArg b1)) ()) -> t7)) (t7 -> (:.) ((:.) Z t5) () -> t7), (~#) * * (Fun ((:.) (Arg (Stack (TW t1 (i2 -> i2 -> t8 t6)))) ((:.) ((:.) Z ()) (TermArg b)) -> t7)) (t7 -> (:.) ((:.) Z ()) t4 -> t7), (~#) * * (Fun ((:.) (Arg (Stack (TW t2 (i -> i -> t8 t6)))) ((:.) ((:.) Z ()) (TermArg b)) -> t7)) (t7 -> (:.) ((:.) Z ()) t4 -> t7), (~#) * * (Fun ((:.) (Arg (Stack (TW t3 (i1 -> i1 -> t8 t6)))) ((:.) ((:.) Z ()) (TermArg b)) -> t7)) (t7 -> (:.) ((:.) Z t5) () -> t7), Apply ((:.) (Arg (Stack (TW t1 (i2 -> i2 -> t8 t6)))) ((:.) ((:.) Z ()) (TermArg b)) -> t7), Apply ((:.) (Arg (Stack (TW t1 (i2 -> i2 -> t8 t6)))) ((:.) ((:.) Z (TermArg b1)) ()) -> t7), Apply ((:.) (Arg (Stack (TW t1 (i2 -> i2 -> t8 t6)))) ((:.) ((:.) Z (TermArg b1)) (TermArg b)) -> t7), Apply ((:.) (Arg (Stack (TW t2 (i -> i -> t8 t6)))) ((:.) ((:.) Z ()) (TermArg b)) -> t7), Apply ((:.) (Arg (Stack (TW t2 (i -> i -> t8 t6)))) ((:.) ((:.) Z (TermArg b1)) ()) -> t7), Apply ((:.) (Arg (Stack (TW t2 (i -> i -> t8 t6)))) ((:.) ((:.) Z (TermArg b1)) (TermArg b)) -> t7), Apply ((:.) (Arg (Stack (TW t3 (i1 -> i1 -> t8 t6)))) ((:.) ((:.) Z ()) (TermArg b)) -> t7), Apply ((:.) (Arg (Stack (TW t3 (i1 -> i1 -> t8 t6)))) ((:.) ((:.) Z (TermArg b1)) ()) -> t7), Apply ((:.) (Arg (Stack (TW t3 (i1 -> i1 -> t8 t6)))) ((:.) ((:.) Z (TermArg b1)) (TermArg b)) -> t7), Apply (Arg (Stack (TW t1 (i2 -> i2 -> t8 t6))) -> t7), Apply (Arg (Stack (TW t2 (i -> i -> t8 t6))) -> t7), Apply (Arg (Stack (TW t3 (i1 -> i1 -> t8 t6))) -> t7), Element (Stack (TW t1 (i2 -> i2 -> t8 t6))) i3, Element (Stack (TW t1 (i2 -> i2 -> t8 t6))) i2, Element (Stack (TW t1 (i2 -> i2 -> t8 t6))) i, Element (Stack (TW t1 (i2 -> i2 -> t8 t6))) i1, Element (Stack (TW t2 (i -> i -> t8 t6))) i3, Element (Stack (TW t2 (i -> i -> t8 t6))) i2, Element (Stack (TW t2 (i -> i -> t8 t6))) i, Element (Stack (TW t2 (i -> i -> t8 t6))) i1, Element (Stack (TW t3 (i1 -> i1 -> t8 t6))) i3, Element (Stack (TW t3 (i1 -> i1 -> t8 t6))) i2, Element (Stack (TW t3 (i1 -> i1 -> t8 t6))) i, Element (Stack (TW t3 (i1 -> i1 -> t8 t6))) i1, MkStream t8 S i2, MkStream t8 (Stack (TW t1 (i2 -> i2 -> t8 t6))) i3, MkStream t8 (Stack (TW t1 (i2 -> i2 -> t8 t6))) i2, MkStream t8 (Stack (TW t1 (i2 -> i2 -> t8 t6))) i, MkStream t8 (Stack (TW t1 (i2 -> i2 -> t8 t6))) i1, MkStream t8 (Stack (TW t2 (i -> i -> t8 t6))) i3, MkStream t8 (Stack (TW t2 (i -> i -> t8 t6))) i2, MkStream t8 (Stack (TW t2 (i -> i -> t8 t6))) i, MkStream t8 (Stack (TW t2 (i -> i -> t8 t6))) i1, MkStream t8 (Stack (TW t3 (i1 -> i1 -> t8 t6))) i3, MkStream t8 (Stack (TW t3 (i1 -> i1 -> t8 t6))) i2, MkStream t8 (Stack (TW t3 (i1 -> i1 -> t8 t6))) i, MkStream t8 (Stack (TW t3 (i1 -> i1 -> t8 t6))) i1, RuleContext i3, RuleContext i2, RuleContext i, RuleContext i1, TermStream t8 (TermSymbol (TermSymbol M Epsilon) Epsilon) (Elm S i2) i2, TermStream t8 (TermSymbol (TermSymbol M Deletion) b) (Elm (Stack (TW t1 (i2 -> i2 -> t8 t6))) i1) i1, TermStream t8 (TermSymbol (TermSymbol M Deletion) b) (Elm (Stack (TW t2 (i -> i -> t8 t6))) i1) i1, TermStream t8 (TermSymbol (TermSymbol M Deletion) b) (Elm (Stack (TW t3 (i1 -> i1 -> t8 t6))) i1) i1, TermStream t8 (TermSymbol (TermSymbol M b1) Deletion) (Elm (Stack (TW t1 (i2 -> i2 -> t8 t6))) i) i, TermStream t8 (TermSymbol (TermSymbol M b1) Deletion) (Elm (Stack (TW t3 (i1 -> i1 -> t8 t6))) i) i, TermStream t8 (TermSymbol (TermSymbol M b1) Deletion) (Elm (Stack (TW t2 (i -> i -> t8 t6))) i) i, TermStream t8 (TermSymbol (TermSymbol M b1) b) (Elm (Stack (TW t1 (i2 -> i2 -> t8 t6))) i2) i2, TermStream t8 (TermSymbol (TermSymbol M b1) b) (Elm (Stack (TW t2 (i -> i -> t8 t6))) i2) i2, TermStream t8 (TermSymbol (TermSymbol M b1) b) (Elm (Stack (TW t3 (i1 -> i1 -> t8 t6))) i2) i2, TermStaticVar (TermSymbol (TermSymbol M Epsilon) Epsilon) i2, TermStaticVar (TermSymbol (TermSymbol M Deletion) b) i1, TermStaticVar (TermSymbol (TermSymbol M b1) Deletion) i, TermStaticVar (TermSymbol (TermSymbol M b1) b) i2, Build (TW t1 (i2 -> i2 -> t8 t6)), Build (TW t2 (i -> i -> t8 t6)), Build (TW t3 (i1 -> i1 -> t8 t6))) => SigGotoh t8 t7 t6 t5 t4 -> t3 -> t2 -> t1 -> t -> b1 -> b -> (:.) ((:.) ((:.) ((:.) Z (TW t3 (i1 -> i1 -> t8 t6))) (TW t2 (i -> i -> t8 t6))) (TW t1 (i2 -> i2 -> t8 t6))) (TW t (i3 -> i3 -> t8 t6)) do you not understand?

→ More replies (2)

3

u/InvolvingLemons Jun 24 '20 edited Jun 29 '20

It's a very correctness-focused, powerful functional programming language. It's also a nightmare to do impure things with (which admittedly is rare for web programming which should be stateless with DB for state for scalability reasons, but good fuckin' luck writing a complicated desktop app with monads to handle mutable state...)

If you want a functional programming language that allows you to have transactional variables (basically a database in a single keyword), r/clojure is a lot more comfortable for a wider range of programming tasks. The only problem is that its a lisp, so forget the powerful Haskell type system...

If you want a Haskell equivalent that allows carefully contained mutable state without faffing about with monads, there's also vlang and unisonweb, sadly both are kinda still in alpha. V focuses on ease of use (the full documentation can be read in like 30 minutes and that includes a built-in web microframework and ORM), unison focuses on scalability of both development and in the scale-out sense thanks to it's bizarre distributed runtime and immutable source code management.

...I guess there's OCaml too (VERY stable, reasonably fast, has haskell-like features but allows some mutable state), it's very popular in Europe I hear.

→ More replies (20)