[Haskell-beginners] Equivalence of Inheritance
Russ Abbott
russ.abbott at gmail.com
Tue Dec 14 21:27:57 CET 2010
What I'm after is a version of my example that compiles. Can you make one?
*
-- Russ *
*
*
On Tue, Dec 14, 2010 at 12:18 PM, Antoine Latter <aslatter at gmail.com> wrote:
> Sorry, I really don't know enough about what you're after to attempt that.
>
> But you'll need to change you're signatures of the form:
>
> > function :: Person -> Foo
>
> to something of the form:
>
> > function :: Person p => p -> Foo
>
> Because again, a type class can not be used as a type.
>
> Antoine
>
> On Tue, Dec 14, 2010 at 2:12 PM, Russ Abbott <russ.abbott at gmail.com>
> wrote:
> > What got fouled up is all the adjustments I had to make to the other
> > declarations.
> > Can you complete the example so that it compiles using
> >
> > class Person p where ...
> >
> > I'd very much like to see an example that actually compiles.
> >
> > Thanks.
> > -- Russ
> >
> > On Tue, Dec 14, 2010 at 11:58 AM, Antoine Latter <aslatter at gmail.com>
> wrote:
> >>
> >> On Tue, Dec 14, 2010 at 1:52 PM, Russ Abbott <russ.abbott at gmail.com>
> >> wrote:
> >> > If gender is a field in a Person type, then a Person must have both an
> >> > ovaryCondition and a prostateCondition. That seems awkward.
> >> > Regarding
> >> > class Person p where
> >> > I started down that path but got completely fouled up.
> >>
> >> How did this get fouled up? Every class declaration must take
> >> arguments - here, 'p' is the argument for the class.
> >>
> >> Thanks,
> >> Antoine
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20101214/b87e050e/attachment-0001.htm>
More information about the Beginners
mailing list