[Haskell-cafe] Currying and errors

John Meacham john at repetae.net
Mon Nov 8 14:31:18 EST 2004


On Mon, Nov 08, 2004 at 02:20:45PM +0000, Graham Klyne wrote:
> 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?

It is my understanding (someone correct me if I am wrong) that 'seq' is
the one and only way to determine the difference between 
_|_ and \_ -> _|_
and this causes some theoretical problems. I would actually like to hear
more about what sort of problems this causes from a theory point of view
if anyone has some references. (I know the practical advantages of
having seq in the language are great so this is just academic curiosity) 
        John

-- 
John Meacham - ⑆repetae.net⑆john⑈ 


More information about the Haskell-Cafe mailing list