[Haskell-cafe] Overloading functions based on arguments?

Colin Adams colinpauladams at googlemail.com
Fri Feb 13 05:28:59 EST 2009

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 at 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 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
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list