Re: [elm-discuss] Passing decoding results to another decoder in 0.18.0

2016-11-16 Thread Kk Kruups
Hi Tim, For an in depth discussion on Json Decode you might want to refer to article on Medium about Json Decode API and Json Decode Pipeline API. https://medium.com/@kkruups/elm-insights-c74047637206#.phhn8xvml I would love to get your feedback on the article. Kkruups On Wednesday,

Re: [elm-discuss] Async requests in 0.18.0

2016-11-16 Thread Peter Damoc
On Wed, Nov 16, 2016 at 11:32 PM, Tim Bezhashvyly wrote: > Is is possible to read a JSON which is array of objects? Like [ {}, {}, {} > ]? In my example I have { "shows" : [ {}, {}, {} ] } and I'm catching a > field by name but I'm wondering if it is possible to

[elm-discuss] Re: Suggested edit to Json.Decode docs

2016-11-16 Thread Kk Kruups
Hi Wouter, You might want to check out the article on Medium about Json Decode and Json Decode Pipeline API for in depth info on these API. https://medium.com/@kkruups/elm-insights-c74047637206#.phhn8xvml BR/Kkruups On Wednesday, November 16, 2016 at 9:09:06 PM UTC+9, Wouter In t Velt wrote:

Re: [elm-discuss] Welcome feedback on article about JSON Decoding Posted on Medium

2016-11-16 Thread Kk Kruups
Hi Duane, Thanks for the tip. I have already updated with code blocks. Should be an easier read now! :) BR/ On Thursday, November 17, 2016 at 11:39:11 AM UTC+9, Duane Johnson wrote: > > If you'd like to clean up the code blocks, apparently `Cmd+6` does the > trick on medium.com: > > >

Re: [elm-discuss] Welcome feedback on article about JSON Decoding Posted on Medium

2016-11-16 Thread Duane Johnson
If you'd like to clean up the code blocks, apparently `Cmd+6` does the trick on medium.com: https://help.medium.com/hc/en-us/articles/214465537-How-can-I-include-a-code-snippet-or-block-in-a-story- On Wed, Nov 16, 2016 at 7:06 PM, Kk Kruups wrote: > hi folks, I just posted

[elm-discuss] Re: elm-repl cannot find module Tuple

2016-11-16 Thread David Legard
I should have mentioned that this in on Elm 0.18. On Thursday, November 17, 2016 at 9:24:50 AM UTC+7, David Legard wrote: > > Started an elm-repl session and the message came up > > I cannot find the module Tuple. > > > Module 'Repl' is trying to import it. > > > Any ideas? > -- You received

[elm-discuss] elm-repl cannot find module Tuple

2016-11-16 Thread David Legard
Started an elm-repl session and the message came up I cannot find the module Tuple. Module 'Repl' is trying to import it. Any ideas? -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails

[elm-discuss] Welcome feedback on article about JSON Decoding Posted on Medium

2016-11-16 Thread Kk Kruups
hi folks, I just posted an article on Medium about JSON Decoding using NoRedInk's Pipeline API and Json.Decode would love to get your feed back. Here is the link: https://medium.com/@kkruups/elm-insights-c74047637206#.r1xxsxv5h Thanks, KK -- You received this message because you are

[elm-discuss] Re: Suggested edit to Json.Decode docs

2016-11-16 Thread Evan
Those docs came from a draft API that didn't ultimately make it. I'll make an edit! On Wednesday, November 16, 2016 at 5:59:52 AM UTC-8, Max Goldstein wrote: > > That's probably an oversight. Yes, docs for core should not reference a > third-party library. -- You received this message

Re: [elm-discuss] Re: ANN: update-clock for fixed-time-step game loops

2016-11-16 Thread Nick H
Sorry about that. Thanks for taking proper credit! On Wed, Nov 16, 2016 at 9:23 AM, Rex van der Spuy wrote: > Wow, that's absolutely brilliant!!! > (My username was `d13` by the way - so that was me!) > Congratulations!!! > > -- > You received this message because you are

Re: [elm-discuss] Async requests in 0.18.0

2016-11-16 Thread Tim Bezhashvyly
Great! Thanks a lot. And if we already stared talking about decoders I have one last (absolutely academic) question. Is is possible to read a JSON which is array of objects? Like [ {}, {}, {} ]? In my example I have { "shows" : [ {}, {}, {} ] } and I'm catching a field by name but I'm

Re: [elm-discuss] Async requests in 0.18.0

2016-11-16 Thread Peter Damoc
On Wed, Nov 16, 2016 at 10:50 PM, Tim Bezhashvyly wrote: > Makes sense but doesn't change much: > > (|>) is expecting the right side to be a: Http.Request Shows -> a But the >> right side is: Http.Request (Maybe Shows) -> Cmd Msg > > Ok, now we're cooking. You have a

[elm-discuss] Re: Checkbox example

2016-11-16 Thread Desmond D'Souza
Try feeding the model property through to *view* : view : Model -> Html Msg view model = fieldset [] [ checkbox model.notifications ToggleNotifications "Email Notifications" , checkbox model.autoplay ToggleAutoplay "Video Autoplay" , checkbox model.location ToggleLocation "Use

Re: [elm-discuss] Async requests in 0.18.0

2016-11-16 Thread Tim Bezhashvyly
And just file name works fine as it in the same dir as elm file. On Wednesday, November 16, 2016 at 9:40:45 PM UTC+1, Peter Damoc wrote: > > Ok, first, try simply removing Http.toTask as that is not needed at all > there. > > triggerReadingFromJson = > Http.get "shows.json" decoderColl > |>

Re: [elm-discuss] Async requests in 0.18.0

2016-11-16 Thread Tim Bezhashvyly
Makes sense but doesn't change much: (|>) is expecting the right side to be a: Http.Request Shows -> a But the > right side is: Http.Request (Maybe Shows) -> Cmd Msg On Wednesday, November 16, 2016 at 9:40:45 PM UTC+1, Peter Damoc wrote: > > Ok, first, try simply removing Http.toTask as that

Re: [elm-discuss] Async requests in 0.18.0

2016-11-16 Thread Peter Damoc
Ok, first, try simply removing Http.toTask as that is not needed at all there. triggerReadingFromJson = Http.get "shows.json" decoderColl |> Http.send handleRequest And second, you need a full URL for the "shows.json" not just a file name. On Wed, Nov 16, 2016 at 10:26 PM, Tim

[elm-discuss] Re: Checkbox example

2016-11-16 Thread Desmond D'Souza
Try changing *update *to this: { model | notifications = True } -- instead of { model | notifications = not model.notifications } Stateful elements, including checkboxes, seem to ignore what Elm tells them, and simply use their own internal current state. Not sure what virtual dom is (or

Re: [elm-discuss] Async requests in 0.18.0

2016-11-16 Thread Tim Bezhashvyly
Here is my full program: import Html exposing (..) import Http import Table exposing (defaultCustomizations) import Json.Decode as Json exposing (field) import Task main = Html.program { init = init , update = update , view = view , subscriptions = \_ -> Sub.none } -- MODEL type

Re: [elm-discuss] Async requests in 0.18.0

2016-11-16 Thread Tim Bezhashvyly
This gives me (|>) is expecting the right side to be a: Task.Task Http.Error MyType -> a But > the right side is: Http.Request (Maybe MyType) -> Cmd Msg but maybe this is an artefact of old 0.17 architecture where I was too defensive for the case if reading JSON fails. Sorry for trowing

Re: [elm-discuss] Async requests in 0.18.0

2016-11-16 Thread Peter Damoc
On Wed, Nov 16, 2016 at 8:19 PM, Tim Bezhashvyly wrote: > You mean something like: > > triggerReadingFromJson = > Http.toTask (Http.get "my.json" decoder) > |> Task.andThen (\result -> Task.succeed result) > |> Task.onError (\error -> Task.fail error) > >

Re: [elm-discuss] Async requests in 0.18.0

2016-11-16 Thread Tim Bezhashvyly
You mean something like: triggerReadingFromJson = Http.toTask (Http.get "my.json" decoder) |> Task.andThen (\result -> Task.succeed result) |> Task.onError (\error -> Task.fail error) But in this case the result is "Task.Task Http.Error MyType". What can I do with it? I need somehow cast it

[elm-discuss] Re: ANN: update-clock for fixed-time-step game loops

2016-11-16 Thread Rex van der Spuy
Wow, that's absolutely brilliant!!! (My username was `d13` by the way - so that was me!) Congratulations!!! -- 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

[elm-discuss] Checkbox example

2016-11-16 Thread Mark Hamburg
The checkbox example on the Elm site initializes the model to have all the checkboxes set, but does not reflect this state when it runs since it never feeds the model values through to the view. I notice this in a lot of Elm examples. For example, the sign up form example doesn't populate the

[elm-discuss] Re: Converting a UTC date to a local one?

2016-11-16 Thread Justin Mimbs
What format are you receiving your UTC dates in? If they are proper ISO 8601 strings, then you can get the expected Date with `fromIsoString` from here: http://package.elm-lang.org/packages/justinmimbs/elm-date-extra/2.0.1/Date-Extra#fromIsoString. To be recognized as UTC time the string must

Re: [elm-discuss] Async requests in 0.18.0

2016-11-16 Thread Tim Bezhashvyly
Chained to Task.andThen and Task.onError? And what those tow must return? I assume commands as they can't change model directly, right? On Wednesday, November 16, 2016 at 2:46:41 PM UTC+1, Peter Damoc wrote: > > Sorry, old habits. > > The Http API became Cmd oriented. You don't need

[elm-discuss] Suggested edit to Json.Decode docs

2016-11-16 Thread Max Goldstein
That's probably an oversight. Yes, docs for core should not reference a third-party library. -- 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

Re: [elm-discuss] Async requests in 0.18.0

2016-11-16 Thread Tim Bezhashvyly
Thank. This makes lots of sense in regards of first argument. What about the second? In 0.17 it could be for example: (Http.get "my.json" decoderFunction) But not it produced an error: Function `attempt` is expecting the 2nd argument to be: Task.Task > Http.Error (Maybe MyType) But it is:

Re: [elm-discuss] Async requests in 0.18.0

2016-11-16 Thread Peter Damoc
The old Task.perform was creating either a success message (if it succeeded) or a fail message (if it failed) The current Task.perform cannot fail. It is used for Tasks that are known to succeed like requesting the window size or requesting some random number. The Task.attempt takes a function

Re: [elm-discuss] Async requests in 0.18.0

2016-11-16 Thread Janis Voigtländer
Where in 0.17 you had Task.perform f g, you can replace that in 0.18 by simply Task.attempt (unpack f g), where unpack is from http://package.elm-lang.org/packages/elm-community/result-extra/2.0.1. ​ 2016-11-16 14:05 GMT+01:00 Tim Bezhashvyly : > Sorry again if

[elm-discuss] Suggested edit to Json.Decode docs

2016-11-16 Thread Wouter In t Velt
In the Json.Decode docs I ran into unfamiliar functions in an example in the lazy section. comment : Decoder Commentcomment = object Comment

Re: [elm-discuss] Re: Correct use of port subscriptions in a submodule reused multiple times?

2016-11-16 Thread Witold Szczerba
Thanks for the extended feedback :) I will be back here once I have something big enough! Regards, Witold Szczerba On Wed, Nov 16, 2016 at 10:13 AM, Wouter In t Velt wrote: > Op dinsdag 15 november 2016 23:03:31 UTC+1 schreef Witold Szczerba: >> >> Thank you, Wouter

Re: [elm-discuss] Help for article review for SPA applications in Elm 0.18

2016-11-16 Thread Adrián Ribao
Hi, thanks! and than you for your suggestions! I think that explaining in the beginning what you can learn from the post is a very good idea. Thanks for your feedback because it was really helpful. Adrián El martes, 15 de noviembre de 2016, 23:14:47 (UTC+1), Wouter In t Velt escribió: > >

Re: [elm-discuss] Listening to messages from different modules on an update

2016-11-16 Thread Peter Damoc
You need to map the submodule Cmd to the top module Cmd init : ( Model, Cmd Msg ) init = ( { -- my model here } , Cmd.map AMsg getJson ) (as OvermindDL1 pointed aMsg is not a valid type constructor) On Wed, Nov 16, 2016 at 12:50 AM, Tim Bezhashvyly wrote: >