If I define something like this:

data Bar = Bi Int
        | Bf String
        deriving Show

data Foo = Fi Int
        | Fs Float
        deriving Show

func::Foo -> Bar
func (Fi xx) = Bi xx
func (Fs ff) = Bf (show ff)

I can do:
map func [(Fi 1), (Fs 2.0)]
[Bi 1,Bf "2.0"]

but what i really want to do is just do
map func [1, 2.0]
[1, "2.0"]

I understand that this is impossible in haskell, but why cant the
compiler generate the Foo and Bar data types for me and just require
that i have a func defined for Int -> Int and Float -> String?
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to