I have a base class,Organization, with name and address functions.
I want classes Buyer and Seller from Organization.

Now if I want to create an 2 instances of Seller
> data Yahoo = Yahoo
> instance Organization Yahoo where
>  name _= "Yahoo"
>  addreess = ...

> data DoubleClick= DoubleClick
> instance Organization DoubleClick where
>  name _ = "DoubleClick"
  ...

Why is [Yahoo,DoubleClick] illegal?  

----
Another approach is to do
> data Organization = Org {
>               name,address::String
>       }

> data Seller = Seller {
>               org::Organization
>               askPrice::Int
>       }

yahoo = Seller (Org "Yahoo" "California") 12

But, that requires you to access
nameYahoo = name org yahoo

when it would make more sense to do
nameYahoo = name yahoo

-----------
It also prevents you from making a list of buyers and sellers that doesn't
lose information.

> func::Organization->Int
> func (Buyer=>b) b = bidPrice b
> func (Seller=>s) s = askPrice s

> result = map func organizationList

should work, I think.

-Alex-


___________________________________________________________________
S. Alexander Jacobson                   i2x Media  
1-212-697-0184 voice                    1-212-697-1427 fax


Reply via email to