Expected behavior of "deriving Ord"?
Conal Elliott
conal at conal.net
Thu Mar 20 14:14:28 EDT 2008
Oh -- partial & partial. Thanks. I was pretty puzzled there.
The type argument I ran into trouble with represents a value as a list of
increasing lower bounds, ending in the exact value. min produces lower
bounds from lower bounds and so is immediately productive before even
knowing which argument is the lesser one. (<=) returns Bool, and so cannot
produce any partial information. Unfortunately, the derived Ord instance
omits min which therefore defaults to a definition in terms of (<=), which
therefore cannot produce partial 'a' info.
- Conal
Some references on "improving values":
@Article{Burton91:Encapsulating,
author = {F. Warren Burton},
title = {Encapsulating nondeterminacy in an abstract data type
with deterministic semantics},
journal = {Journal of Functional Programming},
year = 1991,
volume = 1,
number = 1,
pages = {3--20},
month = {January}
}
@inproceedings{Burton89:Indeterminate,
author = {F. Warren Burton},
title = {Indeterminate behavior with determinate semantics in
parallel programs},
booktitle = {FPCA '89: Proceedings of the fourth international
conference on Functional programming languages and computer architecture},
year = {1989},
isbn = {0-89791-328-0},
pages = {340--346},
location = {Imperial College, London, United Kingdom},
doi = {http://doi.acm.org/10.1145/99370.99402},
publisher = {ACM},
address = {New York, NY, USA},
}
On Thu, Mar 20, 2008 at 11:00 AM, Christian Maeder <Christian.Maeder at dfki.de>
wrote:
> Conal Elliott wrote:
> > AddBounds makes total orders from total orders. It just adds new least
> > and greatest elements.
> >
> > The problem with the derived instance is that it doesn't exploit the
> > potential laziness of min on 'a'. Because of their types, min it can
> > produce partial info from partial info and (<=) and compares cannot.
>
> Right, I've mixed up partial orders, partial (infinite?) values as input
> to total order functions. I could not construct an example, though.
>
> min (NoBound MinBound) (NoBound (NoBound undefined))
>
> worked using ghci.
>
> Cheers Christian
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20080320/9c4b393c/attachment.htm
More information about the Glasgow-haskell-users
mailing list