News for hackers. Stuff that matters.
Re:Learn You a Haskell for Great Good (2008) by exDM69 on Thursday February 19, 2015 @03:40AM (#9073041)
They don't teach you number theory before they teach you addition and subtraction in primary school.

Don't read the "Monad tutorials" and especially do not stop programming in Haskell until you "learn monads". Find one of the respected books, read it and do the exercises.

You do not need to thoroughly understand monads in order to do some IO programming just like a violinist does not have to understand the physics of vibrating strings or you don't need to be an auto mechanic to drive to the grocery store.

Write the "Guess the Number" game in Haskell using IO and you should understand the basics and that gets you far. Reading and writing to/from files and network sockets, etc works pretty much the same as you're used to from imperative programming languages. "Guess the number" contains just enough control flow (repetition, conditionals) to get you started.

I've written tens of thousands of lines of Haskell code, including production code at work, and I still don't know what a Monoid is. I have only a faint theoretical understanding of monads, but I am fluent writing IO code and applying monads to other problems like parsing and error handling.

You should only study monads when you're fluent doing some basic imperative programming in Haskell or if you are a math student and have a keen interest in category theory.

Re:Learn You a Haskell for Great Good (2008) by dllthomas on Thursday February 19, 2015 @11:48AM (#9075014)
"I still don't know what a Monoid is."

That is surprising. They show up all over in fairly common libraries - for instance, Writer collects a monoidal value. The very simplest notion is "monoid is for things you can combine". Taken from math, a monoid is a set of things (a type) for which you have an operation (called mappend in Haskell) which you can combine associatively, where the set contains an element (mempty in Haskell) that is an identity with respect to that operation.

Some common monoids are:

    Anything list-like:
        mappend appends two lists
        mempty is the empty list

    Integers over addition (newtype Sum)
        mappend adds two integers
        mempty is zero

    Tuple of monoids:
        mappend is componentwise mappend
        mempty is (mempty, mempty)

    Functions where the domain and range are the same:
        mappend is function composition
        mempty is id
Re:Learn You a Haskell for Great Good (2008) by tomjakubowski on Thursday February 19, 2015 @10:05AM (#9074337)
> Reading and writing to/from files and network sockets, etc works pretty much the same as you're used to from imperative programming languages.

I agree completely that it's not necessary (and maybe even detrimental) to learn monads to use Haskell's IO, but I think this claim is dubious. Not too many imperative languages have lazy IO and this feature can be a surprising hurdle for the Haskell beginner who is versed in other languages.