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

I wonder what The Sussman thinks of

Name: Anonymous 2008-04-05 8:08

Haskell, in the light of Nomads.

Name: Anonymous 2008-04-05 8:14

I'm going to ask him.

Name: Anonymous 2008-04-05 9:41

>>2
We could have a meaningful discussion here1 first so we have something to say.

I think monads are useful for certain abstractions, just like normal function composition. For instance in a parser library in Scheme I'm writing it's useful to map the current possible matches, which include a state of what is left to match, over matching the rest of the pattern. Writing this out directly is quite messy, but introducing a bind function cleans it up considerably.

Of course the big deal Nomads have with monads is that they ``tame side effects''. One problem I have with this is that you need a type system to automatically lift unrelated functions into the monad. Another is that compared to normal side effects they are a pain to use. So IMO using a side-effectful language with pure parts is a better idea than using a pure language with side-effectful parts.
(On an unrelated note, s/side-effectful/eager/ s/pure/lazy/ holds true too.)


1 Yeah right.

Name: Anonymous 2008-04-05 12:16

>>3
Well, we agree that controlled effects are a good thing. If a language can, for example, making a guarantee that a function is pure, or, another example, make a guarantee of only a certain type of side-effect (read/writing from a file/socket/array/hash-table/stdout/some-data-structure), then I would say that language has controlled effects, and agree that this control is useful. Useful for reasoning about the behaviour of a program because it may be more predictable because of the reduced complexity; it may be easier to write test-cases (automated] or manual) for[1]; (a common property of controlled effects) it's easy to imagine a state for a particular procedure; it can be useful for stopping a kind of side-effect that is irreversible.

[1]QuickCheck: An Automatic Testing Tool for Haskell http://www.md.chalmers.se/~koen/Papers/quick.ps

Name: Gerald J. Sussman 2008-04-05 12:27

Hello, Just got an email requesting my assistance here.

First off, I respect the Haskell language. However, I find that the Algorithmic Language Scheme is a much better language.

On the subject of Nomads, they are unscientific and ultimately destructive.

Name: Anonymous 2008-04-05 12:33

Nomads considered harmful.

Name: Anonymous 2008-04-05 12:43

>>3
I personally do not find writing side-effects, in Haskell, at least, to be “painful”. Perhaps you could provide an example of that. The question of whether Haskell can do common side-effectual operations like PutStrLn "hi" or hPutStr "GET / HTTP/1.1\r\n" or launchMissiles is a bit silly. You can write imperative code.

The “X by default with Y parts” argument with respect to side-effects is an interesting one. If you like writing really stateful code even in your simple algorithms, then fundamental, easy mutation of variables is useful. But if you prefer writing more mathematically styled, timeless code, it isn't very useful.

Let's consider an imperative language which allows guarantee of purity, given sufficiently elegant means of expression for pure code (for example map), I, personally, would write most of my code in a pure and functional way. (Indeed, most of the CPU time of Haskell programs is in pure functions. Unless you're working with OpenGL, most of your program will be pure code.) This would lead me to conclude that the language should be pure by default.

Perhaps you are different, perhaps you would really, really want mutation of variables and statefulness to write your algorithms with; then, I agree that you would want imperative by default. But I cannot agree that there is absolutely a better out of “X by default with Y parts” and “Y by default with X parts”. In conclusion, it is a personal choice. If you prefer X over Y, then have that as default, otherwise the opposite. At this time, I don't know whether having the “abstraction” of fundamental mutation is any better or worse, but I don't prefer it.

Name: Anonymous 2008-04-05 12:44

Read LoL.

Name: Anonymous 2008-04-05 20:02

>>4
I think types are not required for handling side effects well. Not for the programmer, because they can easily be documented (naming conventions etc), and not for implementations, because it isn't hard to infer (at least conservatively).

The information gained from the types is often incomplete and sometimes even misleading. Rather than using them to gain information, said information should just be passed (in the case of Quickcheck random generators). This might look like more work, but I think it's not that much compared to creating accurate types, and it's certainly simpler.

(I don't know much about Quickchecking monadic functions so I can't comment on that)

>>7
Writing imperative Haskell isn't that painful, but because it is not 'imperative by default', adding a single impure feature later to pure code (say logging some debugging values somewhere) means you have to restructure a lot of things. For instance if f is changed from pure to impure, then map f l must be changed to mapM f l and h $ g $ f x to f x >>= liftM (h . g) (I think), of course propagating upwards. Ideally they could just stay the same, which is exactly what imperative by default achieves. Maybe 'composable monad by default' will do this too, but then what's the difference?

I mostly write pure code, but when I write a bit of impure code I don't want to be hindered by the language, especially when I don't see the advantage in doing so.

Name: Anonymous 2008-04-05 20:58

I think you guys are overlooking one important advantage of monads (in a pure, lazy language), which is composability. The composability of monads allows you to write what would be control structures in another language as higher order functions in Haskell (see: mapM, when, etc).
I like that in Haskell, you can take literally any piece of code and factor it out into a HOP.

Name: 10 2008-04-05 21:01

[spoiler]I wanted HOP to mean "Higher-order procedure" but according to Wikipedia that acronym doesn't exist so pretend I said "HOF".[spoiler]

Name: Anonymous 2008-04-05 21:06

>>11
[spoiler]I thought you meant Higher-order PERL[spoiler]

Name: Anonymous 2008-04-05 21:06

Combinators, btw.

Name: Anonymous 2008-04-05 21:13

>>11

I wanted HOP to mean "HOP order procedure"

Name: Anonymous 2008-04-05 23:58

>>12-14
Look, now you've ruined a perfectly good conversation.

Name: Anonymous 2008-04-06 0:33

>>15
I was contributing. :(

Name: Anonymous 2008-04-06 7:19

>>9
I think types are not required for handling side effects well.
(Note that I did not mention types in >>4.) I vaguely agree, but I do think some kind of language tag is helpful so that the runtime or compiler will stop effects that shouldn't occur, as a guarentee. Remember that purity can allow nice optimisations (e.g. compare length . map to length).

Not for the programmer, because they can easily be documented (naming conventions etc), and not for implementations, because it isn't hard to infer (at least conservatively).
I guess it's possible for programmers to adhere to the docs they create for their code... whether or not a language feature to express this is better, I don't know. E.g. “don't inspect member Foo of this structure” and “I promise this function Bar is pure” vs. private Foo and pure Bar().

The information gained from the types is often incomplete and sometimes even misleading.
Example? Counterexample: IO a -- can do any IO effects, including STM effects. STM a can only do STM effects (read/write/create TVars). From these types we can see exactly what side-effects can occur. We might, for some reason, create a Socket a type and monad, which can perform socket input/output, but no file IO. Or a GUI a type, where GUI effects like makeWindow and setWindowTitle can be performed thread-safely, based on STM (and thus they are composable).

Rather than using them to gain information, said information should just be passed (in the case of Quickcheck random generators). This might look like more work, but I think it's not that much compared to creating accurate types, and it's certainly simpler. (I don't know much about Quickchecking monadic functions so I can't comment on that)
I don't really know what you're talking about here. Perhaps you can elaborate.

Writing imperative Haskell isn't that painful, but because it is not 'imperative by default', adding a single impure feature later to pure code (say logging some debugging values somewhere) means you have to restructure a lot of things ... Ideally they could just stay the same ...
Well, it is possible to use trace to print something to stdout from a pure function using unsafePerformIO, for those cases where you need to print things out, but that is besides the point. Besides the fact that using trace produces unexpected results due to laziness, using printf-style debugging is not really my favourite kind. I'll digress here; I want to say a little bit about how I debug my Haskell programs. I admit, I started doing this when I first learned Haskell. I'd be printing debug values out so I could fix problems, because you need to see how the function interacts with the state of the real program, right? But I realised a much more elegant approach is to have a few functions which construct a state for me, and then run my program inside GHCi, and then I can test these functions from the prompt myself and inspect the results. Infact, I did this for all functions I'd written, so I knew that these functions were working as I wanted them to, because I could test them as they would run in the real thing -- with a state, and this is the advantage of passing state around (through function arguments or via monads). Of course, some functions can be tested like that with QuickCheck, too.

I mostly write pure code, but when I write a bit of impure code I don't want to be hindered by the language, especially when I don't see the advantage in doing so.
Apart from printing debug values, can you think of another example of “a bit of impure code”? I'm not intending on arguing from silence here, just curious.

Name: Anonymous 2008-04-06 8:42

KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES

Name: Anonymous 2008-04-06 8:42

KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES

Name: Anonymous 2008-04-06 8:43

KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES

Name: Anonymous 2008-04-06 8:43

KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES KIKES

Name: Anonymous 2008-04-06 10:20

Name: Anonymous 2008-04-06 10:33

>>22
This thread just started to make sense.

Name: Sgt.Kabukiman 2012-05-21 13:59

All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy

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