Stefan O'Rear wrote:
Unfortunately, ignoring purity is fraught with peril.  One notable
example recently is in HAppS, a Haskell web framework.  Alex Jacobson (a
haskeller of significant note, not some "clueless newbie") accidentally
wrote { length xs > 0 } instead of { not (null xs) } in some parsing
code.  Which would just be inefficient, normally, but it demanded the
whole thing, which as it happened was a lazy stream coming of a socket.
Bad data dependencies, bang, deadlock.

Ouch! That's gotta sting...

I wasn't aware that this function was so leathal. I use it constantly all the time...

Option 2. Ignore lists

It's possible to describe lists threaded with something else.

data ListT m a = m (ListT' m a)
data ListT' m a = NilT | ConsT a (ListT m a)

You get your safety back ... and lose the standard list functions, list
syntax, list comprehensions, list instances, strings-as-lists, et
cetera.

That's... interesting...

(I feel yet another "I'm going to have to sit down and think about that one" comming on.)

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to