At 11:31 08/11/04 -0800, John Meacham wrote:
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)

Developing this line... I think it may be more than *just* an academic curiosity. My intuition is that the latter of my example might actually produce a more useful diagnostic in the event of an error being generated.


I used seq in my example to avoid getting tied up with laziness, but I can see it might not be possible to expose the difference without some kind of strictness being enforced.

#g


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

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

Reply via email to