Re: [elm-discuss] Multiple views sharing the same state?

2017-03-03 Thread Peter Damoc
On Fri, Mar 3, 2017 at 10:40 PM, Eirik Sletteberg wrote: > Yes, flags works on startup, but it won't work so well after incremental > updates, will it? > > I guess ports is an option (unless you use union types, which makes that > hard, see the other thread) but I'm a

[elm-discuss] Re: How decode nested Json Structure

2017-03-03 Thread Євген Петров
I fount mistakes in |> required "data" Decode.list change to required "data" decodeConfigs Thank You, Witold Szczerba My final solution I find in https://gist.github.com/yang-wei/0a1cea1194a244aa9be6 decodeConfigs : Decode.Decoder (List Config) decodeConfigs = Decode.at ["data"]

Re: [elm-discuss] Wrong package not found reported using elm-make 0.18.0

2017-03-03 Thread Nick H
This is a nice detailed description of the bug! I see this behavior too. BUT this is not an issue with elm-make. It is an issue with elm-package. And there is already a bug report open there . (elm-make is running elm-package silently, and it is

Re: [elm-discuss] Multiple views sharing the same state?

2017-03-03 Thread Eirik Sletteberg
Yes, flags works on startup, but it won't work so well after incremental updates, will it? I guess ports is an option (unless you use union types, which makes that hard, see the other thread) but I'm a bit concerned about the performance overhead of that. With N components the state has to

Re: [elm-discuss] Re: Sending tagged unions through ports

2017-03-03 Thread Eirik Sletteberg
That looks a bit clumsy to use from JS land though... if you want to read numberOfDoors you'll have to loop through all the fields to find the correct one? The format has to be both correct and easy to work with. fredag 3. mars 2017 19.42.52 UTC+1 skrev Rupert Smith følgende: > > On Friday,

[elm-discuss] Wrong package not found reported using elm-make 0.18.0

2017-03-03 Thread hossameldeenfci
The purpose of this post is for someone to double-check on me before I post an issue to elm-make . *Summary* When a *non-existent package version* is specified (let's call the package *Foo*), instead of *elm-make* saying the error is with package Foo, it

[elm-discuss] Re: Post Examples of Painful Record Updates Here!

2017-03-03 Thread Antoine Snyers
What I find painful is when I need to check for cases inside cases in order to decide whether something should be set or should be kept. ( { model | mode = case model.mode of Drawing maybe -> case maybe of Just shape ->

Re: [elm-discuss] Re: Sending tagged unions through ports

2017-03-03 Thread 'Rupert Smith' via Elm Discuss
On Friday, March 3, 2017 at 4:35:00 PM UTC, Eirik Sletteberg wrote: > > type alias Car = > { numberOfDoors: Int > } > > type alias Plane = > { maxSpeed: Int > } > > type Transport = Walk > | Ride Car > | Fly Plane > Or could be mapped to something that can be described with a

Re: [elm-discuss] Re: Post Examples of Painful Record Updates Here!

2017-03-03 Thread Richard Feldman
On Friday, March 3, 2017 at 8:45:01 AM UTC-8, Mark Hamburg wrote: > > Our codebase suffers from this as well. > Mark, can you post some examples of painful code? As in, not just what you wanted to write but couldn't, but what you ended up writing that's still painful. Real code is much more

[elm-discuss] Re: Post Examples of Painful Record Updates Here!

2017-03-03 Thread Murphy Randle
Here's an example of where record field pattern matching would make things more straight forward: case model.route of Routes.Entry { mode } -> if mode == Read then (hex "FF") else (hex "f6f6f6") _ -> (hex "f6f6f6") If we were able to

Re: [elm-discuss] Re: Sending tagged unions through ports

2017-03-03 Thread Peter Damoc
On Fri, Mar 3, 2017 at 6:18 PM, 'Rupert Smith' via Elm Discuss < elm-discuss@googlegroups.com> wrote: > On Friday, March 3, 2017 at 3:29:34 PM UTC, Peter Damoc wrote: >> >> It makes sense to focus on other issues that are more important BUT, >> people are having enough troubles with boilerplate

Re: [elm-discuss] Re: Post Examples of Painful Record Updates Here!

2017-03-03 Thread Mark Hamburg
Our codebase suffers from this as well. And unlike what one of the follow ups noted, this isn't an issue of wanting to add fields. Rather, it's an issue of not being able to use an expression in the first part of the record update. In this case, one doesn't even need a general expression but

Re: [elm-discuss] Re: Sending tagged unions through ports

2017-03-03 Thread Brian Hicks
> ['Ride', { > numberOfDoors: 4 > }] > > or ['Fly', { > maxSpeed: 1000 > }] Personal experience: I think that tends to be too confusing when the object (inevitably) gets separated from the list. It all needs to be in one piece. I like to use fields beginning in underscores for this, like

Re: [elm-discuss] Re: Sending tagged unions through ports

2017-03-03 Thread Eirik Sletteberg
type alias Car = { numberOfDoors: Int } type alias Plane = { maxSpeed: Int } type Transport = Walk | Ride Car | Fly Plane Could be encoded as [name, encoded] or just [name] if it's only an identifier without a value. So they would be encoded as ['Walk'] or ['Ride', {

[elm-discuss] Re: Post Examples of Painful Record Updates Here!

2017-03-03 Thread 'Rupert Smith' via Elm Discuss
On Friday, March 3, 2017 at 12:15:59 PM UTC, Rupert Smith wrote: > > On Friday, March 3, 2017 at 6:16:15 AM UTC, Richard Feldman wrote: >> >> Re-posting the first example from Franscisco's thread >> : >> > > I think item 2 from

Re: [elm-discuss] Re: Sending tagged unions through ports

2017-03-03 Thread 'Rupert Smith' via Elm Discuss
On Friday, March 3, 2017 at 3:29:34 PM UTC, Peter Damoc wrote: > > It makes sense to focus on other issues that are more important BUT, > people are having enough troubles with boilerplate introduced by decoders > that this could easily be considered a priority. > +1 from me, just for the

Re: [elm-discuss] Re: Sending tagged unions through ports

2017-03-03 Thread Brian Hicks
I could have phrased this more carefully. I meant that we can't blithely pass random strings out to JavaScript without some formality of defining that API. My point about type systems is only salient so far as to say "JS doesn't have union types so there's no direct mapping." > It makes sense

Re: [elm-discuss] Multiple views sharing the same state?

2017-03-03 Thread Peter Damoc
You can pass the common information to the individual Elm components as flags. You could also wire the components by connecting their ports in such a way that one component could push state and that state be sent to the rest of the components. On Fri, Mar 3, 2017 at 3:56 PM, Eirik Sletteberg

Re: [elm-discuss] Re: Sending tagged unions through ports

2017-03-03 Thread Peter Damoc
On Fri, Mar 3, 2017 at 4:38 PM, Brian Hicks wrote: > It makes sense (at least to me) that this isn't supported. Elm has a much > different type system than JavaScript. > I respectfully disagree. It makes sense to focus on other issues that are more important BUT, people

Re: [elm-discuss] Sending tagged unions through ports

2017-03-03 Thread Peter Damoc
On Fri, Mar 3, 2017 at 3:08 PM, Eirik Sletteberg wrote: > An example use case for this would be when gradually porting an existing > Redux-based app to Elm. > One could rewrite state handling from Redux into Elm updaters/messages, > and wrap the Elm app's main updater,

[elm-discuss] Re: Post Examples of Painful Record Updates Here!

2017-03-03 Thread Brian Hicks
The Mantl UI combines several different kinds of data across a large platform-as-a-service-like system. At the top level, I'm handling messages for the model/view/update triples and handling routing. This may not be the *best *architecture, but it's what I came up with as a beginner and I

[elm-discuss] Re: Post Examples of Painful Record Updates Here!

2017-03-03 Thread Brian Hicks
Noah posted an alternate syntax for JSON decoders that could make use of a better record update syntax. (post: https://medium.com/@eeue56/json-decoding-in-elm-is-still-difficult-cad2d1fb39ae#.ia6brcxw5) In short, he suggests decoupling the decoder order from the record order using the

[elm-discuss] Re: Sending tagged unions through ports

2017-03-03 Thread Brian Hicks
It makes sense (at least to me) that this isn't supported. Elm has a much different type system than JavaScript. I could see converting them in a standard way, but that's a ways off yet. For now, try encoding to a Json.Encode.Value - you can send that through a port, and it has a standard

[elm-discuss] Multiple views sharing the same state?

2017-03-03 Thread Eirik Sletteberg
Another use case for a migration from JS app to Elm app; You rewrite one view JS -> Elm, and then another view, and so on, and then some components on the page are JS views, some are Elm views. But if there is state in Elm, it would be desirable for all the views to share the same state (for

[elm-discuss] Sending tagged unions through ports

2017-03-03 Thread Eirik Sletteberg
An example use case for this would be when gradually porting an existing Redux-based app to Elm. One could rewrite state handling from Redux into Elm updaters/messages, and wrap the Elm app's main updater, so that after every message is passed through the updater, it sends the whole state tree

[elm-discuss] Ports and Tasks

2017-03-03 Thread Eirik Sletteberg
I'm trying to build a userland interface for localStorage: -- Send in key port storageGetItem : String -> Cmd msg -- Returns key + Just value if it exists, Nothing if it doesn't. I guess it could also return just the value. port storageGetItemResult : ((String, Maybe String) -> msg) -> Sub

Re: [elm-discuss] Re: Post Examples of Painful Record Updates Here!

2017-03-03 Thread Richard Feldman
Can we express these in terms of examples of real-world code that is currently painful? That's really the key here. :) On Fri, Mar 3, 2017, 4:18 AM 'Rupert Smith' via Elm Discuss < elm-discuss@googlegroups.com> wrote: > Another one I have run into, is when selecting just one field from a >

[elm-discuss] Linear algebra (matrix, vectors, ...) in the context of image processing

2017-03-03 Thread Ian Mackenzie
For your second question, I know there's work being done currently on supporting the Canvas API in Elm (https://github.com/elm-community/canvas), which may be more appropriate for visualizing bitmap data than SVG, but it's still very experimental. -- You received this message because you are

Re: [elm-discuss] Simple way to screen-share an application written in Elm?

2017-03-03 Thread Noah Hall
Sure, in that case you just namespace the event by the device it came from. There's an open-source repo here, containing an implementation for 0.16 -> https://github.com/eeue56/elm-debugger. It should only really be used for inspiration. If you need more help implementing it, then Slack is

[elm-discuss] Re: Post Examples of Painful Record Updates Here!

2017-03-03 Thread 'Rupert Smith' via Elm Discuss
Another one I have run into, is when selecting just one field from a record, there is no syntax to further pattern match on it. Again, abusing the 'as' syntax in a quite different way to how it is currently used, something along these lines: func { field } = let SomeConstructor arg =

[elm-discuss] Re: Post Examples of Painful Record Updates Here!

2017-03-03 Thread 'Rupert Smith' via Elm Discuss
On Friday, March 3, 2017 at 6:16:15 AM UTC, Richard Feldman wrote: > > Re-posting the first example from Franscisco's thread > : > I think item 2 from Franscisco's thread is looking for an easy way to add and remove fields from a

Re: [elm-discuss] Simple way to screen-share an application written in Elm?

2017-03-03 Thread 'Rupert Smith' via Elm Discuss
On Friday, March 3, 2017 at 10:55:30 AM UTC, Noah Hall wrote: > > Like oh-so-many things, I implemented this about 1.5 years ago now. I even > gave 2 talks on it. With Elm 0.17, you can implement it in under 30 lines > of code, using firebase as a host. Sadly, the recordings of both the talks >

[elm-discuss] Parsing AsciiDoc with Elm

2017-03-03 Thread Austin Bingham
Hi all, I'm looking for a way to parse and display AsciiDoc text in an elm app, similar to how evancz/elm-markdown handles markdown. I'm pretty sure I could knock something together myself (by copying the approach in elm-markdown and using asciidoctor.js), but I wanted to first see if anyone

Re: [elm-discuss] Simple way to screen-share an application written in Elm?

2017-03-03 Thread Noah Hall
Like oh-so-many things, I implemented this about 1.5 years ago now. I even gave 2 talks on it. With Elm 0.17, you can implement it in under 30 lines of code, using firebase as a host. Sadly, the recordings of both the talks I gave on it are lost. But you can read it here ->