[Haskell-cafe] How to fold on types?

Тимур Амиров timur.deteam at gmail.com
Tue Dec 25 10:58:26 CET 2012


Try folding over data type constructor with $?

вторник, 25 декабря 2012 г. пользователь Magicloud Magiclouds писал:

> Forgot to mention, solution without TemplateHaskell.
>
>
> On Tue, Dec 25, 2012 at 4:59 PM, Magicloud Magiclouds <
> magicloud.magiclouds at gmail.com <javascript:_e({}, 'cvml',
> 'magicloud.magiclouds at gmail.com');>> wrote:
>
>> Say I have things like:
>>
>> data LongDec = LongDef a b c ... x y z
>> values = [ 'a', 'b', 'c', ... 'x', 'y', 'z' ]
>>
>> Now I want them to be "LongDef 'a' 'b' 'c' ... 'x' 'y' 'z'".
>> In form, this is something like folding. But since the type changes, so
>> code like following won't work:
>>
>> foldl (\def value -> def value) LongDef values
>>
>> Is it possible to do this in some way?
>> --
>> 竹密岂妨流水过
>> 山高哪阻野云飞
>>
>> And for G+, please use magiclouds#gmail.com.
>>
>
>
>
> --
> 竹密岂妨流水过
> 山高哪阻野云飞
>
> And for G+, please use magiclouds#gmail.com.
>


-- 
Best
Timur DeTeam Amirov
Moscow, Russia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121225/4b904fec/attachment.htm>


More information about the Haskell-Cafe mailing list