On Mon, Mar 9, 2009 at 10:37 AM, Eugene Kirpichov <[email protected]>wrote:

> I mean, there is no way to write a firstCoord function so that it
> would work, for example, on '\y -> P 42 y' and yield 42.
>
> Except for this one:
>
> firstCoord proj = case (proj undefined) of P x y -> x
>
> However, this requires proj to be non-strict in its remaining argument.
> But this will actually work if you pass "P x" to it for some x,
> because it *is* non-strict in the remaining argument.


That's brilliant.  Any function which behaves like "P x" but is strict in
the second argument is in fact a different function.  So this trick is a
semidecidable pattern for this function.

Bring in the unamb, so we can do interesting things with semidecidable
predicates :-)   (I still don't like the proof obligation of unamb, and
would like to see it picked up to a higher level of abstraction where the
usage is always correct)

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

Reply via email to