[Haskell-cafe] Overloading functions based on arguments?

Daniel Kraft d at domob.eu
Fri Feb 13 05:27:01 EST 2009


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 (instead of the polymorphism based 
overloading) possible in Haskell?  Namely to have two functions with the 
same name but different signatures so they could be distinguished by a 
call's parameters?  I fear not...  So I guess I have to name the 
functions differently, right?

Thanks,
Daniel



More information about the Haskell-Cafe mailing list