The Haskell Programmer's Guide to the IO Monad: Don't Panic

S. Klinger

Research output: Book/ReportReportProfessional

248 Downloads (Pure)

Abstract

Now, that you have started with Haskell, have you written a program doing IO yet, like reading a file or writing on the terminal? Then you have used the IO monad—but do you understand how it works? The standard explanation is, that the IO monad hides the non-functional IO actions —which do have side effects— from the functional world of Haskell. It prevents pollution of the functional programming style with side effects. However, since most beginning Haskell programmers (i.e., everyone I know and including me) lack knowledge about category theory, they have no clue about what a monad really is. Nor how this “hiding��? works, apart from having IO actions disappearing beyond the borders of our knowledge. This report scratches the surface of category theory, an abstract branch of algebra, just deep enough to find the monad structure. On the way we discuss the relations to the purely functional programming language Haskell. Finally it should become clear how the IO monad keeps Haskell pure. We do not explain how to use the IO monad, nor discuss all the functions available to the programmer. But we do talk about the theory behind it. Intended audience: Haskell programmers that stumbled across the IO monad, and now want to look under the hood. Haskell experience and the ability to read math formulae are mandatory.
Original languageEnglish
Place of PublicationEnschede
PublisherCentre for Telematics and Information Technology (CTIT)
Number of pages34
Publication statusPublished - Nov 2005

Publication series

NameCTIT Technical Report Series
PublisherCentre for Telematica and Information Technology (CTIT)
No.05-54
ISSN (Print)1381-3625

Keywords

  • METIS-226143
  • IR-53411
  • EWI-7664

Fingerprint Dive into the research topics of 'The Haskell Programmer's Guide to the IO Monad: Don't Panic'. Together they form a unique fingerprint.

Cite this