[Haskell-cafe] mapTuple

Marco Túlio Gontijo e Silva malebria at riseup.net
Thu Jan 11 10:05:31 EST 2007


is there a way to defined something as a map to use in tuples? I tried

mapTuple f (a, b) = (f a, f b)

But the type inferred to it is not as generic as I wanted:

mapTuple :: (t -> t1) -> (t, t) -> (t1, t1)

Then I tried a different, but not much, implementation:

mapTuple' f g (a, b) = (f a, g b)
mapTuple f = mapTuple' f f

But the inferred type was the same.

Is there a way to define a function in which I can be able to do
something as this?

mapTuple show ("string", True)

Marco Túlio Gontijo e Silva
Correio (MSN): malebria at riseup.net
Jabber (GTalk): malebria at jabber.org
Telefone: 33346720
Celular: 98116720
  Rua Paula Cândido, 257/201
  Gutierrez 30430-260
  Belo Horizonte/MG Brasil

More information about the Haskell-Cafe mailing list