Forgot your password?
typodupeerror
This discussion has been archived. No new comments can be posted.

Haskell 2010 Announced

Comments Filter:
  • Re:Is it just me ? (Score:4, Informative)

    by arevos (659374) on Tuesday November 24, 2009 @06:34PM (#30219832) Homepage

    I'm not sure what you mean by "recursive style", but the biggest commercial users of functional programming languages tend to be companies behind high-traffic websites that need to handle a lot of concurrent requests. Facebook developed their real-time chat application in Erlang, for instance, and Twitter uses Scala to handle its message queue.

  • Re:Is it just me ? (Score:4, Informative)

    by ls671 (1122017) * on Tuesday November 24, 2009 @06:54PM (#30220086) Homepage

    > I'm not sure what you mean by "recursive style",

    Look at Quicksort in Haskell :

    qsort [] = []
    qsort (x:xs) = qsort (filter (= x) xs)

    This is what I mean, no loops, recursion. I used Prolog and ML to solve logic problems and it is pretty handy. Prolog is especially suited for solving logic problems ( "logic programming" ).

  • Re:Is it just me ? (Score:4, Informative)

    by j1m+5n0w (749199) on Tuesday November 24, 2009 @07:07PM (#30220260) Homepage Journal
    That's not true unless you are using a different definition of "functional" than I am. I can't comment on Scala since I haven't used it, but Erlang is indeed a functional language. It is not a _pure_ functional language, as Erlang does have some mechanisms for manipulating mutable, global state and message passing, but it's at least as functional as a lot of other language that are widely regarded as "functional programming languages" such as Lisp and ML.
  • Re:Is it just me ? (Score:5, Informative)

    by EMG at MU (1194965) on Tuesday November 24, 2009 @07:19PM (#30220422)
    Amdahl's law is not like Moore's "law". Amdahl's law is an observation of mathematics. You can't ever get around the fact that if you increase the performance of 90% of the instructions in a program, you still have to deal with the other 10%. Even if you increase the performance of 90% of the instructions by 100x or something large, if the other 10% take a long time (like disk access) its going to kill your performance.
  • Re:Is it just me ? (Score:5, Informative)

    by DragonWriter (970822) on Tuesday November 24, 2009 @07:28PM (#30220532)

    Except neither Scala nor Erlang are functional languages ....

    Erlang and Scala are both languages designed to support programming in a functional style, and both are "recursive style" languages in that they optimize tail calls generally (Erlang) or at least in the most important case of self-recursive calls (Scala) and thus make tail-recursive (or, in Erlang's case, more general tail calling with unlimited depth) programming styles efficient.

    Neither is a pure functional programming language, true.

  • Re:Is it just me ? (Score:5, Informative)

    by j1m+5n0w (749199) on Tuesday November 24, 2009 @07:42PM (#30220698) Homepage Journal

    I would add a couple other "must have" features in functional languages:

    * The ability to pass a function as an argument to another function (i.e. higher order functions, like qsort in the C standard library).

    * Support for a points-free programming style in which things can be passed from one function to another without naming them.

    Some other features that perhaps aren't technically required but make functional programming a lot easier:

    * Closures, local function definitions, garbage collection, partial evaluation of function.

  • Re:Is it just me ? (Score:3, Informative)

    by jensend (71114) on Tuesday November 24, 2009 @09:55PM (#30221818)

    You misunderstand what he means by "getting past" Amdahl's Law. That wouldn't involve somehow changing the fact that only speeding up part of a program can only do so much to speed the whole program- it'd involve radically changing the proportion of various algorithms which can be parallelized. For instance, if somebody were to come up with a constructive proof that P [wikipedia.org]=NC [wikipedia.org] that'd certainly do the trick (though most people's guess is that that's false).

  • by Captain Tripps (13561) on Wednesday November 25, 2009 @05:58PM (#30231046)

    As the parser needs more data, the run-time system will cause hGetContents to read another block. So, here we have an example of a pure function that's indirectly triggering IO, and it's doing it all without violating the constraints of the type system.

    Actually hGetContents cheats by using unsafeInterleaveIO. It's a cool hack, but lazy IO is an inherently risk business. For instance, if your program later wrote back changes to your scene file, the result is undefined. There's no guarantee of when the program is done reading the file. If you keep this in mind it's no problem, but if all IO worked this way you'd go insane. (Also consider the problem of error handling if there's a disk error.)

  • Re:Is it just me ? (Score:3, Informative)

    by j1m+5n0w (749199) on Wednesday November 25, 2009 @09:36PM (#30232756) Homepage Journal

    I guess I was thinking more of the fairly universal concept that you can use the result of one function as an argument to another without giving it a name. For instance:

    result = f(g(x))

    instead of

    foo = g(x); result = f(foo)

    Haskell applies a points-free style in more cases than we're used to seeing in other languages, which is sometimes useful but I agree it is just as often an annoyance to those who are trying to understand someone else's code. I was thinking of a rather looser definition of points-free, which is present to some degree in all the programming languages I'm familiar with.

Wernher von Braun settled for a V-2 when he coulda had a V-8.

Working...