Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

To say it more correctly (hopefully): Haskell contains a purely functional sub-language. It also has impure parts (provided by monads). Just like most programming languages have pure and impure parts. The difference is that Haskell employs the type system to segregate the two parts.


> It also has impure parts (provided by monads).

Since we're going for precision, I note that monads have nothing to do with impurity (https://wiki.haskell.org/What_a_Monad_is_not#Monads_are_not_...). It just happens that IO, in which the impurity lives, is a monad. It is also a functor (in the category-theory, not Prolog or C++, sense), but that doesn't make functors impure, and it doesn't make monads impure (or impurity inherently monadic: https://wiki.haskell.org/What_a_Monad_is_not#Haskell_doesn.2...).


Alright, so let me phrase it this way then?:

> To say it more correctly (hopefully): Haskell contains a purely functional sub-language. It also has impure parts. Just like most programming languages have pure and impure parts. The difference is that Haskell employs the type system to segregate the two parts.

(Anyway I'd be interested in how to access IO without using the IO monad; is there a lower-level type to use instead?)


For anyone reading "functor" and moving on, this (http://www.catonmat.net/blog/on-functors/) is a great post discussing how the term is used in a variety of languages.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: