Profile picture
Chris Martin @chris__martin
, 10 tweets, 2 min read Read on Twitter
Haskell programs side effect all the time, there's no prohibition or even cultural aversion to effects. The only "effect"-related thing we really avoid is the way in many languages one uses the stack, the heap, and static memory as a myriad of little ad hoc in-process databases.
A lot of languages I look at as essentially DSLs for creating multitudes of ad hoc databases. The simplest form of a database is an IORef, which haskell has and haskellers use, but a lot of languages have dedicated syntax for IORefs (e.g. when every variable implicitly is one).
Haskellers approach a task like "map a function over a list" in a way that doesn't require instantiating a database to track the progress, and that would seem like a very convoluted rube goldberg way to solve the problem, but that doesn't come from a general aversion to effects.
Both kinds of list operations are there...

fmap :: (a -> b) -> [a] -> [b]
traverse :: (a -> IO b) -> [a] -> IO [b]

'traverse' isn't a pariah. You use it to do I/O when you want to do I/O.
The difference from other langs is that Haskell has *some things* that don't involve I/O. In many langs *everything* is I/O, and in haskell *some* things are I/O, and for merely that it gets this "haskellers hate I/O!" reputation.
It's like when a videogame puts one woman in it and the boys are like "this is excessive, they hate men!"
no, you're just already so excessively steeped in I/O that any touch of something that isn't I/O feels radical
Haskell isn't an extreme; it represents moderation.
A function without I/O:
f x = x + 1

A function with I/O:
g x = print x $> x + 1

f produces its input plus one.
g does the same but prints the input first.

if you like your I/O you can keep your I/O
nobody's coming to take away your I/O
Missing some Tweet in this thread?
You can try to force a refresh.

Like this thread? Get email updates or save it to PDF!

Subscribe to Chris Martin
Profile picture

Get real-time email alerts when new unrolls are available from this author!

This content may be removed anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member and get exclusive features!

Premium member ($3.00/month or $30.00/year)

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!