[elm-discuss] Re: http.post gives BadResponse 415 "Unsupported Media Type"

2016-07-01 Thread danneu
You can use `Http.send` with a custom request object to set arbitrary headers. Here's an example that send an application/json POST request. judgeImage : Judgement -> Image -> Cmd Msg judgeImage judgement image = let url = "http://localhost:3000/id/"; ++ (toString image.id) ++ "/judge"

[elm-discuss] Re: http.post gives BadResponse 415 "Unsupported Media Type"

2016-07-01 Thread Dirk Vaneynde
Found out that Http.post sends it as 'text/plain' mime, not as 'application/json'. Strange, since it expects a JSON response. Is there a way to force that? Op zaterdag 2 juli 2016 00:21:58 UTC+2 schreef Dirk Vaneynde: > > Hi, I try to post some json via ELM to a java server with jax-rs, > consu

[elm-discuss] http.post gives BadResponse 415 "Unsupported Media Type"

2016-07-01 Thread Dirk Vaneynde
Hi, I try to post some json via ELM to a java server with jax-rs, consuming application/json. It works fine using curl: curl -vH "Content-Type: application/json" -X POST -d '{"robotOn": true}' http://localhost:8080/domo/screenRobotUpdate But it returns 415 error code when using the following

[elm-discuss] Re: [ANN] elm-mdl 6.0.0 released

2016-07-01 Thread Maxwell Gurewitz
Wow looks really slick! On Monday, June 27, 2016 at 7:58:18 AM UTC-7, debois wrote: > > Dear all, > > Version 6.0.0 of elm-mdl is out—check out the live demo > . The new version comprises multiple > bug-fixes and enhancements, and 6(!) new components: Footers,

[elm-discuss] Re: [ANN] elm-mdl 6.0.0 released

2016-07-01 Thread Rindra Ramamonjison
This is one of the best things that happen to Elm this year for two reasons: - a beginner can build shiny apps without learning about many moving parts - an intermediate elmlang user can go through the src code and learn how to build components with elm-parts Kudos! On Monday, June 27, 2016 at

Re: [elm-discuss] Adding a transformation layer to the Elm Architecture

2016-07-01 Thread Robert Walter
Hi Peter, this exchange already helped me to understand some of the nuances of the Elm architecture better, thank you. I'm actually implementing a lot in Elm recently, and while I think writing code is the best way to learn a new technology, it also helps to exchange with peers from time to tim

[elm-discuss] Re: Communicating from parent to child and child to parent

2016-07-01 Thread Wouter In t Velt
Hi Rex, I hope I interpret your setup correctly, but it looks like the flow is more or less: - user clicks a button inside child - this triggers child's update function - child's update function stores updates child model (with a message Click) - the parent can then access the n

[elm-discuss] Re: Communicating from parent to child and child to parent

2016-07-01 Thread Wouter In t Velt
I hope I interpret your setup correctly, but it looks like the flow is more or less: - user clicks a button inside child - this triggers child's update function - child's update function stores updates child model (with a message Click) - the parent can then access the new functio

Re: [elm-discuss] Adding a transformation layer to the Elm Architecture

2016-07-01 Thread Peter Damoc
Robert, What you are describing here can be modeled with current technologies and it relates to the composition that is usually found in The Elm Architecture. Take a look a the nesting examples: https://github.com/evancz/elm-architecture-tutorial/tree/master/nesting These multiple domains that yo

Re: [elm-discuss] Adding a transformation layer to the Elm Architecture

2016-07-01 Thread Robert Walter
Hi Peter, thanks for the response, it might very well be that Elm already has all the capabilities necessary and I'm just not aware of it. Frankly, ports are something I definitely have to look into in more detail before responding properly to your suggestions. While it is possible to chain tr

[elm-discuss] Re: Adding a transformation layer to the Elm Architecture

2016-07-01 Thread Ambrose Laing
Could you do something like this: Tell the Elm Architecture (as it is right now) that your model is (modelA, modelB) where modelA is the type that you want to have as a "stage1" domain, and modelB is what you want for your "stage2". And then as Peter Damoc suggested, compose functions to achie

Re: [elm-discuss] Adding a transformation layer to the Elm Architecture

2016-07-01 Thread Peter Damoc
Hi Robert, I'm trying to understand what you are requesting and I keep seeing records/ADT for domains and plain old functions for the transformations. In other words, I don't really understand what is the show stopper here. For example, let's say that you want to transform the model into a text o

Re: [elm-discuss] combining union types

2016-07-01 Thread Janis Voigtländer
No. You can only do to Msg what you already did to PageMsg and LibMsg (through tagging *their* message "subtypes"). > Am 01.07.2016 um 11:43 schrieb jonathan de montalembert : > > Is there a way to combine two Msg into one? Like (not working) > >> type PageMsg >> = HomeMsg Home.Msg >> | Arc

[elm-discuss] Adding a transformation layer to the Elm Architecture

2016-07-01 Thread Robert Walter
Hello all, not having a strong web development background, but rather coming from the area of domain-specific languages, model-driven development, and IDE development (i.e. building tools for developers and development platforms), Elm made me curious because of a lot of the ideas and features t

[elm-discuss] Re: Help with idea for virtual-dom + polymer

2016-07-01 Thread Kevin Le Brun
I'm a bit late to the party. I recently given a talk at GDG Paris on how to integrate Elm and Polymer. All the examples are located here: https://github.com/kevinlebrun/elm-polymer. I also use a new Elm feature: "keyed nodes". I hope it will help anyone interested in combining those two amazing

[elm-discuss] combining union types

2016-07-01 Thread jonathan de montalembert
Is there a way to combine two Msg into one? Like (not working) type PageMsg > = HomeMsg Home.Msg > | ArchiveMsg Archive.Msg > > type LibMsg > = TranslationMsg Translation.Msg > | PhoenixMsg Phoenix.Msg > > type Msg > = PageMsg > | LibMsg then have update: Msg -> Model -> (Mo