DEV Community

Discussion on: Switching to Haskell

Collapse
 
wrldwzrd89 profile image
Eric Ahnell

Mutable state is the bane of consistency - that is true! Haskell keeps it to a minimum? Then I should learn too... thanks, Trisha!

Collapse
 
rodiongork profile image
Rodion Gorkovenko

You may have happier time trying Erlang. It also has no variables :) so no mutable state. Nor loops. Very easy. But unlike Haskell it is not strictly typed so it is much easier to start coding without being swamped by monads.

Collapse
 
wrldwzrd89 profile image
Eric Ahnell

Hey, another reason to learn both Haskell and Erlang!

Collapse
 
gabrielfallen profile image
Alexander Chichigin

You might not be completely serious, but I feel compelled to say you're not doing justice to both Erlang and Haskell. :)

One (major) thing about Erlang is it models mutable state with process' state ("state on parameters" of recursive functions). Another thing about Erlang is it has very much traditional mutable state in the form of ETS tables which are employed very extensively in real production code (and I don't consider this a "bad thing").

And as long as you don't use state in Erlang in either form, you can do exactly the same in pretty much the same way in Haskell without monads anywhere remotely near.

Besides, strictly speaking Erlang is strictly typed, albeit dynamically. Dynamic typing is a minor shortcoming which is alleviated by Dializer. :)

And finally, using monads is simple! Even writing monads isn't hard though very rarely needed. Lenses is where all the fun begins and never ends! :D

Thread Thread
 
rodiongork profile image
Rodion Gorkovenko

Alexander, Hi!

I think I'm too stupid to understand most of the things you've mentioned :)

But I totally agree! It's hard for me to judge about either as I was not in any industrial project using Haskell - and the one with Erlang was too specific in many ways :)

is alleviated by Dializer.

I suspect it is about the tool "dialyzer"? I found this one and tried to make my colleagues using it. That was hard, mostly because dialyzer is still in far not excellent form. And as the language seems to be slowly dying, regretfully, no much hope it will be seriously improved.

And finally, using monads is simple!

Ah, all proponents of Haskell / Scala insist on something like this. Probably this simplicity is why so many articles and videos are trying their best to "explain monads in 5 minutes", generally failing to impress :)

Lenses is where all the fun begins and never ends!

I'd like to see what they will invent by next 10 years :)

Thread Thread
 
gabrielfallen profile image
Alexander Chichigin

I suspect it is about the tool "dialyzer"?

Yep, that's what I meant. :)
Last time I wrote in Erlang Dialyzer checking was built-in into VS Code plugin so I need no extra effort to reap its benefits. 🤷

Probably this simplicity is why so many articles and videos are trying their best to "explain monads in 5 minutes"

Actually you're exactly up to the point. :) People write the most about what's simple: "Write yourself a blog engine in PHP/RoR/Django", "Make an animation with CSS3", "Build a game with Unity". How many tutorials "write an intrusive concurrent AVL-tree in C" do you know? 😄

I'd like to see what they will invent by next 10 years

Unfortunately doesn't seem like much, Haskell is close to a "saturation point". The two biggest next additions to the Haskell are Linear Types and full-blown Dependent Types. The former were invented more than 30 years ago (at least Linear Logic was), the latter were invented almost 50 years ago and first implemented more than 30 years ago.

It's just most of programming languages still fail to improve upon Lisp that was invented more than 60 years ago... 😄

Thread Thread
 
rodiongork profile image
Rodion Gorkovenko

most of programming languages still fail to improve upon Lisp

Well, that's question what we define by "improvement". In the sense of business software development they improved thousand times. Not only about languages themselves, but about infrastructure around them.

Even Lisp split to zounds branches, warring to be more functional or more practical or both :)

However in the sense of the language structure, system of typization etc really progress is not impressive.

BTW, if you are curious about Haskell position - the company I mentioned is "Biocad". Check their HH - they are nice fellows and would be glad at least, I think. Though probably you know them already since Haskell world is tight enough :)

Thread Thread
 
gabrielfallen profile image
Alexander Chichigin

Well, that's question what we define by "improvement"

I meant in terms of language features and semantics as I'm kinda PL geek. :)
I totally agree infrastructure improved a lot.

BTW, if you are curious about Haskell position - the company I mentioned is "Biocad".

Yeah, I've figured that out. As you said

Haskell world is tight enough

😄

Thread Thread
 
trishaganesh09 profile image
Trisha

Thank you!

Collapse
 
trishaganesh09 profile image
Trisha • Edited

Hahaha, I use that every day. But I also use Kotlin.

Collapse
 
trishaganesh09 profile image
Trisha

Anytime!

Collapse
 
deciduously profile image
Ben Lovy

Not necessarily, it's a fact of life in most domains, but it does provide a rich toolkit for organizing and sequestering the mutable and effectful parts of your code.

Collapse
 
gabrielfallen profile image
Alexander Chichigin

Not necessarily, it's a fact of life in most domains

If you're referring to mutable state, then it's irrelevant whether it's a fact of life or not. Because in software development we're modelling real-life domains. And we can easily model mutable state with immutable data structures and pure functions. Surprisingly often it leads to both fever errors and simpler code.

Thread Thread
 
wrldwzrd89 profile image
Eric Ahnell

This is exactly why side effect-free coding by default is so valuable: it’s far easier to verify correct behavior.

Collapse
 
trishaganesh09 profile image
Trisha

True, but the good thing is that it requires a lot of focus as it is a hard language for most people.