Re: [Haskell-cafe] Overloading functions based on arguments?

2009-02-13 Thread Eugene Kirpichov
class Foobar a b where foobar :: a - b - Int instance Foobar String Int where ... instance Foobar Int String where ... 2009/2/13 Daniel Kraft d...@domob.eu: Hi, I just came across a problem like this: Suppose I've got two related functions that do similar things, and I want to call them

Re: [Haskell-cafe] Overloading functions based on arguments?

2009-02-13 Thread Colin Adams
If you have two functions that do two different things, then they certainly OUGHT to have different names. You can of course put the two functions in different modules. Then they do have different (qualified) names. 2009/2/13 Daniel Kraft d...@domob.eu: Hi, I just came across a problem like

Re: [Haskell-cafe] Overloading functions based on arguments?

2009-02-13 Thread Duncan Coutts
On Fri, 2009-02-13 at 13:25 +0300, Eugene Kirpichov wrote: class Foobar a b where foobar :: a - b - Int instance Foobar String Int where ... instance Foobar Int String where ... But we typically do not to this. It's ugly. Classes work nicely when there is some kind of parametrisation

[Haskell-cafe] Overloading functions based on arguments?

2009-02-13 Thread Daniel Kraft
Hi, I just came across a problem like this: Suppose I've got two related functions that do similar things, and I want to call them the same... Like in: foobar :: String - Int - Int foobar :: Int - String - Int (Bad example, but I hope you got the point.) Is this kind of overloading

Re: [Haskell-cafe] Overloading functions based on arguments?

2009-02-13 Thread Henning Thielemann
Daniel Kraft wrote: Hi, I just came across a problem like this: Suppose I've got two related functions that do similar things, and I want to call them the same... Like in: foobar :: String - Int - Int foobar :: Int - String - Int (Bad example, but I hope you got the point.)