
10 Mar
2013
10 Mar
'13
3:47 a.m.
Thank you all for your answers, this helps a lot. To clarify my last point ...
Also again, taking this way I can not provide several constructors taking inputs of different types, can I ? Sorry, didn't get what you mean here.
In C++ it is perfectly normal to have overloaded functions like f : Int -> Int -> Int f : Int -> Char -> Int in coexistence, because the compiler can infer (at compile time) what function to call by looking at the arguments types. In Haskell I think this is not possible simply due to the flexibility given by partial function application, i.e. f 5 would not be well defined any more, it could be Int -> Int or Char -> Int. Thanks again and kind regards Peter