[Haskell-cafe] Re: monad subexpressions

Mirko Rahn rahn at ira.uka.de
Fri Aug 3 08:41:05 EDT 2007


>>> rewrite *p++=*q++ in haskell?

> it's one of C idioms. probably, you don't have enough C experience to
> understand it :)

Maybe, but how can *you* understand it, when the standard is vague about it?

It could be

A: *p=*q; p+=1; q+=1;
B: *p=*q; q+=1; p+=1;
C: tp=p; tq=q; p+=1; q+=1; *tp=*tq;

...and so on. Which is the "right" version?

> result is that currently C code rewritten in Haskell becomes much
> larger and less readable.

Larger should not be that issue and readability depends on the reader as 
your C example shows. Some Haskellers would very quickly recognize some 
common idioms, where others need some help...

/BR

-- 
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---


More information about the Haskell-Cafe mailing list