Re: [Haskell-cafe] Usage question with TemplateHaskell and Generic

2011-11-11 Thread Magicloud Magiclouds
2011/11/7 José Pedro Magalhães :
> Hi,
> I'm not sure I understand your question. But if you mean that you want to
> retrieve the type variable names, as they were defined in the source, then I
> can tell you that the generic deriving mechanism cannot do this.
>
> Cheers,
> Pedro
>
> On Sun, Nov 6, 2011 at 14:35, Magicloud Magiclouds
>  wrote:
>>
>> Hi,
>>  I'd like to simpler the work of deriving MyClass. And I have two
>> ways to do: TemplateHaskell "$(derivingMyClass)", or Generic "deriving
>> (MyClass)".
>>  Since I need to get the type name in the deriving, then I met this
>> question: If I have "data A b = C b", then with TemplateHaskell, the
>> type would be "VarT b", which means at compile time, I cannot get the
>> exact type, so the type name would be "b".
>>  So I wonder if this could be resolved by TemplateHaskell, or Generic
>> is the only choice.
>>
>> PS: I have not tried to do this in Generic.
>> --
>> 竹密岂妨流水过
>> 山高哪阻野云飞
>>
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>

Thank you. After deeply thinking about this, GH sure does not

-- 
竹密岂妨流水过
山高哪阻野云飞

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Usage question with TemplateHaskell and Generic

2011-11-07 Thread José Pedro Magalhães
Hi,

I'm not sure I understand your question. But if you mean that you want to
retrieve the type variable names, as they were defined in the source, then
I can tell you that the generic deriving mechanism cannot do this.


Cheers,
Pedro

On Sun, Nov 6, 2011 at 14:35, Magicloud Magiclouds <
magicloud.magiclo...@gmail.com> wrote:

> Hi,
>  I'd like to simpler the work of deriving MyClass. And I have two
> ways to do: TemplateHaskell "$(derivingMyClass)", or Generic "deriving
> (MyClass)".
>  Since I need to get the type name in the deriving, then I met this
> question: If I have "data A b = C b", then with TemplateHaskell, the
> type would be "VarT b", which means at compile time, I cannot get the
> exact type, so the type name would be "b".
>  So I wonder if this could be resolved by TemplateHaskell, or Generic
> is the only choice.
>
> PS: I have not tried to do this in Generic.
> --
> 竹密岂妨流水过
> 山高哪阻野云飞
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Usage question with TemplateHaskell and Generic

2011-11-06 Thread Magicloud Magiclouds
Hi,
  I'd like to simpler the work of deriving MyClass. And I have two
ways to do: TemplateHaskell "$(derivingMyClass)", or Generic "deriving
(MyClass)".
  Since I need to get the type name in the deriving, then I met this
question: If I have "data A b = C b", then with TemplateHaskell, the
type would be "VarT b", which means at compile time, I cannot get the
exact type, so the type name would be "b".
  So I wonder if this could be resolved by TemplateHaskell, or Generic
is the only choice.

PS: I have not tried to do this in Generic.
-- 
竹密岂妨流水过
山高哪阻野云飞

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe