Haskell and I have a lot in common: we are both advanced, purely-functional, and open-sourced; we both have twenty years of cutting-edge research experience, can develop robust, concise, correct software rapidly; we both have strong support for integration with others; we both have built-in concurrency and parallelism; we are both great debuggers and profilers; we both love our rich libraries and our active community; we both produce flexible, maintainable, high-quality software.
My love for Haskell is an infinite and uncountable monad, a Cartesian closed category if you will. If you lack the sophistication to appreciate my immutable passion, you can D.I.A.F.
I dislike so-called “functional programming”. Not only is imperative programming a strict superset of it, but it also is much more powerful and flexible.
A common fallacy says they are equivalent. Altough the machine (be it virtual or not) on which an imperative program runs can easily be viewed as a purely functional tail-recursive interpretation function, it doesn't mean they are equivalent, because your program is not the machine and only imperative programming gives you full access to the parameters of that function. In effect, this means that functional programming can't do, for instance, hash tables efficiently. Monads are meant to solve this, but there's a big price to pay: your program becomes a lot more complex and slow.
What about another frequent argument, is functional programming really easier to manage? Referential transparency is a good thing but in some cases it can be better to break that convention and imperative style allows you to do it very cleanly without cluttering your code with monads. Another advantage of imperative programming is that it easily allows you to encapsulate an impure but referentially transparent function and this is something sole functional programming can't provide without kludges.
Advances in optimisation technology are progressively making functional programs faster, but I don't want to use a lower-level language without any performance or consistency gain. Purely functional programming is a crippled technique and just not worth it.
I just didnt think anyone who is actually capable of writing +2 sentences would not waste it for such a thread. Functional programming fanatics.
You cant really think they would listen, do you?
>>9
It works well for me. Perfect functional code is perfect. Assumptions in imperative state could change whenever one is not watching for it. I find this problem over and over again.
>>9 Monads are meant to solve this,
They are not. They are a class of types with certain operations (bind and unit) that respect certain laws. IO just happens to be a monad, that's all.
Name:
One Happy Nigga2012-06-23 11:46
Nigga you better be trippin. Ain't no bitch can ever comprehend Haskell, he one true brace style.
Actually I take that back, after looking at what you listen to I am thoroughly disenfranchised.
Name:
Anonymous2012-06-23 12:51
I was reading her article on the front thinking its not that bad, then I get to the end and realize it was written by some other guy. Seriously, nothing on that site is original just copy and paste. Then you go to her twitter and its about nothing but makeup and shopping.
>>22
It's the haskell.org homepage with less information and more attention whoring. How fitting...
Name:
Anonymous2012-06-23 18:47
divide a b = rem b a == 0
fizzbuzz' x
| 15 `divide` x = "FizzBuzz"
| 3 `divide` x = "Fizz"
| 5 `divide` x = "Buzz"
| otherwise = show x
fizzbuzz n = take n [ fizzbuzz' x | x <- [1..n] ]
printListLn :: [String] -> IO ()
printListLn [] = return ()
printListLn (car:cdr) = do
putStrLn car
printListLn cdr
main = printListLn $ fizzbuzz 30
I started learning Haskell 45 minutes ago and wrote this. Is it good style?
Name:
Anonymous2012-06-23 19:13
>>27
List comprehensions are the best thing in Haskell since list comprehensions: fizzbuzz n = [ fb | x <- [ 1 .. n ], fb <- [ f ++ b | f <- [ if x `mod` 3 == 0 then "fizz" else "" ], b <- [ if x `mod` 5 == 0 then "buzz" else "" ], f <- [ if (f == "") && (b == "") then show x else f ] ] ]