Hi,
Does the subclass relation have any meaning when two classes have instances with the same type?
I get the same results from Listing 1 and Listing 2 below.
Regards,
Pat
-- ====Listing 1- Subclass====
data Shed = Shed
class Building building where
addressB :: building -> Integer
addressB b = 1
-- subclass, but none in Listing 2
class Building house => House house where
addressH :: house -> Integer
addressH b = 0
instance Building Shed where
instance House Shed where
-- ====Listing 2 -- No subclass====
data Shed = Shed
class Building building where
addressB :: building -> Integer
addressB b = 1
-- No subclass
class House house where
addressH :: house -> Integer
addressH b = 0
instance Building Shed where
instance House Shed where
-- Test runs give same result for Listing 1 and Listing 2
-- addressH Shed
-- addressB Shed
Does the subclass relation have any meaning when two classes have instances with the same type?
I get the same results from Listing 1 and Listing 2 below.
Regards,
Pat
-- ====Listing 1- Subclass====
data Shed = Shed
class Building building where
addressB :: building -> Integer
addressB b = 1
-- subclass, but none in Listing 2
class Building house => House house where
addressH :: house -> Integer
addressH b = 0
instance Building Shed where
instance House Shed where
-- ====Listing 2 -- No subclass====
data Shed = Shed
class Building building where
addressB :: building -> Integer
addressB b = 1
-- No subclass
class House house where
addressH :: house -> Integer
addressH b = 0
instance Building Shed where
instance House Shed where
-- Test runs give same result for Listing 1 and Listing 2
-- addressH Shed
-- addressB Shed
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe