4 ms·
To say it more correctly (hopefully): Haskell contains a purely functional sub-language. It also has impure parts (provided by monads). Just like most programmi
by pflanze 10y ago
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.
- JadeNB 10y ago> 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_impure 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.27t_need_Monads https://wiki.haskell.org/What_a_Monad_is_not#Haskell_doesn.2...).
- eatonphil 10y agoFor anyone reading "functor" and moving on, this (http://www.catonmat.net/blog/on-functors/ http://www.catonmat.net/blog/on-functors/) is a great post discussing how the term is used in a variety of languages.
- pflanze 10y agoAlright, 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?)