Hacker Newsnew | past | comments | ask | show | jobs | submit | g__'s commentslogin

Functor typeclass in Haskell models category-theoretic endofunctor rather well.


Functor typeclass in Haskell is not what is usually meant by "functor pattern", e.g. the function object, something that "implements Runnable".


I had no idea the gang of four had appropriated that word too. My bad. I really did mean the category theory functor, not whatever its other meaning is.

However useful or not category theory is for producing new proofs, I found it enlightening and am glad this was posted.


DON'T start functional programming with monads. Familiarize with currying, pattern matching, how to create data types in Haskell, using recursion instead of loops, higher order functions, list comprehensions, type classes, polymorphism in Haskell (different than subtyping in OOP). Ignore monads for a while. To understand monads you must have a good grip of those concepts. You can start with http://learnyouahaskell.com/chapters.

You'll see Haskell tutorials delay telling about the concept. There's a reason.

For a bird's eye of monads you can check this: http://www.reddit.com/r/programming/comments/64th1/monads_in...

If you are ready, read and do exercises in http://blog.sigfpe.com/2007/04/trivial-monad.html and then http://blog.sigfpe.com/2006/08/you-could-have-invented-monad....


What does the following mean, on http://www.google.cn/landing/cnexp/indexd.html?

我们已移至 google.com.hk

请收藏我们的新网址


"We've shifted to google.com.hk.

Please go to our new address."

It's probably placeholder text for when the redirect doesn't work.


we have moved to google.com.hk

please bookmark our new address.


You're right, I was wrong.


GHC 6.6 is almost 4 years old, please upgrade. (http://hackage.haskell.org/platform/)


And it's extremely fast:

  $ pv /dev/zero > /dev/null
  18.6GB 0:00:05 [3.76GB/s] [    <=>                                            ]


The really amusing thing is that (at least on my machine) it's pv that's the bottleneck there; I have it using 101% cpu, anyhow. pv will give me 9.7GB/s, whereas dd will give me 13.3GB/s (also at 100% cpu). I wonder if anything's faster than dd :)


> pv will give me 9.7GB/s

Wow. What kind of hardware is your /dev/null ? Do you use striping ?


Iterators sometimes require restructuring, as in

http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html

In Haskell they don't - you might write this "producer-consumer" composing a function that produces a stream with a function that consumes a stream. How would you approach that problem in C++?


Under assumption P=NP, a polynomial algorithm is already known (!): http://en.wikipedia.org/wiki/P_%3D_NP_problem#Polynomial-tim...

The problem is: will humanity find a feasible algorithm?



You'd have to determine if a program halts. Unless you restrict to non-Turing-complete language, this is undecidable.


You can simply modify your definition of "simplest" to be "shortest that completes in a million steps" or some such. A program that takes so long to finish that you're not sure it will return your desired value is probably not the simplest.


I can decide if some programs halt. (Just not for all.)


This answer is also correct in another way :)

http://threesixty360.wordpress.com/2008/04/30/1-2-4-8-what-c...


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

Search: