Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Haskell is

Name: Anonymous 2008-06-17 17:37

the white man's burden of programming languages.

Name: Anonymous 2008-06-17 17:40

lolwut

Name: Anonymous 2008-06-17 17:51

mathfag

Name: Anonymous 2008-06-17 18:05

Actually Haskell is man's best friend.

Name: Anonymous 2008-06-17 18:12

Haskell is addictive and will ruin other languages for you.

Name: Anonymous 2008-06-17 18:19

>>5
Tell me about it, brother. I tried to write loeb in C++ (with boost), and ended up with a 1 megabyte compiler error message.

Name: Anonymous 2008-06-17 18:25

I lol'd.

Name: Anonymous 2008-06-17 18:42

>>6
Lars?

Name: Anonymous 2008-06-17 18:44

>>7
I also lol'd but for different reasons.

Name: Anonymous 2008-06-17 18:55

>>9
You don't know that.

Name: Anonymous 2008-06-17 18:56

main is defined to be the entry point of a Haskell program (similar to the main function in C), and must have an IO type, usually IO ().
and must have an IO type
Huh?

Name: Anonymous 2008-06-17 19:02

>>11
I see no reason for confusion there.

Name: Anonymous 2008-06-17 19:03

i am a JAVA. i ahev a long doc and i make programs w/ my API. if you dont repost this comment on 10 other pages i will hax your anus tonight and make a mess of your computer and ass

Name: Anonymous 2008-06-17 19:04

>>12
What it main doesn't have an IO type?

Name: Anonymous 2008-06-17 19:05

Okay, never mind -- your whole SICP thing has corrupted my way of thinking.

Name: Anonymous 2008-06-17 19:08

>>14
Then you'll get a type error message.

Name: Anonymous 2008-06-17 19:21

>>15
How so?

Name: Anonymous 2008-06-17 19:22

>>14
You can lift objects into the IO monad simply enough!

Name: Anonymous 2008-06-17 19:31

>>11
usually IO ().
Always IO ().

Name: Anonymous 2008-06-17 19:41

>>19
Not really, main can return some value inside the IO monad. But it'll be ignored unless you're inside GHCi.

Name: >>20 2008-06-17 19:44

Or unless you're explicitly calling main in your code.

Name: Anonymous 2008-06-17 19:47

>>20
I'd like an example of an instance where a value other than IO () has been used for main in a program.

Name: Anonymous 2008-06-17 19:48

>>21
Djikstra wouldn't have liked this.

Name: Anonymous 2008-06-17 19:51

>>22
I'm not saying it's useful, I'm saying it's possible.

Name: >>24 2008-06-17 20:01

Oh, I remember now: you can end main in sequence [...] instead of sequence_ [...]. It saves you from having to type the extra "_" (I'm sure there are better examples of usefulness).

Name: Anonymous 2008-06-17 20:07

>>25
sequence_ IS FASTER THAN sequence SINCE IT CAN IGNORE THE RETURN VALUES YOU DUMB SHIT. GOD PEOPLE LIKE YOU MAKE SPJ CRY AT NIGHT.

Name: Anonymous 2008-06-17 20:13


hyryst?
       \
       ಊ

Name: Anonymous 2008-06-17 20:14

>>22
When the whole program fails and returns a non-0 value.

Name: Anonymous 2008-06-17 21:21

>>26
lrn2humor

Name: Anonymous 2008-06-20 15:30

Haskell's burden is to serve as an example of clean side effect programming, much like how Europe's burden is to show the Americans how to live their lives.

Name: Anonymous 2008-06-20 16:04

Every time I want to get into Haskell, I just can't get past the chapter about monads. I've tried three tutorials already and I'm nowhere as close to understanding monads.

Name: Anonymous 2008-06-20 16:07

>>30
Europe can keep its 1984.

Name: Anonymous 2008-06-20 16:13

>>31
I'm still stuck on the syntax. :(

Name: Anonymous 2008-06-20 16:15

>>33
What exactly?

Name: Anonymous 2008-06-20 16:34

>>31
A Monad is like a piece of code waiting to be executed. getLine, for example, returns a value of type IO String, which is a piece of code that when executed will produce a string. You can only get the value out of a monad when you execute that monad. For most monads you do that by passing them as arguments to a monad executing function (like runIdentity for Identity monad). In the case of the IO monad, however, you can only execute them by embedding them (directly or indirectly) into the monad returned by main. Hope this helps.

Name: Anonymous 2008-06-20 16:39

SO do you create a monad that, when executed, returns a number, with
return 42
?

Also, is sequence an executing function like runIdentity
?

Name: Anonymous 2008-06-20 17:00

>>36
Yes.

No, sequence is a function that turns a list of monads into a monad that returns the list of the values of those monads.

Name: Anonymous 2008-06-20 17:20

>>34
The syntax. Haskell is filled with syntax.

Name: Anonymous 2008-06-20 17:40

One more question: when I want the return 42 to return an Int, that's the typesig of return 42
?

Name: Anonymous 2008-06-20 18:01

>>39
Monad m => m Int

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List