Live data from Hacker News

The New Haskell Homepage

new-www.haskell.org

241–250 of 258 posts

Re: The New Haskell Homepage

#241
post #94

Well, it sure looks nicer, I'll give you that. I'm more interested in the content, though. I was just trying here and there over the last week or so to learn some Haskell - people always seem to be raving about how cool it is. I found my way to the CIS 194 class link, the first one on the page, and I find that it really isn't very good for learning. I went through the first page, trying to run some of the stuff. I fi…

This http://dev.stephendiehl.com/hask/ overview is a little bit more advanced. It gives a good overview over the tools, some of the ecosystem and important libraries.

A little more advanced, but this resource has been indispensable for me. Thanks Stephen!

Re: The New Haskell Homepage

#243
post #191

Earlier quoted context omitted.

I too dislike tutorials focused around the REPL, because it's rarely how you write code in practice. The REPL is more of a debugging tool for quickly testing and manipulating code you've already written. I'd jump directly into creating code files/modules - begin by creating simple programs using `main` as you would in other languages. Create a file with ".hs" extension, (Haskell filenames start with capital letters b…

Thanks for the help, though Vim is already my choice for insanely-powerful text editor with 2k+ page user manual :) I tried emacs, but the dependence on the control key for everything makes it kinda painful on every keyboard I have. I suppose I could probably remap a bunch of keys or something, but Vim seems to work much better in the default configuration. I know this tends to be a big flamewar subject, so it is wha…

> Also checking out the other people's suggested Learn you a Haskell.

Just to get the minority opinion out there, I found the style of Learn You a Haskell to be insufferable. Real World Haskell is available free online[1] and has a straightforward tone of voice.

[1] http://book.realworldhaskell.org/

Re: The New Haskell Homepage

#244
post #235
post #155

Earlier quoted context omitted.

Not sure if you would like to know some answers to your questions, here are they anyway: - It's unclear to me whether map is a function which takes two arguments ... or if the first part "map (+1)" evaluates to a function which acts on [1..5] The latter is true. In Haskell you can pass arguments to functions one at a time each time the result could be a function that takes another argument. You might even say that Ha…

- You might even say that Haskell functions always take one argument This is exactly true. Every Haskell function takes either zero arguments, or one.

Nah, Haskell has no functions with zero arguments.

You could say that a value is a function that takes no arguments, but then you lose the distinction between functions and other values, and more importantly, the distinction between function types and other types! For example, types like Bool have decidable equality, but function types in general have undecidable equality, so you really don't want to be caught saying that Bool is a function type. It's much more sensible to say a type is a function type iff it was constructed by the type constructor ->, which takes two types, the argument type and the return type. In other words, all functions take one argument and return one result.

You could also say that a value is an unevaluated thunk that takes no arguments, but that's not always true. The thunk may be already evaluated and replaced with a value, without affecting the visible type. It's better to keep the idea of "thunk" separate from the idea of "function", because a value could be both, either, or none.

You could also say that every value x can be converted to and from a function () -> x. But that's not a function with no arguments, that's a function with one argument of type "unit" (the type with a single member, a.k.a. the empty tuple).

The above might sound pedantic, but for some reason it's fascinating to me to think about such things. Language design is a kind of addiction and Haskell is like a drug, because its original purpose was to be a laboratory for programming language research, which you can see in the million GHC extensions.

Re: The New Haskell Homepage

#245
post #181

Earlier quoted context omitted.

Out of curiosity, was there a specific reason you went from Clojure to Haskell or was it more about exploring a new language? I ask because I am currently learning Clojure, but wonder if there is something unique that Haskell offers.

For me it's mostly about codebase scaling, refactoring and maintainability. Clojure is liberating and exciting when you're writing a tiny little project, but it's a whole other experience when you need to refactor dozens of files because you changed the format of the data being passed around, or you're changing an internal API that's called from a hundred different places. You better have perfect code coverage, or yo…

Would Prismatic/Schema address those data typing issues?

Re: The New Haskell Homepage

#246
post #191

Earlier quoted context omitted.

Thanks for the help, though Vim is already my choice for insanely-powerful text editor with 2k+ page user manual :) I tried emacs, but the dependence on the control key for everything makes it kinda painful on every keyboard I have. I suppose I could probably remap a bunch of keys or something, but Vim seems to work much better in the default configuration. I know this tends to be a big flamewar subject, so it is wha…

> Also checking out the other people's suggested Learn you a Haskell. Just to get the minority opinion out there, I found the style of Learn You a Haskell to be insufferable. Real World Haskell is available free online[1] and has a straightforward tone of voice. [1] http://book.realworldhaskell.org/

I've just peeked at this book again, and I noticed that they do start with ghci. They're very up-front about its peculiarities, though.

Re: The New Haskell Homepage

#247
post #235
post #155

Earlier quoted context omitted.

Not sure if you would like to know some answers to your questions, here are they anyway: - It's unclear to me whether map is a function which takes two arguments ... or if the first part "map (+1)" evaluates to a function which acts on [1..5] The latter is true. In Haskell you can pass arguments to functions one at a time each time the result could be a function that takes another argument. You might even say that Ha…

- You might even say that Haskell functions always take one argument This is exactly true. Every Haskell function takes either zero arguments, or one.

Haskell functions never take zero arguments. Things that take zero arguments are not functions. For a more in-depth explanation of why, see: http://conal.net/blog/posts/everything-is-a-function-in-hask...

Re: The New Haskell Homepage

#248
post #205

Earlier quoted context omitted.

Yeah. A major reason null is called the "billion dollar mistake" is that once you finally do get a NullPointerException (or the like), it can take a huge amount of time to track down where the null value originated. If you take the head of an empty list in Haskell, you get an exception right away. Not a poisoning of the well, like you do in so many other languages. That's absolutely a benefit of Haskell worth touting…

That's still the same problem, isn't it? You still have to track down where the empty list originated, just as the null value in C. I'm not a Haskeller, but do the language and tools make that easier than in other ecosystems?

Yes, they do make it easier in a lot of cases.

For example, in the `head []` case, ghc has an option to locate the exact source of the error:

-xc

(Only available when the program is compiled for profiling.) When an exception is raised in the program, this option causes a stack trace to be dumped to stderr.

This can be particularly useful for debugging: if your program is complaining about a head [] error and you haven't got a clue which bit of code is causing it, compiling with -prof -fprof-auto and running with +RTS -xc -RTS will tell you exactly the call stack at the point the error was raised.

The output contains one report for each exception raised in the program (the program might raise and catch several exceptions during its execution), where each report looks something like this:

  *** Exception raised (reporting due to +RTS -xc), stack     
  trace:
    GHC.List.CAF
    --> evaluated by: Main.polynomial.table_search,
    called from Main.polynomial.theta_index,
    called from Main.polynomial,
    called from Main.zonal_pressure,
    called from Main.make_pressure.p,
    called from Main.make_pressure,
    called from Main.compute_initial_state.p,
    called from Main.compute_initial_state,
    called from Main.CAF
  ...

Re: The New Haskell Homepage

#249
post #191

Earlier quoted context omitted.

Thanks for the help, though Vim is already my choice for insanely-powerful text editor with 2k+ page user manual :) I tried emacs, but the dependence on the control key for everything makes it kinda painful on every keyboard I have. I suppose I could probably remap a bunch of keys or something, but Vim seems to work much better in the default configuration. I know this tends to be a big flamewar subject, so it is wha…

> Also checking out the other people's suggested Learn you a Haskell. Just to get the minority opinion out there, I found the style of Learn You a Haskell to be insufferable. Real World Haskell is available free online[1] and has a straightforward tone of voice. [1] http://book.realworldhaskell.org/

I found Learn You a Haskell to be one of the best programming books I've ever read and no I'm not joking. It's a work of art.

Re: The New Haskell Homepage

#250

Earlier quoted context omitted.

Being a god in C++ won't give you anything regarding foreign paradigms. Are you familiar with other FP languages such as ML, Miranda or even Lisp ? More than syntax it's the semantics that differs a lot. Laziness, Immutability...

Not really. No. And that's the problem! You're right that semantics are what make the languages truly different. However it is literally impossible to even begin to understand semantics if you don't know the syntax. That's what is so frustrating. It might as well be written in Kanji. That's how meaningless it is to me and, I believe, most programmers.

"Most programmers"? I started learning Haskell without previous knowledge of any functional language. The syntax was as strange to me as C was when I first picked it up.

The problem (I think) is trying to translate your knowledge of C or C++ syntax to Haskell, when they are so different. Try learning Haskell from scratch. Don't assume anything. Learn it like you would learn Japanese :)

Post reply on HN