I haven't seen anything like that :-[

On Sun, Jul 31, 2016 at 7:52 AM, OvermindDL1 <[email protected]> wrote:

> I have far too many cases where I translate a port input into a Dict, it
> is a bit of extra noise having to add that wrapper in my subscriptions and
> the port outgoing calls.  Is there anything that makes the Dict conversion
> across Ports more automatic?
>
> On Saturday, July 30, 2016 at 4:14:11 PM UTC-6, Nick Hollon wrote:
>>
>> Elm has never allowed for arbitrary fields to be added to records at
>> runtime ( it used to allow field insertion & deletion, but you still need
>> to know the field names at compile time )
>>
>> Instead of a record, maybe you should represent your data as a dict? This
>> has the property you are looking for.
>>
>> On Jul 30, 2016, at 5:54 PM, Gary Young <[email protected]> wrote:
>>
>> Thanks Duane, but I don't see how your suggestion fixes my problem.
>>
>> My goal is to manipulate a single string variable, call it "theJson",
>> into an Elm list of records so that I can operate on it as I would any
>> other list of records in Elm.
>>
>> So far I believe this cannot be done because Elm doesn't allow record
>> fields to be added at run time.  Previously Elm had the capability of doing
>> this, but it was recently removed.
>>
>> Is my research accurate?  I have a number of applications where I must do
>> this type of thing, and I believe this is a common enough use-case that the
>> Elm creators would want to support it.
>>
>> Thanks!
>>
>>
>> On Saturday, July 30, 2016 at 4:24:43 PM UTC-5, Duane Johnson wrote:
>>>
>>> Yes, if you keep the objects in the Json.Encode.Value type, then you can
>>> contain a tree of arbitrary JSON types all the way down.
>>>
>>> This helped me understand the above Json.Encode.Value type a little bit
>>> better:
>>>
>>> $ elm repl
>>>
>>> > import Json.Encode
>>> > Json.Encode.string "hi"
>>> "hi" : Json.Encode.Value
>>> > Json.Encode.list []
>>> {} : Json.Encode.Value
>>> > Json.Encode.list [Json.Encode.string "hi"]
>>> { 0 = "hi" } : Json.Encode.Value
>>> > Json.Encode.object [("hi", Json.Encode.int 1), ("bye",
>>> Json.Encode.list [Json.Encode.int 1, Json.Encode.int 2])]
>>> { hi = 1, bye = { 0 = 1, 1 = 2 } } : Json.Encode.Value
>>>
>>> So basically, you can keep encoding things as this generic
>>> "Json.Encode.Value" type, and nesting them inside one another. From Elm's
>>> perspective, they're all the same type, so where javascript arrays could
>>> have multiple things in them (e.g. ["one", 2, {3: "four"}]) Elm is ok with
>>> a list of single-type things.
>>>
>>>
>>> On Sat, Jul 30, 2016 at 3:15 PM, Gary Young <[email protected]> wrote:
>>>
>>>> Hi guys,
>>>>
>>>> I have a reporting app where actions by the user generate arbitrary
>>>> lists of objects(records) coming back from a JSON store.  I do not know at
>>>> compile time what the fields in the objects(records) will be.  Can Elm do
>>>> this?  How?
>>>>
>>>> Thanks in advance!
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Elm Discuss" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Elm Discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to