I'm a self-taught and somewhat experienced programmer. Over the years I've worked with C, C++, Java, Python, Assembly, Pascal/Delphi and Javascript. I've never encountered any companies or open-source projects that used stuff like Haskell, Idris, Elm, Scheme, LISP...
I'm actually interested in picking up Haskell after reading up about it here. The syntax is so different from what I'm used to, it seems like it would be fun to learn.
I am nonetheless curious as to what the actual use cases for such languages are? Is it ever actually used outside of academia? What type of industries have a need for it and for what tasks? What are some projects that you've worked where you've used functional programming?
It's essential for problems where you need confidence about the exact behavior of your program and its side effects. As far as industries, I've seen it used in formal methods for static analysis (CPSA for example).
Luke Kelly
...
Nathan Barnes
Haskell is basically an academical point, it is really fast and it could be used in production, and some companies actually do use it, but is not as ubiquitous as any imperative language.
Why you should learn Haskell, or Functional Programming for that matter?
Functional programming forces you to think on what you are trying to build, while on Imperative programming your main object is how, the thing you are building, works. The intrinsic nature of the subject is usually not considered.
That might sound silly, but, at least for me that's where the true power of FP comes from, it allows us to usually make more elegant software architectures.
Benjamin Phillips
Haskell is really, really nice for writing Parsers. Make sure you check out the Parsec library. The parser monad illustrates the advantages of FP + monads for that particular problem domain very well.
Jeremiah Martinez
the point is javascript is a functional language
Josiah Harris
Would it be a better investment to get into Erlang than Haskell then? Since I would be getting some potentially valuable skills while still getting the hangs of FP
William Morgan
>Dev ops >Erlang Why ?
Mason Walker
Erlang is ok but in my opinion its syntax is too exotic. Check elixir as well.
Thomas Jenkins
I write embedded software for work, and I like Haskell a lot. It seems that in C-family languages there's a lot of writing boilerplate and too little thinking, while in Haskell is the opposite.
Zachary Nelson
>Animeposter >Exists Why?
Daniel Evans
The point is to make you a better programmer.
But basically there are two fundamental modles of computing, the turing machine (which is the blueprint for langauges like C Java and so on) and the Lambda calculus (which is the blueprint for functional langauges).
All in all differnt paradigms want the same thing: hide complexity. And complexety is always tied to "states", because for complex programs it's impossible to calculate all possible states for all possible input values. That's why for really big programms you need techniques like "fuzzing" where you throw random data at the programm and see if something terrible happens or not.
OOP tries to avboid complexity by tying data structures to its methods and thide them in "objects", make those objects communicate to each other, to keep side effects as isolated as possible.
Functional programming is trying to avoid side alltogether (or at lesst as much as possible) by using immutable data structures. A good example is the usages of map/filter/reduce instead of index variables.
Both paradigms have good sides and problematic sides. Functional programming makes it easy to add new functions/behaviour, but chainging the fundamental data structures is a pain in the ass beacuse you have to change a lot of methods. OOP makes it easy to change data stuctures (since they are usually hidden within an object anyway), but adding new functionality to a class can be very difficult since you also change the behavious of it's child classes and all other objects that interact with the object in question.
Isaiah Lopez
I know some erlang and haskell and I persoanlly prefer erlang.
I guess try both languages and see which one clicks
Evan Morgan
anime website
Dylan Myers
>What's the point of functional programming? Gives CS grads who haven't had a good career a reason to feel superior. What's the point of paying tens of thousands for a degree if every other developer can understand you when you talk? Functional programming is like a pen and paper. It's great for jotting down abstract ideas, showing off your math skills and illustrating how deftly you can manipulate symbolic notation. But when it comes to the practical side of of things it's almost useless.
Cameron Cox
well put.
Ryder Wilson
>Gives CS grads who haven't had a good career a reason to feel superior yeah no, people too dumb to do oop dont suddenly start doing fp because the steep learning curve and relative lack of material(learning, examples etc) makes it a lot harder than oop
Aaron Hill
>starting threads on g >trying to feel superior to your peers >joining the circle jerk
don't listen to the muh referential transparency and muh immutability, FP is about imposing your ego
good engineer -> good software shit developer -> shit software
it is that simple really, language choice is orthogonal
Andrew Martinez
>adding new functionality to a class can be very difficult since you also change the behavious of it's child classes and all other objects that interact with the object in question What is Decorator?
Jordan Thomas
It's a meme.
Landon Ortiz
Look into why Erlang was created and it's obvious.
William Moore
I second this. Can this become a non-anime website pls
Watch between 12:48 and 15:06, he explains when functional programming makes sense and when it doesn't.
Jose Roberts
I think it's easier for "dumb" people to learn OOP compared to functional. Look at all the enterprise Java code monkeys
Ryder Ross
thats what I said
Eli Martin
We've got one for you >>>/reddit/
Jayden Reyes
I'm not sure about haskell, but with erlang you can replace individual functions during runtime which is super useful for servers.
Parker Gomez
bump/
Luke Myers
Scala is doing pretty nice in production. His popular
Joseph Stewart
Sent before finishing the post. I was saying, its popularity is rising a lot, thanks to Spark/Kafka/Akka
Gavin Bailey
academia.
Nolan Butler
Good vid, thanks user.
Carson Ross
A lot of design patterns are work arounds for what functional programming makes easy to solve,
Evan Rivera
give examples or else
Jaxson Murphy
I'm guessing you've met a functional programming hipster, that's got to be a shit experience. We had someone like that at my work before I started, so when I go into learning functional programming everyone started to get really nervious.
But there's a balance and places that functional programming is very good at. I had to write a system that had to proccess a large amount of data that's difficult to work with. I wrote that part with functional principles in mind and it ended up being very successful, performant and understandable.
Functional programming is another tool in your toolbox for dealing with certain classes of problems. It's well worth understanding and to check what functional concepts your language supports.
If you want to catch someones attention you can't ask them to spend a whole hour to watch a video or much more time to read an entire book. Just make a quick example then, if it looks promising, I can dig for deeper and better explained source like the video and the book you've linked.
Aiden Morgan
Just look at one of the fucking examples in the blog post I linked. Jesus christ can't anyone pay attention for more than 10 seconds.
Carter Sanders
jesus christ, he does not have a fucking clue what functional programming is : >If they are writing device drivers or things of this sort, functional programming makes a lot of sense, because your domain of interest is the machine [...] bytes and bits, and circuits, and opcodes and things of this sort. And in that kind of a context, functional programming makes a huge amount of sense. But if you're writing a payroll program, it doesn't.
Andrew Perez
I apparently need to break this up into a couple of posts. (1/2) Professional Haskell programmer here (of 3 years? python before that)
Why do you like languages with compile time type checkers? Compared to dynamic languages, typed languages ease the burden of thinking real hard about how to write a correct program. In the early days of C++ or Java, since you had to tell the compiler most of the types, this seemed like a burden, but since then, most languages have come around to use type inference along with type checking, so you don't need to do quite as much data entry.
Haskell takes this concept as far as possible. Type checking in Haskell is by unification, and inference operates in the same step, so you can infer types in all directions (including return types) that are not possible in other languages. Haskell, being lazy by default, mostly requires purity (the technical term is referential transparency), so if there is a side effect in a function you'd like to call, that must be encoded in the type, rather than hopefully in the documentation. Haskell's type system has a few more bells and whistles that make it possible to type check more correct programs compared to C++ or Java, which can improve code reuse. Finally, type inference works in concert with the typeclasses feature of haskell which can, in effect, write a substantial fraction of your application for you, simply by deducing the unique instance that makes the types work (if it exists).
Asher Price
(2/2)
In many ways, programming in haskell, once you hit your stride, requires very little hard thinking; you usually write the types of a bit of your program you're working on, then just fill in the blanks reported by the compiler until the program works. There is the often repeated "if it compiles, it works", which has an uncanny truth to it. It often feels a bit like playing tetris or minesweeper. Stimulating but mechanical.
The downside of the above is that the abstractions you need to work in this typesystem are utterly alien if you're already familiar with basically any other programming paradigm. Monad transformer morphisms or the Coyoneda embedding don't have analogues in the object oriented universe you might already be familiar with.
Brody Taylor
yeah for payroll functional is still good.
things that involve a lot of user interfacing benefit from O.O. usually
Jordan Davis
Is Haskell good for web development?
Benjamin White
>don't know any functional programming but make 200k
Carter Thompson
No, use F# with .NET Core.
Parker Cook
Functional programming tends to support concepts like pure functions, first-class functions, and a typing system. Pure functions are just functions that have no side-effects. Basically, if I call this function with the same input it will give me the same output. First-class functions means that functions can be passed around like any other data type. This is useful for writing reusable functions. Functional programming languages also have sophisticated typing systems that let you build of complex data types and then write functions that operate on them.
Haskell is a purely functional programming language. Meaning that all data is immutable and there is no concept of state. This has some interesting implications. I'd say one of the largest right now is parallel programming. It turns out that OOP is pretty terrible for writing parallel and concurrent programs. OOP is all about abstracting away layers and hiding details from the user. This usually ends in some unexpected state. Sometimes people will hide details about mutexes and cause unintended deadlocks. With immutable data and no state you're guaranteed deterministic parallelism.
I had a lot of fun learning Haskell so I'd recommend it. The only downside is that when I use other languages now I always think about how much easier it would be if I was writing it in Haskell.