[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

I TEACH HASKELL

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 28
Thread images: 2

File: haskell.png (49KB, 1000x716px) Image search: [Google]
haskell.png
49KB, 1000x716px
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 as
map print [1..20]


functional programming allows one to be more expressive
stuff like
for, while
requires 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 ?
>>
File: rust-logo-512x512.png (94KB, 512x512px) Image search: [Google]
rust-logo-512x512.png
94KB, 512x512px
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 haskell
data 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
Thread posts: 28
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.