[Haskell-cafe] Re: Laws and partial values
roconnor at theorem.ca
roconnor at theorem.ca
Sat Jan 24 19:03:35 EST 2009
On Sat, 24 Jan 2009, Jake McArthur wrote:
> What you said makes little sense to me either. ;) But I will try to fit the
> pieces together as best I can.
> It appears to me that you may be talking about isomorphisms between the
> concepts we try to map to data types and the data representations themselves,
> and that you are postulating that these concepts are necessarily total,
> therefore the representations should be as well, or something like that.
I'm saying that the concepts are necessarily total. Acutally, now that I
think about it, the concepts might not even have a CPO, so perhaps it is
not meaningful to talk about if the concepts are total or not. So I'll
refine my position to saying that the concepts just are.
Their represenatives may not be total. For example we represent the
concept of the reciprocal over Rational (whose domain excludes 0) by a
represenative, recip :: Rational -> Rational, which is a partial function.
In this case we could imagine an alternative implemenation of recip' ::
NonZeroRational -> Rational, which also represents the concept of the
reciprocal and is a total function. But in other cases such an
alternative represenatitive cannot exist (e.g. recip for CReal).
I belive it is the case that the concepts are isomorphic to the
represenatives under a specific PER. I cannot imagine it any other way.
Anyhow, the big point is that monoid laws apply to the concepts, not to
> If my understanding of your point is correct, then I disagree with it. What
> you describe sounds like abstraction, and what you describe as a partial
> function sounds like a *leaky* abstraction. If we truly want to restrict the
> domain of a function to nonzero real numbers, then the "total" way to go
> about it would be to create a new type that represents this domain, say by
> wrapping your real number type with a newtype and only exporting smart
> constructors to build values of that type.
Ah, but it is impossible to create such smart constructors because it is
undecidable if a particular CReal represents 0 or not.
> Deep inside, the function will definitely require a partial expression,
> but this is abstracted away. Then you can define a Monoid instance for
> this domain without fear.
> But you *still* have to account for nontermination. You can still arrive at a
> situation where you have
> _|_ `mappend` nonzeroRealNum
Since _|_ is a represenative that has no corresponding concept, the above
program is simply an error.
> . I hope I have understood correctly. I feel that I have not and that this
> email will just contribute to the confusion of other readers. :\
I hope I can work out my underdeveloped viewpoint through conversation.
Hopefully I'll either see that I'm wrong, or convince people that I'm
right. :) I'm sort of refining it as I go along here.
Russell O'Connor <http://r6.ca/>
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''
More information about the Haskell-Cafe