[Haskell-cafe] Currying and errors

Graham Klyne gk at ninebynine.org
Mon Nov 8 09:20:45 EST 2004


I just found myself writing a function that looked like this:

 >     isSubsumedByWith  :: TBox c -> c -> c -> Bool
 >     isSubsumedByWith [] c d = isALSubsumedBy c d
 >     isSubsumedByWith _  _ _ = error "TBox reasoning not supported for AL"

and immediately noticed that I might also write this:

 >     isSubsumedByWith  :: TBox c -> c -> c -> Bool
 >     isSubsumedByWith [] = isALSubsumedBy
 >     isSubsumedByWith _  = error "TBox reasoning not supported for AL"

which led me to thinking about the difference between these two functions 
(I reason there must be a difference, because the call of 'error' is 
required to fulfil (terminology?) values of different types).

I think it is this:  Suppose I evaluate an expression:

    let s = isSubsumedByWith [foo] in seq s e

then I think the first case will return a legitimate function, albeit one 
that returns error when it is applied, and the second will cause an error 
to be returned immediately.  Am I right?  Is this all?

#g


------------
Graham Klyne
For email:
http://www.ninebynine.org/#Contact



More information about the Haskell-Cafe mailing list