Re: [Haskell-cafe] mapTuple

2007-01-13 Thread Grady Lemoine
I knew there must be a way in GHC to do that second example! As for the third example, it might be a slick way to do some super-hyper-refactoring, but I admit I can't think of anything it would be actually necessary for offhand. --Grady On 1/12/07, Cale Gibbard <[EMAIL PROTECTED]> wrote: On 12

Re: [Haskell-cafe] mapTuple

2007-01-12 Thread Cale Gibbard
On 12/01/07, Grady Lemoine <[EMAIL PROTECTED]> wrote: Is there anything in particular you're trying to accomplish? It seems like this is the type of thing you'd accomplish with typeclasses if you had a less general problem than you've presented. For example, > mapShowTuple :: (Show a, Show b)

Re: [Haskell-cafe] mapTuple

2007-01-12 Thread Grady Lemoine
Is there anything in particular you're trying to accomplish? It seems like this is the type of thing you'd accomplish with typeclasses if you had a less general problem than you've presented. For example, mapShowTuple :: (Show a, Show b) => (a, b) -> (String, String) mapShowTuple (x, y) = (sho

[Haskell-cafe] MapTuple is possible and easy

2007-01-11 Thread oleg
Marco Tu'lio Gontijo e Silva wrote: > is there a way to defined something as a map to use in tuples? Yes, it is: and it is quite easy and straightforward. Udo Stenzel > since c would be a variable that ranges over type classes, and that > doesn't exist. Of course it does: please see below (as w

Re: [Haskell-cafe] mapTuple (intersection types?)

2007-01-11 Thread Greg Buchholz
Udo Stenzel wrote: > Marco T?lio Gontijo e Silva wrote: > > is there a way to defined something as a map to use in tuples? I tried > > this: > > > > 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, t

Re: [Haskell-cafe] mapTuple

2007-01-11 Thread Udo Stenzel
Marco Túlio Gontijo e Silva wrote: > is there a way to defined something as a map to use in tuples? I tried > this: > > 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) What you seem to want to do is im

Re: [Haskell-cafe] mapTuple

2007-01-11 Thread Marco Túlio Gontijo e Silva
Em Qui, 2007-01-11 às 16:51 +0100, minh thu escreveu: > 2007/1/11, Marco Túlio Gontijo e Silva <[EMAIL PROTECTED]>: > > Em Qui, 2007-01-11 às 16:14 +0100, minh thu escreveu: > > > you might want invistigate "heterogeneous lists" : in your case, it's > > > "heterogeneous typle". > > > > But aren't

Re: [Haskell-cafe] mapTuple

2007-01-11 Thread David House
On 11/01/07, Marco Túlio Gontijo e Silva <[EMAIL PROTECTED]> wrote: is there a way to defined something as a map to use in tuples? I tried this: 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) Let's think a

Re: [Haskell-cafe] mapTuple

2007-01-11 Thread Arthur van Leeuwen
On 11-jan-2007, at 16:30, Marco Túlio Gontijo e Silva wrote: Em Qui, 2007-01-11 às 16:14 +0100, minh thu escreveu: you might want invistigate "heterogeneous lists" : in your case, it's "heterogeneous typle". But aren't tuples always heterogeneous? Yes, and precisely therein lies the proble

Re: [Haskell-cafe] mapTuple

2007-01-11 Thread minh thu
2007/1/11, Marco Túlio Gontijo e Silva <[EMAIL PROTECTED]>: Em Qui, 2007-01-11 às 16:14 +0100, minh thu escreveu: > you might want invistigate "heterogeneous lists" : in your case, it's > "heterogeneous typle". But aren't tuples always heterogeneous? You're right but the fact you apply a funct

Re: [Haskell-cafe] mapTuple

2007-01-11 Thread Marco Túlio Gontijo e Silva
Em Qui, 2007-01-11 às 16:14 +0100, minh thu escreveu: > you might want invistigate "heterogeneous lists" : in your case, it's > "heterogeneous typle". But aren't tuples always heterogeneous? Regards. -- malebria Marco Túlio Gontijo e Silva Correio (MSN): [EMAIL PROTECTED] Jabber (GTalk): [EMAIL

Re: [Haskell-cafe] mapTuple

2007-01-11 Thread minh thu
2007/1/11, Marco Túlio Gontijo e Silva <[EMAIL PROTECTED]>: Hello, is there a way to defined something as a map to use in tuples? I tried this: 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

[Haskell-cafe] mapTuple

2007-01-11 Thread Marco Túlio Gontijo e Silva
Hello, is there a way to defined something as a map to use in tuples? I tried this: 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