"John Ky" <[email protected]> writes:
> 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 [email protected]
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2008-04-26)
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe