On Tuesday 29 June 2010 11:46:47, Ketil Malde wrote:
>
> An important point of a powerful type system is to model your program so
> that only sensible code is legal.

That would be an awesomely powerful type system :)

> This makes me wonder why deleteBy is
> defined so loosely, instead of e.g.
>
>   deleteBy :: (a -> Bool) -> [a] -> [a]

That would've been the (a) safer choice.

>
> I don't think there would be any doubt what 'deleteBy (<= 5) [1..10]'
> would do.

Well, if you don't know about filter, you could think it deletes all 
elements satisfying the predicate, but apart from that, it's clear.

> And I just don't see what the requirement for an equivalence
> relation buys you.

For the type deleteBy has, predictability. Currently, you can't know 
whether deleteBy pred x tests pred x y or pred y x without looking at the 
source. For a symmetric relation, you needn't care.


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

Reply via email to