Re: how is Haskell not robust?
- From: Adrian Hey <ahey@xxxxxxxxxxxxxxxxxxx>
- Date: Sat, 30 May 2009 09:10:33 +0100
Hello Raould
raould wrote:
also, i hope DDC continues on to be something of an in-production-
viable system.
http://www.haskell.org/haskellwiki/DDC
That does look interesting. I haven't looked at it seriously because it
prolly doesn't run on Windows (yet) and doesn't have any real
documentation (we've got to wait for Bens thesis).
as an aside, i wonder if laziness in Concurrent Clean is as much of an
issue as it seems to be in Haskell. i mean, i would expect that if it
is confusing it would be so in general.
Yes, Clean has does have more or less the same problems in principle,
but I think Clean semantics are more precise as they're defined directly
in terms of graph rewriting, not lambda calculus (as in Haskell). So
(assuming graph rewriting is the underlying implementation in both
cases) Clean gives more control over issues like sharing and space leaks
than Haskell does.
eg. If at the top level I have something like this..
-- The list of all primes in ascending order
primes :: [Integer]
primes = <some cute expression>
In a Haskell implementation this is likely a constant graph (and
probably a space leak). I forget the precise Clean syntax, but Clean
gives you the choice of having primes as a constant graph or as a
"function of zero arity". In the latter case you get a new list of
primes every time the value of primes is demanded.
The other old example I'm reminded of is the power set function (set of
all subsets):
-- Huge space leak, even if result is consumed and discarded as a lazy
-- list.
powerset :: [a] -> [[a]]
powerset [] = [[]]
powerset (x:xs) = xss ++ map (x:) xss
| where xss = powerset xs
-- No huge space leak *provided* the result is consumed and discarded as
-- a lazy list. Otherwise slower and even more memory hungry.
powerset :: [a] -> [[a]]
powerset [] = [[]]
powerset (x:xs) = powerset xs ++ map (x:) (powerset xs)
This example is interesting in that it shows that that often there is no
single obvious "best" definition of some function. Bestness is a non
local property and depends on context of use. So this kind of implies
whole program (or whole something) analysis is needed for a smart
compiler to synthesise the "best" implementation.
Also as the whole issue of sharing is somewhat ambiguous in Haskell
there's no guarantee that common sub-expression elimination will not
transform the second into the first in any case (though I believe no
current implementation would actually do this).
Regards
--
Adrian Hey
.
- Follow-Ups:
- Re: how is Haskell not robust?
- From: Erik de Castro Lopo
- Re: how is Haskell not robust?
- From: Ertugrul Söylemez
- Re: how is Haskell not robust?
- Prev by Date: Re: how is Haskell not robust?
- Next by Date: Re: how is Haskell not robust?
- Previous by thread: Re: how is Haskell not robust?
- Next by thread: Re: how is Haskell not robust?
- Index(es):
Relevant Pages
|