[Haskell-cafe] What's the deal with Clean?

Ketil Malde ketil at malde.org
Thu Nov 5 09:57:54 EST 2009


brian <briand at aracnet.com> writes:

> Haskell knows when I have a list of Doubles, you know, because it's
> strongly typed.

Right - so you can do 

foo, bar :: [Double]
foo = 1:2:3:foo
bar = [1,2,3,undefined,4,5,6]

> Then it proceeds to box them. Huh ?

Otherwise, the above wouldn't work.

For lists of known constants, they could be unboxed and packed into an
array.  But that means you'd have to have two different types of lists,
and if you really want an unboxed array, why not use one explicitly?

> The laziness thing has many example of _reducing_ efficiency, but
> there seems to be a real lack of example where it helps.  In fact it
> seems to _always_ hurt.  People sure seem excited about it.  Me, not
> so excited. 

Well - it allows me to easily process files larger than memory.  Many of
my programs tend to follow a pattern like

   (build operation based on command line switches etc)
   writeFile of =<< map operation . readFile if

Lazy bytestrings is my current favorite, since it reads bytes in an
efficient, packed format, presents a list-like interface, and is
chunkwise lazy, so streaming can be done in constant time.

The "build operation" part often ends up a bit gross, but I have a plan
for that which I hope to come back to later on.

> I've asked this question before and the answer, apparently, is
> polymorphism.

Really?

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list