itt; haskell beginners ask me questions
ill start with what haskell is
haskell is a general purpose, purely functional programming language .
it provides:
>higher-order functions (functions that can take functions as arguments and return functions too)
> static polymorphic typing (meaning functions that can work on any datatype)
>user-defined algebraic datatypes
>pattern-matching
>list comprehensions
>a module system
>a monadic I/O system
>a rich set of primitive datatypes, including lists, arrays, arbitrary and fixed precision integers, and floating-point numbers
spoiler: I'm not an expert by I know my way around.
Why would I want to use this shit instead of tried and true programming constructs like loops, conditional jumps and state machines with side effects?
It's how a computer actually works.
>>55823830
What's the advantage of learning it?
>>55823830
Give me a category theory primer right now, with accurate mathematical notation.
>>55823830
congratulations. you've managed to list every trivial haskell feature without mentioning the interesting stuff
>>55823870
although haskell doesn't have those constructs, it sure can emulate it
i.e.for i in range(1,20):
print(i)
is the same asmap print [1..20]
functional programming allows one to be more expressive
stuff likefor, whilerequires state, and haskell in itself is purely functional
state is non-pure
there's better ways to achieve the purpose of iteration within haskell and fp in general
>>55823924
you'll get a taste of what fp is about
since haskell is very high level, code will be much shorter thatn the imperative counter part
also, the syntax is fucking hot
>>55823953
>>55823967
read the spoiler in >>55823830
>>55823977
Can you provide a non-meme answer that doesn't mention state?
Why should you care?
Also, why the fuck does the GHC require a 2GB runtime?
>>55823996
Come on. If you don't even know basic category theory you shouldn't be giving advice on python and talking about "getting a taste for fp".
>>55824030
I meant haskell there
>>55823870
not OP, but it's actually really nice for solving some mathematical problems.
>>55824030
you don't need category theory for haskell though
>>55824017
because its useful to isolate purity and non-purity
i.e. allows you to modularize your code and helps you reason about it
also, ghc's fucking bloated, and only a gig, thats why
Would it be possible to write something like a game or a word processor in a purely functional language? How would you handle those sorts of things without using state?
How's Haskell for someone that only knows a little bit of Python and sucks at math?
Asking for a friend.
>>55823830
Aside from memes and fizzbuzz writing what are the real world applications for functional languages? Where are they used/usefull?
>>55823830
Good for first language ?
Haskell is obsolete.
>>55824421
Different approach to mutability, not really comparable.
>>55824187
state is possible in haskell, its just segregated
>>55824322
I learned python a bit before doing haskell
and here I am
I only know haskell to a great extenent
>>55824380
https://wiki.haskell.org/Haskell_in_practice
>>55824395
I'm not sure.
You can try it.
No, do try it.
Haskell's pretty logical and the type system will make everything make sense
>>55824602
>state is possible in haskell, its just segregated
What exactly do you mean by "segregated"? What data structures are possible in Haskell?
don't kid yourself, Haskell's module system is useless
>>55825710
segregated meaning it can be contained
actions are contained in a type called IO
any data strucutres are allowed in haskelldata Tree a = Node a [Tree a]
is a tree structure
it can also be a graph, but graphs are more complicated
the data keyword allows one to make any type of data structure, whether they have constraints is up to the functions that work with such data structures
>>55826200
how come?
>>55823830
if its purely functional does that mean you cant implement OOP in it. If not doesnt that mean you cant create any real program in it since mutation is pretty critical for programs today.
Links to guides?
>>55826847
I believe someone was able to emulate OOP in haskell.
>>55826945
http://learnyouahaskell.com/
Where's an IRC room where Haskell nerds can get together to work on shit?
>>55827117
#haskell on irc.freenode.org