Well, in this example I don't see how this would even be close to possible. How would it know that 1 is supposed to be an Int a2.0 a Float? 1 has type 'Num a => a' and 2.0 has type 'Fractional a => a' so how the compiler know you want Int and Float?
<br><br> -- Lennart<br><br><div><span class="gmail_quote">On 6/16/07, <b class="gmail_sendername">Anatoly Yakovenko</b> <<a href="mailto:aeyakovenko@gmail.com">aeyakovenko@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
If I define something like this:<br><br>data Bar = Bi Int<br> | Bf String<br> deriving Show<br><br>data Foo = Fi Int<br> | Fs Float<br> deriving Show<br><br>func::Foo -> Bar<br>func (Fi xx) = Bi xx
<br>func (Fs ff) = Bf (show ff)<br><br>I can do:<br>> map func [(Fi 1), (Fs 2.0)]<br>[Bi 1,Bf "2.0"]<br><br>but what i really want to do is just do<br>map func [1, 2.0]<br>[1, "2.0"]<br><br>I understand that this is impossible in haskell, but why cant the
<br>compiler generate the Foo and Bar data types for me and just require<br>that i have a func defined for Int -> Int and Float -> String?<br>_______________________________________________<br>Haskell-Cafe mailing list
<br><a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br></blockquote></div><br>