Re: [elm-discuss] Re: using js library inside elm?

2016-10-13 Thread António Ramos
Nice. thank you. 2016-10-13 15:00 GMT+01:00 Wouter In t Velt : > On Thu, Oct 13, 2016 at 5:46 AM, António Ramos wrote: >> >>> any example of calling an external js method ? >>> >> > Another example of calling external JS method is in the Todo.elm

Re: [elm-discuss] Re: Integrating Elm with Web Components / Polymer

2016-10-13 Thread 'Rupert Smith' via Elm Discuss
On Wednesday, October 12, 2016 at 1:34:32 PM UTC+1, Rupert Smith wrote: > > So there is an issue with being able to change the state of the component, > post initialization, from the consumer of the component. Because if there > is a port used to set state on the component... which component? >

Re: [elm-discuss] why -> Sub msg in ports instead of Sub Msg

2016-10-13 Thread Petr Vápenka
Lowercase "msg" is just a type parameter. It says that the first and second occurence of "msg" in the type signature means the same type, whatever that type it actually is. If it was Sub Msg, Msg would be some actual type you would be forced to work with. Petr On Thu, Oct 13, 2016 at 6:42 PM,

[elm-discuss] why -> Sub msg in ports instead of Sub Msg

2016-10-13 Thread António Ramos
I would like to know why Sub msg in lowercase in above code port suggestions : (List String -> msg) -> Sub msg -- 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] why -> Sub msg in ports instead of Sub Msg

2016-10-13 Thread Janis Voigtländer
Relevant: http://faq.elm-community.org/17.html#what-is-the-difference-between-cmd-msg-and-cmd-msg ​ 2016-10-13 18:42 GMT+02:00 António Ramos : > I would like to know why Sub msg in lowercase in above code > > port suggestions : (List String -> msg) -> Sub msg > > -- > You

[elm-discuss] Can I use css animations normally in elm?

2016-10-13 Thread Timothy Williams
Whenever I google something like this, I always get discussions about Elm libraries for this. As someone new to css in general, I just want to be able to do normal css animations using elm to model the state, do the event handling, and render the html. For example, if the state is toggled in

[elm-discuss] Access JS (ports?) from an Effects Manager

2016-10-13 Thread Simon
I want to build code to work with a well known JS library, and to make it reusable. I'm going to need some state that is ancillary to the core functionality, and thought about an Effects Manager. I know we are normally directed towards Evan's Websocket library, but that uses Native code and

Re: [elm-discuss] Re: Html.Keyed

2016-10-13 Thread 'Rupert Smith' via Elm Discuss
On Thursday, October 13, 2016 at 9:20:36 PM UTC+1, Rupert Smith wrote: > > On Tuesday, October 11, 2016 at 9:09:31 PM UTC+1, OvermindDL1 wrote: >> >> Remember, it is just a diffing algorithm, when it gets to that point of >> your vdom and it compares an old vdom node of, for example: >> ``` >>

[elm-discuss] Re: Getting functions out of the model

2016-10-13 Thread Frederick Yankowski
The elm-autocomplete package does something much like you describe. Configuration data, including some functions, is defined separately from the model and is passed as an additional parameter to the update function.

[elm-discuss] Re: Getting functions out of the model

2016-10-13 Thread Matthew Griffith
That's interesting as well. Though I think you'd run into challenges when trying to handle interruptible animations. Specifically you'd have to do all the interruptions manually. This would be even more challenging in the context of interruptions that have a delay before they're supposed to

[elm-discuss] Re: Getting functions out of the model

2016-10-13 Thread Matthew Griffith
So it's not necessarily not having interruptible animations, it's more all the code that you'll need to manage them. In elm-style-animation you can just start a new animation and interruptions are handled automatically. When you have description and state split, you have to juggle switching

[elm-discuss] Re: Getting functions out of the model

2016-10-13 Thread Zinggi
I also thought about this problem for a bit. I came up with a slightly different solution. I was not only not happy with storing functions in my model, but also with storing static values in the model (e.g. stuff that wont change often). I think it would be nice to separate the *descriptions* of

[elm-discuss] Re: Getting functions out of the model

2016-10-13 Thread Zinggi
@Frederick Yes, that's where I got my inspiration from ;) @Matthew I don't think this is a problem, but I also don't understand what you mean by "you'd have to do all the interruptions manually". Could you elaborate? I haven't studies your library closely, so I don't know how your library

Re: [elm-discuss] Re: Html.Keyed

2016-10-13 Thread 'Rupert Smith' via Elm Discuss
On Tuesday, October 11, 2016 at 9:09:31 PM UTC+1, OvermindDL1 wrote: > > Remember, it is just a diffing algorithm, when it gets to that point of > your vdom and it compares an old vdom node of, for example: > ``` > checkbox [ onClick (CheckToggle 42) ] [ text "Something" ] > ``` > and compares

[elm-discuss] Re: Getting functions out of the model

2016-10-13 Thread Zinggi
These are some very good points. I don't see how a library that doesn't store functions in the model could deal with these situations as easy as your library does. The only possible solution I can think of is that you could extend the description of an animation to include possible future

[elm-discuss] Re: http "middleware" options

2016-10-13 Thread 'Rupert Smith' via Elm Discuss
On Thursday, October 13, 2016 at 2:17:50 AM UTC+1, Fa Qing wrote: > > The PageLevel is calling the service level for a command. We want > intermediate effects, before the final command. But we don't want to just > issue intermediate commands either, because the state that is reacting to > the

Re: [elm-discuss] Re: Integrating Elm with Web Components / Polymer

2016-10-13 Thread 'Rupert Smith' via Elm Discuss
On Thursday, October 13, 2016 at 12:23:30 PM UTC+1, Rupert Smith wrote: > > Which is ok, but what I really want is for the listbox user to be able to > display more than just a string in the listbox, along these lines: > > root : Model -> Html Msg > root model = > listbox [ attrForSelect

[elm-discuss] Re: control structure

2016-10-13 Thread Kasey Speakman
It probably sounds insane that Elm doesn't have `for` or `while`. It would to me before exposure to functional programming. There are prebuilt functions for working with collections like List and Array

Re: [elm-discuss] Re: control structure

2016-10-13 Thread Janis Voigtländer
Your statement about tail call elimination is wrong. The Elm compiler does it. > Am 13.10.2016 um 23:38 schrieb Kasey Speakman : > > It probably sounds insane that Elm doesn't have `for` or `while`. It would to > me before exposure to functional programming. > > There

Re: [elm-discuss] Re: control structure

2016-10-13 Thread Joey Eremondi
> > One current limitation of Elm is that there is no tail call elimination Like Janis says, this is not true, and in most cases, tail-recursive functions will become while-loops in the resulting JS. For example, consider a list-summing function: sum : List Int -> Int sum = let helper

[elm-discuss] Re: control structure

2016-10-13 Thread David Legard
> > When you find you need something a bit more custom, a recursive loop is > the normal way. Those take a little practice to get the feel for them. I now make it a rule to see if I can avoid explicit recursion by using *scan* or *fold* instead. -- You received this message because you are

[elm-discuss] Re: Pure Elm contenteditable rich text editor

2016-10-13 Thread Bulat Shamsutdinov
Thank you everyone! I'm currently studying Draft.js to see their way of implementing rich text edit. -- 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] Re: Integrating Elm with Web Components / Polymer

2016-10-13 Thread 'Rupert Smith' via Elm Discuss
On Wednesday, October 12, 2016 at 5:34:36 PM UTC+1, Peter Damoc wrote: > > On Wed, Oct 12, 2016 at 6:57 PM, 'Rupert Smith' via Elm Discuss < > elm-d...@googlegroups.com > wrote: > >> This limitation means you can't have UI elements defined outside of a >> component affect its state. Suppose you

Re: [elm-discuss] Re: Integrating Elm with Web Components / Polymer

2016-10-13 Thread 'Rupert Smith' via Elm Discuss
On Thursday, October 13, 2016 at 9:33:18 AM UTC+1, Rupert Smith wrote: > > On Wednesday, October 12, 2016 at 5:34:36 PM UTC+1, Peter Damoc wrote: >> >> On Wed, Oct 12, 2016 at 6:57 PM, 'Rupert Smith' via Elm Discuss < >> elm-d...@googlegroups.com> wrote: >> >>> This limitation means you can't have

[elm-discuss] using js library inside elm?

2016-10-13 Thread António Ramos
hello i know that i have to use ports to pass data from elm to javascript but if i want to call an external library method inside my elm is there a way to do it? As i load my exeternal js file before my compiled elm in my index.html file there should be a way right? regards António -- You

[elm-discuss] Personal trainer ?

2016-10-13 Thread António Ramos
Hello i need an "expert" elm personal trainer I´m in Portugal . the chosen one will get a week offer in

Re: [elm-discuss] Re: Integrating Elm with Web Components / Polymer

2016-10-13 Thread 'Rupert Smith' via Elm Discuss
On Tuesday, October 11, 2016 at 11:21:05 AM UTC+1, Rupert Smith wrote: > > I'm interested in expanding on the counter example to add more complexity > - and I have a component in mind that will be useful to me - the listbox > that I was working with previously. > So I have a first pass at

[elm-discuss] Re: using js library inside elm?

2016-10-13 Thread Matthew Griffith
You still have to use ports. Check out the SpellCheck part of this https://guide.elm-lang.org/interop/javascript.html On Thursday, October 13, 2016 at 5:00:47 AM UTC-4, António Ramos wrote: > > hello i know that i have to use ports to pass data from elm to javascript > but if i want to call an

[elm-discuss] Re: Getting functions out of the model

2016-10-13 Thread Matthew Griffith
That's an interesting approach, though I'm not sure it would work for elm-style-animation, at least in its current form. In elm-style-animation you compose an animation under one Msg, and send animation updates(basically tick the animation forward) via a separate Msg. The `apply` and

[elm-discuss] Re: using js library inside elm?

2016-10-13 Thread Joe Clay
Basically, you need two ports to call out to an external method - one for you to pass out the arguments, and one for you to get the return value back. The JavaScript interop section of the guide demonstrates how to do this :) On Thursday,

Re: [elm-discuss] Re: using js library inside elm?

2016-10-13 Thread António Ramos
any example of calling an external js method ? 2016-10-13 12:44 GMT+01:00 Matthew Griffith : > You still have to use ports. Check out the SpellCheck part of this > https://guide.elm-lang.org/interop/javascript.html > > > On Thursday, October 13, 2016 at 5:00:47 AM UTC-4,

[elm-discuss] any boilerplate of elm and cordova ?

2016-10-13 Thread António Ramos
Hi all where can i find a simple boilerplate of elm and cordova together ? Regards António -- 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] Re: Learning Elm and feeling alone in the world

2016-10-13 Thread António Ramos
this guy is very good at it :) https://www.youtube.com/watch?v=R6vuO547DC8 2016-06-22 17:49 GMT+01:00 Joe Terry : > This is a really exciting time in the ELM community and I'm embracing the > rapid ... breaking changes ... world that we are in now ... because the > tools

Re: [elm-discuss] Re: using js library inside elm?

2016-10-13 Thread Duane Johnson
The example in the guide (the link that Matthew sent) is about as compact as you're going to find as an example. I know you're probably looking for a simple example, but calling an external javascript method is not a one-liner in Elm. On Thu, Oct 13, 2016 at 5:46 AM, António Ramos

Re: [elm-discuss] Re: using js library inside elm?

2016-10-13 Thread Wouter In t Velt
> > On Thu, Oct 13, 2016 at 5:46 AM, António Ramos > wrote: > >> any example of calling an external js method ? >> > Another example of calling external JS method is in the Todo.elm example app . Where port to JS

[elm-discuss] Getting functions out of the model

2016-10-13 Thread Aaron VonderHaar
As mentioned in some recent threads [1] [2], easing functions for animations have been an example of where functions in the model are currently used. An alternative approach is to use a union type to indicate the easing, but a suggested shortcoming of that approach is that there would then be no