Re: [Haskell-cafe] exceptions vs. Either

4 Aug
2004
4 Aug
'04
8:57 a.m.
mins = map ((\(x:_)->x).sort)
maybe what you meant was: case sort x of (x:_) -> ... do whatever with x ... _ -> ... do failure conition ... As I said, if you can _guarantee_ non failure I guess head is okay, but the fact that this thread started with the observation that the error produced by head is difficault to track dow n we must conclude that programmers make mistakes and cannot be trusted to make such guarantees .... Hence my suggestion to use the type system. Effectively the 'case' forms a guarantee of non-emtyness for the stuff in the case... but you cannot pass this guarantee into functions like 'head' Using the type system to encode such things allows this 'guarantee' to be passed into functions... Keean.
7642
Age (days ago)
7642
Last active (days ago)
0 comments
1 participants
participants (1)
-
MR K P SCHUPKE