# IO then abstraction

Even so, it is fair to object that the ‘monadified’ definition is ugly compared to its direct but not obviously terminating counterpart, with more intermediate naming. Monadic programming is ugly in general [...] There is no need to consider monadic style a just punishment, whatever your impurity.

- Totality versus Turing-Completeness?, Conor McBride (page 3 of 15).

Still, today, over 25 years after the introduction of the concept of monads to the world of functional programming, beginning functional programmers struggle to grasp the concept of monads. This struggle is exemplified by the numerous blog posts about the effort of trying to learn about monads. From our own experience we notice that even at university level, bachelor level students often struggle to comprehend monads and consistently score poorly on monad-related exam questions.

Considering that the concept of monads is not likely to disappear from the functional programming landscape any time soon, it is vital that we, as the functional programming community, somehow overcome the problems novices encounter when first studying monads.

- Visual Support for Learning Monads, Tim Steenvoorden, Jurriën Stutterheim, Erik Barendsen and Rinus Plasmeijer (page 2 of 17).

[Prolog] is a real-world programming language that does not demand the programmer to twist herself into knots just to be able to perform ordinary tasks that are very simple to do in imperative languages (looking to you Haskell and your hare-brained puritan monads).

If you put up a video about monads, the comments are fantastic [...] my personal favourite:

What is a Monad? A miserable pile of functions.

...so where are students of Haskell most likely to have their first encounter with this irksome interface?

The implementation of IO as a monad is the main reason you need to be comfortable with monads to be an effective Haskell programmer.

`IO`

is the monad you cannot avoid.

Haskell, for some the digital equivalent of a 'garden of eden'-esque waterfall under a beautiful sunset; for others a source of pain and stress. This pain and stress is for beginners often largest when they have learned a little bit about monads like

`IO`

.

[...] in most programming languages input and output are esoteric and the techniques for performing input and output must be learnt by the students at an early stage, precisely when they are trying to understand the basics of programming.

- I/O Considered Harmful (At Least for the First Few Weeks), John Rosenberg and Michael Kölling (first page).

Learning how to do I/O should not be a prerequisite to learn the basics of programming nor to take your first steps into the world of Computer Science.

- Functional Video Games in the CS1 Classroom, Marco T. Morazán (page 7 of 19).

A very common question on the interwebz is: how to convert an IO string into a normal string?

If bachelor-level students are often struggling to comprehend the monadic interface, then it has **no place whatsoever** in any introductory Haskell course!

In the first iteration, I/O was covered toward the end of the course because it is connected with the advanced topic of monads. [...] we [subsequently] moved I/O to an earlier point in the course. We also dropped monads, since the majority [of students] had not grasped them.

- Experience Report: The Next 1100 Haskell Programmers, Jasmin Christian Blanchette, Lars Hupel, Tobias Nipkow, Lars Noschinski and Dmitriy Traytel (page 2 of 6).

The [decision to split off I/O from monads and introduce it earlier] is done in an effort to convince students more quickly that pure functional languages can be practical and deal with side effects.

- Engaging, Large-Scale Functional Programming Education in Physical and Virtual Space, Kevin Kappelmann, Jonas Rädle, and Lukas Stevens (page 3 of 21).

In order to keep the programming as simple as possible, we chose to use only a subset of Haskell without monads, higher-level categorical interfaces or IO.

- Haskell in Middle and High School Mathematics, Fernando Alegre and Juana Moreno.

I/O in Haskell must therefore be totally independent of the monadic interface. The introduction of this interface, including its basic operations, should be deferred to an advanced course of study where it can join functors, applicatives, arrows and maybe even category theory itself: only then should students be introduced to monadic I/O.

The most difficult construct for students to understand is the monad. I introduce

`IO`

without mentioning monads.

A simple general-purpose model of I/O for non-strict functional languages remains an open research problem...