You guys are great! Thanks.
On Wed, Dec 26, 2012 at 9:04 AM, Timon Gehr wrote:
> On 12/25/2012 09:59 AM, Magicloud Magiclouds 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
On 12/25/2012 09:59 AM, Magicloud Magiclouds 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
c
> {-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables #-}
Hi MagicCloud,
A worse, but perhaps simpler alternative to Oleg's solution uses Data.Dynamic:
> import Data.Dynamic
> data LongDec a = LongDec a a a a a a a a
> deriving (Show, Typeable)
>
> values = "abcdefgh"
> mkLongDec :: forall
Magiclouds asked how to build values of data types with many
components from a list of components. For example, suppose we have
data D3 = D3 Int Int Int deriving Show
v3 = [1::Int,2,3]
How can we build the value D3 1 2 3 using the list v3 as the source
for D3's fields? We can't u
Thinking from subway (: foldl ($) LongDef values ?
вторник, 25 декабря 2012 г. пользователь Тимур Амиров писал:
> Try folding over data type constructor with $?
>
> вторник, 25 декабря 2012 г. пользователь Magicloud Magiclouds писал:
>
>> Forgot to mention, solution without TemplateHaskell.
>>
>>
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.magiclo...@gmail.com 'magicloud.magiclo...@gmail.co