
19 Jan
2009
19 Jan
'09
5:23 a.m.
"John Ky"
Hi,
Possibly a silly question but is it possible to have a function that has a different return type based on it's first argument?
Are you sure that's what you really want?
For instance
data Person = Person { name :: String, ... } data Business = Business { business_number :: Int, ...}
data Entity = Person {...} | Business {...}
key person = name person key business = business_number business
data Key = PersonKey String | BusinessKey Int It seems likely that you are at least sometimes going to want to pass the result of key to some other function. ...? -- Jón Fairbairn Jon.Fairbairn@cl.cam.ac.uk http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2008-04-26)