Re: [elm-discuss] Making new Cmds

2016-05-24 Thread Peter Damoc
succeed : Msg -> Cmd Msg succeed msg = Task.perform never (Task.succeed msg) with `never` from elm-community/basics-extra On Wed, May 25, 2016 at 9:53 AM, Wil C wrote: > It turns out it doesn't. What's the correct way to do this? > > Wil > > On Tuesday, May 24, 2016 at 10:48:33 AM UTC-7

Re: [elm-discuss] Making new Cmds

2016-05-24 Thread Wil C
It turns out it doesn't. What's the correct way to do this? Wil On Tuesday, May 24, 2016 at 10:48:33 AM UTC-7, Janis Voigtländer wrote: > > This is not doing what you almost certainly think it does. > ​ > > 2016-05-24 18:44 GMT+02:00 Wil C >: > >> It's just an aside, in case someone searches for

Re: [elm-discuss] Elm 0.16 access

2016-05-24 Thread Peter Damoc
Hi Mark, Elm is in development and minor releases can still break things in a big way. This is what happened with the switch from 0.16 to 0.17. This release got rid of Signals which have been with Elm since its conception. Lua's development is in a different stage where you can do minor releases

[elm-discuss] Re: what's the preferred way to implement the submit mentioned in elm guide?

2016-05-24 Thread Magnus Rundberget
I was about to write up in detail how you could do it, but that would take away some learning from you so here are some ideas: - Putting color in the model strikes me as a bad idea, that should be a view concern that should be possible to derive from the model - Maybe you could try to define a t

[elm-discuss] what's the preferred way to implement the submit mentioned in elm guide?

2016-05-24 Thread 诺铁
hi, in http://guide.elm-lang.org/architecture/user_input/forms.html , there is an exercise: - Add a "Submit" button. Only show errors *after* it has been pressed. I tried and find it not as easy as I thought. I have to put color and message in the model, I put the result code here: https://gi

Re: [elm-discuss] Static Tzpe Checking in Elm vs Java

2016-05-24 Thread Zachary Kessin
A major issue is the "Maybe". In Java a type can be null so you always have to check for that. WHile in Elm there is difference between "Maybe User" and "User". So the type system will prevent any form of null pointer exception. Zach ᐧ On Tue, May 24, 2016 at 10:06 PM, Joey Eremondi wrote: > Ar

[elm-discuss] program crashes when standalone but not within elm-reactor

2016-05-24 Thread Fernando Alegre
Is this a known issue? I have some code that works fine when I run it with elm-reactor, but when I try to compile it with elm-make and load the index.html file into the browser I get a blank screen and a couple of JavaScript console errors: index.html:8729 Uncaught TypeError: Cannot read proper

Re: [elm-discuss] interesting article

2016-05-24 Thread Nick H
Cool, thanks for that example. I can see the advantage of decoupling the actions from the effects. Even without being enforced by the core platform, I think an Elm programmer could follow this pattern without too much trouble. Much in the same way that the current platform architecture was origina

Re: [elm-discuss] interesting article

2016-05-24 Thread James Wilson
My impression from a brief discussion on the gitter chat room (https://gitter.im/jdubray/sam) about SAM with the creator is that basically if you turn: update msg model = case msg of Increment -> (model + 1, Cmd.none) Decrement -> (model - 1, someEffect) into updateModel msg model = ca

Re: [elm-discuss] Static Tzpe Checking in Elm vs Java

2016-05-24 Thread Joey Eremondi
Are you interested in the actual type checking algorithms, or just the type systems? Big differences of the type systems: * Elm has tagged union types, meaning that you can make a value that many have one of many types, and pattern match on its possible variants. * Elm has type inference, Java d

Re: [elm-discuss] interesting article

2016-05-24 Thread Stefan Houtzager
> What would need to change in the Elm architecture for it to match SAM? I'm just someone interested in learning elm, so I cannot answer. Are the architects of elm, following these messages, who can? Evan Czaplicki? And is this interesting enough to contact Jean-Jacques Dubray, Evan? Op dinsda

Re: [elm-discuss] interesting article

2016-05-24 Thread Nick H
Peter's description is very close to how I manage states in my code. It never occurred to me that it might have its own name; it just seemed the most natural way to manage states within the Elm Architecture. The model is a union type. The action is a union type. The update function is just a case

[elm-discuss] Static Tzpe Checking in Elm vs Java

2016-05-24 Thread John Orford
Can someone /wittily/ sum up the experience of type checking in Java vs something pure like Elm? I feel purity, preciseness and descriptiveness is the main difference somehow... Java is too long in the distant past for me, but it's something I love about Elm and never really cared for in language

Re: [elm-discuss] Making new Cmds

2016-05-24 Thread Janis Voigtländer
This is not doing what you almost certainly think it does. ​ 2016-05-24 18:44 GMT+02:00 Wil C : > It's just an aside, in case someone searches for it. Here's how to make > new commands: > > Cmd.map (\_ -> NewMsg) Cmd.none > > It wasn't obvious to me. > > Wil > > -- > You received this message bec

Re: [elm-discuss] Integer / String Input in HTML

2016-05-24 Thread Nick H
Result has its own withDefault function. You do not need to convert the Result to a Maybe. On Tue, May 24, 2016 at 9:15 AM, Thomas Coopman wrote: > I do not completely agree that the solution is not so nice. > The app can return an invalid string and here you are enforced to do > something with

[elm-discuss] Making new Cmds

2016-05-24 Thread Wil C
It's just an aside, in case someone searches for it. Here's how to make new commands: Cmd.map (\_ -> NewMsg) Cmd.none It wasn't obvious to me. Wil -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receivi

[elm-discuss] Trigger child action from parent

2016-05-24 Thread TheGryzor123
I created a child component that is supposed to display notifications coming from the parent. I know how to initialize and listen to a child but here I would like to tell him to execute actions for me. What do you suggest me to do? -- You received this message because you are subscribed to th

[elm-discuss] Elm 0.16 access

2016-05-24 Thread Mark Hamburg
I was talking with coworkers about my team's experiments with Elm and I found myself having to blunt their interest because of the current state of Elm 0.17 — documentation still has holes, tutorials haven't had a chance to arise, some functionality is still missing relative to 0.16, etc. This w

Re: [elm-discuss] Integer / String Input in HTML

2016-05-24 Thread Thomas Coopman
I do not completely agree that the solution is not so nice. The app can return an invalid string and here you are enforced to do something with it explicitly. You do have to check if this implementation is acceptable for you, because now, when the user enters an invalid string, you will change his

Re: [elm-discuss] Re: Union type list

2016-05-24 Thread Mark Hamburg
Whenever you accessed the list, you would get an element of type A | B. To use if further, you would need to type case it, pass it to something that wanted A| B or A | B | C etc, or put it through some sort of type cast operator that could give you a Maybe A or a Maybe B. Elm, of course, doesn't

Re: [elm-discuss] Integer / String Input in HTML

2016-05-24 Thread Herwig Habenbacher
Thanks! The Solution just don't look that nice ;-) update : Msg -> Applications -> Applications >> >> update action model = >> >> case action of >> >> AID app -> >> >> { model | appID = String.toInt app |> Result.toMaybe |> >>> Maybe.withDefault 0 } >> >> >>> Name nname -> >> >>

Re: [elm-discuss] Integer / String Input in HTML

2016-05-24 Thread Thomas Coopman
Sorry, I misinterpreted your question. I would probably do it like this: The int in your model is fine. The Msg type should still be of AID String and then you can parse the string to an Int(or Maybe Int) in your update function. On Tue, 24 May 2016 at 17:09 Herwig Habenbacher < herwig.habenbac..

Re: [elm-discuss] Integer / String Input in HTML

2016-05-24 Thread Herwig Habenbacher
Thanks - I was aware of that... >If you want to use an Int, you must transform the int to a string. But how to do that and where? On the view side? How? >input [ type' "number", placeholder "1", onInput AID ] [] Or on the update side? Thanks! -- You received this message because you are subsc

Re: [elm-discuss] Re: Create an alert that disappears after 5 seconds

2016-05-24 Thread Janis Voigtländer
How could a task fail for things like getting a random number or getting the current date? It can’t. And that’s what the never in Task.perform never expresses, and lets the type-checker confirm. ​ 2016-05-24 15:41 GMT+02:00 TheGryzor123 : > Thanks for the answer. How could a task fail for things

[elm-discuss] Re: Create an alert that disappears after 5 seconds

2016-05-24 Thread TheGryzor123
Thanks for the answer. How could a task fail for things like getting a random number or getting the current date? -- 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] Chrome extension Content Security Policy

2016-05-24 Thread Cezar Halmagean
Hi guys, I am trying to write an extension for Chrome and I've stumbled into a security issue. I get the following error message: Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' https://lvh.me:3000";. Either the 'unsa

Re: [elm-discuss] Integer / String Input in HTML

2016-05-24 Thread Thomas Coopman
The Elm compiler is telling you what is wrong. onInput wants a string ( http://package.elm-lang.org/packages/elm-lang/html/1.0.0/Html-Events#onInput) instead of an Int. So the compile gives an error, because your program would break otherwise. If you want to use an Int, you must transform the int

[elm-discuss] Integer / String Input in HTML

2016-05-24 Thread Herwig Habenbacher
Hello Together, just stumbled about this in Elm 0.17: If I only use Strings everything is fine, but as soon as I use an Integer in my Model I can't compile... Shouldn't Elm handle this easily? Cordially, Herwig (See attached file...) -- You received this message because you are subscribed

Re: [elm-discuss] Create an alert that disappears after 5 seconds

2016-05-24 Thread Peter Damoc
performUnfailing sounds more descriptive indeed. On Tue, May 24, 2016 at 2:29 PM, Janis Voigtländer < janis.voigtlaen...@gmail.com> wrote: > Yeah, I’m thinking of adding that version of perform to a task-extra > package. Actually wondering about the name. Maybe performUnfailing, > because the

Re: [elm-discuss] interesting article

2016-05-24 Thread surfncode
> This is not the first time I read about SAM. The decoupling between model and actions seems a bit artificial. Just putting them into different functions doesn't mean the coupling magically disappear in my opinion. There still must be an implicit contract between those two, so that the model

Re: [elm-discuss] Re: Sublime Text 3 highlighting in 0.17

2016-05-24 Thread 'Laszlo Pandy' via Elm Discuss
Noah, can you elaborate on (or link to) the problems getting the sublime plugin accepted to package control? On Mon, May 23, 2016 at 7:53 PM, kgashok wrote: > There is a quick fix for this - > https://github.com/deadfoxygrandpa/Elm.tmLanguage/issues/99 > > > On Monday, 23 May 2016 22:53:24 UTC+5

Re: [elm-discuss] Create an alert that disappears after 5 seconds

2016-05-24 Thread Janis Voigtländer
Yeah, I’m thinking of adding that version of perform to a task-extra package. Actually wondering about the name. Maybe performUnfailing, because the standard perform is not really “unsafe” either. ​ 2016-05-24 13:17 GMT+02:00 Peter Damoc : > I would love to have `never` in core and available on e

Re: [elm-discuss] Create an alert that disappears after 5 seconds

2016-05-24 Thread Peter Damoc
I would love to have `never` in core and available on elm-lang.org/try Or have performSafe: (a -> Cmd msg) -> Task Never a -> Cmd msg Until then, I prefer the universality of NoOp. On Tue, May 24, 2016 at 12:49 PM, Janis Voigtländer < janis.voigtlaen...@gmail.com> wrote: > My standard obje

[elm-discuss] Re: Looking for people experienced with elm-html's "key" function

2016-05-24 Thread Kris Jenkins
I've just run into this too, but for me it causes a runtime exception. I've added a demo to reproduce (based on Gera's code) to the same issue: https://github.com/elm-lang/html/issues/21 On Monday, 23 May 2016 13:41:56 UTC+1, ge...@theoldmonk.net wrote: > > I'm not sure if the lazyDict approac

Re: [elm-discuss] Create an alert that disappears after 5 seconds

2016-05-24 Thread Janis Voigtländer
My standard objection: Replace Task.perform (\_ -> NoOp) by Task.perform never, using: http://package.elm-lang.org/packages/elm-community/basics-extra/1.0.0/Basics-Extra#never ​ 2016-05-24 11:21 GMT+02:00 Peter Damoc : > You should use Process.sleep > > dismissCmd = > Process.sleep (2 * sec

Re: [elm-discuss] Create an alert that disappears after 5 seconds

2016-05-24 Thread Peter Damoc
You should use Process.sleep dismissCmd = Process.sleep (2 * second) |> Task.perform (\_ -> NoOp) (\_ -> DismissAlert) On Tue, May 24, 2016 at 11:56 AM, TheGryzor123 wrote: > I'm still pretty new to Elm so I prefer to ask. > > I'm creating a typical alert that says "Action succes

[elm-discuss] Create an alert that disappears after 5 seconds

2016-05-24 Thread TheGryzor123
I'm still pretty new to Elm so I prefer to ask. I'm creating a typical alert that says "Action successful!" and want it to disappear automatically after 5 seconds. Should I use Time.every for that? -- You received this message because you are subscribed to the Google Groups "Elm Discuss" grou

Re: [elm-discuss] interesting article

2016-05-24 Thread Peter Damoc
Aligning Elm with TLA+ will make it even more solid from a theoretical point of view. SAM sounds very intriguing. I'm wondering if SAM couldn't be implemented in terms of TEA using a tagged union as Model. something like this: https://gist.github.com/pdamoc/c96714479d9f531fbc7468d5670ef576 On

[elm-discuss] Embed external HTML into elm

2016-05-24 Thread Zachary Kessin
What I want to do is have a chunk of HTML that is not controlled by elm inside an elm full page application. Specifically, I want to use Vega to create graphs in a div on my site. But when I tried to do that with a port if flickered and generally was unusable. I think some of the issue was that the