
John Ky
data Person = Person { name :: String, ... } data Business = Business { business_number :: Int, ...}
key person = name person key business = business_number business
Let's make this concrete: data Person = Person { name :: String, age :: Integer } data Business = Business { business_number :: Int, revenue :: Double } key person = name person key business = business_number business Even without dependent types, you can do the following (but of course, you lose some syntactic sugar for records): data Individual k v = Individual { key :: k, value :: v } type Person = Individual String Integer type Business = Individual Int Double name :: Person -> String name = key age :: Person -> Integer age = value business_number :: Business -> Int business_number = key revenue :: Business -> Double revenue = value -- Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig May all beings be well and happy!~