Re: [elm-discuss] Is Elm.worker gone in 0.17?

2017-01-21 Thread GordonBGood
I encountered this problem with the UI not updating (and the results of any 
user input, clicks, etc. queued but not handled) as well with the same 
"setTimeout" solution to get Elm to update the view and handle the events.

The requirement for the setTimeout is the same as for JavaScript:  As the 
process queue handling is a computation chain that is executed on a single 
thread, there are no breaks to handle UI updates (and input responses) and 
these updates are generally not performed until the whole chain of events 
is complete as to to a "Cmd.none".  By adding a "setTimeout", one breaks 
the chain so that UI can be handled.  There are actually some JS 
"setTimeout"'s automatically inserted into the process chain at intervals, 
but these are after a high number of process elements so won't make the UE 
response as immediate as one would like even if there is a lot of 
processing going on.  Thus, the need for this hack.

On Monday, 13 June 2016 15:27:43 UTC+7, Pietro Grandi wrote:
>
> Hi Tobias,
> I'm doing the same tutorial and trying to re-write it for the 0.17.
>
> I also stumbled across the timeout issue: basically without the timeout I 
> can't see any message I send to the port from javascript.
> Is there any clue about the reason why is it behaving this way?
>
> Since I'm making POCs to introduce ELM to our office it would be better to 
> be able to explaing why instead of just syncronize the rest of the app with 
> the elm part.
>
> Thanks!
>
> On Wednesday, May 11, 2016 at 11:23:06 AM UTC+2, Tobias Burger wrote:
>>
>> I think I've figured it out of how to get elm working with embed: 
>> https://github.com/toburger/elm-todomvc/tree/feature/elm17
>>
>>
>>- You create your project like any other elm-lang/html project
>>- You can create a dummy view or a view with some functionality
>>*There is one advantage with creating a real view: you can test your 
>>code with elm reactor and you don't have to compile your code every time 
>>you make some changes.*
>>- The ports story on the JS side hasn't changed, however you have to 
>>invoke the elm code slightly different than before.
>>However, to dispatch the messages I had to wrap then inside a 
>>setTimeout function, don't know why...
>>On the Elm code side I had to migrate from Signals to Sub, wasn't 
>>that hard, BUT, and I think this is a bug: If you look at the signature 
>>of dispatchDestroyCompleted, I had to use a "List Int" instead of a (), 
>>because somehow it was transpiled as a Tuple and I got a runtime error 
>>telling me, that it could not find Tuple0.
>>
>>
>> Am Mittwoch, 11. Mai 2016 10:30:30 UTC+2 schrieb John Orford:
>>>
>>> Yeh I checked just after I sent the email. Looks like that is the case...
>>>
>>> On Wed, 11 May 2016 at 10:28 Tobias Burger  wrote:
>>>
 Yes, but it forces you to create a Html.App as far as I understand it.
 Embed allowed you to have a "headless" elm application, where the logic 
 was encapsulated in elm and the UI could be rendered by JavaScript (e.g. 
 React).


 Am Mittwoch, 11. Mai 2016 10:17:39 UTC+2 schrieb John Orford:

> Have you tried looking at the guide?
>
> http://guide.elm-lang.org/interop/javascript.html
>
> It worked for updating my embedding code.
>
> On Wed, 11 May 2016 at 10:07 Tobias Burger  wrote:
>
 I'm struggling on how to embed elm code as a worker in existing 
>> JavaScript code.
>> There exists this example for elm 0.16: 
>> http://tech.noredink.com/post/126978281075/walkthrough-introducing-elm-to-a-js-web-app
>> But I have problems in getting this code to work in elm 0.17.
>>
>> -- 
>> 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...@googlegroups.com.
>
>
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
 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...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Forms with Floats / Dates

2017-01-21 Thread Bernardo
This is an improvement, but again, trying to validate on every key press 
causes problems. Type a number and you can't delete it with backspace, you 
can't enter a negative number, ctrl-z acts weird. Now, I'm sure you can 
work around all of these problems, but why don't wait until the user has 
finished and then update the model and validate?

On Saturday, 21 January 2017 22:11:56 UTC-3, j weir wrote:
>
> Even simpler is to just use input [] [type_ "number"]  any reasons not to?
>
> http://caniuse.com/#feat=input-number
>
> https://gist.github.com/jweir/9e8412a4fa0132866977626e337cb164
>
> On Saturday, January 21, 2017 at 1:37:16 PM UTC-8, j weir wrote:
>>
>> You could also format the input so it is always a decimal.
>>
>> And instead of using Result.withDefault 0.0, revert to the existing value.
>> This way the input won't be destroyed if the user fat fingers a non 
>> numeral.
>>
>> https://gist.github.com/jweir/9e8412a4fa0132866977626e337cb164
>>
>>
>>
>> On Saturday, January 21, 2017 at 9:11:41 AM UTC-8, Rafał Cieślak wrote:
>>>
>>> I'd consider storing the whole string in the model and passing it to 
>>> value. This way you can capture whatever input the user types and 
>>> convert it to float only when you actually need to do something with the 
>>> float.
>>>
>>> IMHO because the input tag allows you to type any kind of string, you 
>>> should treat the value that comes from its onBlur as a string. You 
>>> could set type_ to "number", but that would still not exclude some 
>>> invalid inputs from being provided.
>>>
>>> On Saturday, January 21, 2017 at 4:08:04 PM UTC+1, Simon wrote:

 I think it is not uncommon to collect dates and float values from users.

 update ...
 NewValue v -> 
 { model | floatvalue = String.toFloat v |> Result.withDefault 0.0 }

 floatInput : Float -> Html Msg 
 floatInput v =
 input 
 [ onInput NewValue 
 , value (toString v) 
 ] []

 The problem with the above is that the moment you type the . toFloat 
 fails and you get a 0 in your model. One way around it could be to 
 delay processing of the value by using onBlur (below), but I was wondering 
 how others handled this.

 floatInput_ : Float -> Html Msg 
 floatInput_ v =
 input 
 [ onBlur NewValue 
 , value (toString v) 
 ] []

 ​

>>>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Forms with Floats / Dates

2017-01-21 Thread j weir
Even simpler is to just use input [] [type_ "number"]  any reasons not to?

http://caniuse.com/#feat=input-number

https://gist.github.com/jweir/9e8412a4fa0132866977626e337cb164

On Saturday, January 21, 2017 at 1:37:16 PM UTC-8, j weir wrote:
>
> You could also format the input so it is always a decimal.
>
> And instead of using Result.withDefault 0.0, revert to the existing value.
> This way the input won't be destroyed if the user fat fingers a non 
> numeral.
>
> https://gist.github.com/jweir/9e8412a4fa0132866977626e337cb164
>
>
>
> On Saturday, January 21, 2017 at 9:11:41 AM UTC-8, Rafał Cieślak wrote:
>>
>> I'd consider storing the whole string in the model and passing it to 
>> value. This way you can capture whatever input the user types and 
>> convert it to float only when you actually need to do something with the 
>> float.
>>
>> IMHO because the input tag allows you to type any kind of string, you 
>> should treat the value that comes from its onBlur as a string. You could 
>> set type_ to "number", but that would still not exclude some invalid 
>> inputs from being provided.
>>
>> On Saturday, January 21, 2017 at 4:08:04 PM UTC+1, Simon wrote:
>>>
>>> I think it is not uncommon to collect dates and float values from users.
>>>
>>> update ...
>>> NewValue v -> 
>>> { model | floatvalue = String.toFloat v |> Result.withDefault 0.0 }
>>>
>>> floatInput : Float -> Html Msg 
>>> floatInput v =
>>> input 
>>> [ onInput NewValue 
>>> , value (toString v) 
>>> ] []
>>>
>>> The problem with the above is that the moment you type the . toFloat 
>>> fails and you get a 0 in your model. One way around it could be to 
>>> delay processing of the value by using onBlur (below), but I was wondering 
>>> how others handled this.
>>>
>>> floatInput_ : Float -> Html Msg 
>>> floatInput_ v =
>>> input 
>>> [ onBlur NewValue 
>>> , value (toString v) 
>>> ] []
>>>
>>> ​
>>>
>>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Forms with Floats / Dates

2017-01-21 Thread j weir
You could also format the input so it is always a decimal.

And instead of using Result.withDefault 0.0, revert to the existing value.
This way the input won't be destroyed if the user fat fingers a non numeral.

https://gist.github.com/jweir/9e8412a4fa0132866977626e337cb164



On Saturday, January 21, 2017 at 9:11:41 AM UTC-8, Rafał Cieślak wrote:
>
> I'd consider storing the whole string in the model and passing it to value. 
> This way you can capture whatever input the user types and convert it to 
> float only when you actually need to do something with the float.
>
> IMHO because the input tag allows you to type any kind of string, you 
> should treat the value that comes from its onBlur as a string. You could 
> set type_ to "number", but that would still not exclude some invalid 
> inputs from being provided.
>
> On Saturday, January 21, 2017 at 4:08:04 PM UTC+1, Simon wrote:
>>
>> I think it is not uncommon to collect dates and float values from users.
>>
>> update ...
>> NewValue v -> 
>> { model | floatvalue = String.toFloat v |> Result.withDefault 0.0 }
>>
>> floatInput : Float -> Html Msg 
>> floatInput v =
>> input 
>> [ onInput NewValue 
>> , value (toString v) 
>> ] []
>>
>> The problem with the above is that the moment you type the . toFloat 
>> fails and you get a 0 in your model. One way around it could be to delay 
>> processing of the value by using onBlur (below), but I was wondering how 
>> others handled this.
>>
>> floatInput_ : Float -> Html Msg 
>> floatInput_ v =
>> input 
>> [ onBlur NewValue 
>> , value (toString v) 
>> ] []
>>
>> ​
>>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Pseudo Web Components in Elm

2017-01-21 Thread Oliver Searle-Barnes
Thank you for putting this together Peter, it's certainly something that 
I've given more than a little thought to. While I believe that sticking to 
a flat structure where possible is beneficial there really does seem to be 
a place for components like text editors, calendars etc. I'll try to give 
it a good look in the coming days. Thanks again!




On Saturday, 21 January 2017 17:14:48 UTC+1, Peter Damoc wrote:
>
> Hi Berry,
>
> You understand correctly, that's the intended way of composing.
>
> I have not thought seriously about themability but it should be possible 
> through the use of shared CSS (elm-css).
>
> The CounterList example shows how the counters push data into the parents 
> through events.
>
> Boxes can exist within boxes. AltMain shows this (it is a box that 
> contains other boxes)
>
> Please add an issue about Safari in the repository. I'll investigate it 
> when I get back to a computer (I'm on my mobile now).
>
> Thank you for the feedback!
>
>
> On Sat, 21 Jan 2017 at 16:34, Berry Groenendijk  > wrote:
>
>> Hi Peter,
>>
>> If I understand correctly, a box is basically a mini-main. And boxes can 
>> be composed into one big main. I like the resulting code, like:
>>
>> main : Html msg
>> main =
>> div []
>> [ counter [ value 4 ] []
>> , counter [ value 2 ] []
>> ]
>>
>> The result is a very easy composable main. Questions that come to mind 
>> are:
>>
>> - Theme-ability: can components adhere to a general CSS theme?
>> - And I did not see an example where information from one component is 
>> used in another. How would that look like? Can a box store information in a 
>> model in main, for example? I imagine a form box that gathers information 
>> from a user (including validation, etc.) and if form is valid the 
>> information is stored in the model in main. And some other component uses 
>> this information to show the data.
>> - Can boxes exist within boxes?
>>
>> PS: the example runs in chrome. But, in Safari I get the following error:
>>
>>
>> 
>>
>> Which is line 162 in box.js.
>>
>> Thanks!
>>
>> Berry
>>
>>
>> Op zaterdag 21 januari 2017 10:43:09 UTC+1 schreef Peter Damoc:
>>
>>> Hello Community, 
>>>
>>> I've worked the last few days to bring about an older dream of mine: 
>>> converting Elm programs into Html elements with the intention of composing 
>>> them. 
>>>
>>> The route I took was that of the pseudo Web Components. 
>>>
>>> Here is the library that I made:
>>> https://github.com/pdamoc/elm-box
>>>
>>> It is implemented with Native so, don't expect to see it in the packages 
>>> repository any time soon but I think this is an important topic and should 
>>> be explored by more people. 
>>>
>>> The Readme has instructions for both playing with it and for testing it 
>>> in toy projects. 
>>>
>>> The examples folder has a bunch of examples showing how I view 
>>> implemented the old elm-architecture-tutorial examples using Boxes. 
>>>
>>> The examples range from extremely simple to a more fancy example that 
>>> integrates with elm-css. 
>>>
>>> The API has passed through a few iterations and I think it is quite OK 
>>> but if you have suggestions for improvements please contribute. 
>>>
>>> There are, of course, a lot issues and caveats due to this being a quick 
>>> and dirty implementation BUT, it think the code is good enough to be used 
>>> to start this discussion. 
>>>
>>> This is a very dear topic to me so, any questions or comments are 
>>> appreciated.
>>>
>>> Thank you. 
>>>
>>> -- 
>>> There is NO FATE, we are the creators.
>>> blog: http://damoc.ro/
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>>
>>
>>
>> -- 
>>
>>
>> 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...@googlegroups.com .
>>
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: ANN/Request for review: elm-graph

2017-01-21 Thread Lourens Rolograaf
Hi Sebastian,

After some deep thinking I concluded my world is modelled best in a graph 
datastructure. 
What is in elm-community/graph the way to get the only the siblings of a 
node?
When I use breadth-first traveling with `ignorepath` it gives me far too 
many nodes. 
probably due to "ignoring distance parameters"
It seems I need an example for `BfsNodeVisitor`, any chance for a tutorial 
with some more examples to get me started?

Or are you far gone from this project? it is almost half a year old now

thanks anyway!
Lourens

Op vrijdag 7 augustus 2015 11:56:47 UTC+2 schreef Sebastian Graf:
>
> Hi,
>
> today I'd like to open my developments of a graph library in Elm 
>  to a broader public. 
> It's not quite there yet, but most of the stuff for a 1.0 is in there 
> except for BFS (which won't take that long).
> I would really appreciate some short code review and help with what is 
> seemingly a bug in elm-make (or myself):
>
> Trying to compile the Graph module with elm-make results in module 
> documentation errors for every single export ('The module exports `export` 
> but it is not in the module documentation'), except that I really have 
> supplied documentation.
> I don't know what this is about, documentation generation worked for some 
> other packages I published earlier.
>
> So, some questions regarding code organization:
>
>1. Should I leave the Foci in the main module? Should I even supply 
>them in an extra library?
>2. I feel a little partial wrt. having most of the code in one module, 
>but love the name spacing that way. Should I split up e.g. traversals into 
>their own module anyway? That might help with the elm-make bug.
>
> I really enjoyed the neatness of Elm, although somewhat verbose. Every 
> library I released gives me a warm cozy gut feeling :)
>
> Thanks for your time! 
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Rx-like subscription to View's events

2017-01-21 Thread jphedley
I personally have no interest or use for templates in Cycle.JS or Elm, but 
OP does, but I'm not sure if Jade templates are used much in Cycle.JS 
either. His point is correct that in Cycle.JS View function, there's never 
any specification of what exact events the Intent function will process, 
only a CSS selector the Intent function uses to filter out the parts of the 
view it's interested in processing,
https://cycle.js.org/basic-examples.html
so the View in Cycle.js has no equivalent to
http://package.elm-lang.org/packages/elm-lang/html/2.0.0/Html-Events
only
https://github.com/ohanhi/hyperscript-helpers
so to summarize your elm view must specify what events, e.g. onClick, it 
will generate,while the Cycle.JS View function never does, e.g
function view(state$) {
return state$.map(({color, width}) => {
const style = {
border: '1px solid #000',
background: 'none repeat scroll 0% 0% ' + color,
width: width + 'px',
height: '70px',
display: 'block',
padding: '20px',
margin: '10px 0px'
};
return div('.item', {style}, [
input('.color-field', {
attrs: {type: 'text', value: color}
}),
div('.slider-container', [
input('.width-slider', {
attrs: {type: 'range', min: '200', max: '1000', value: width}
})
]),
div('.width-content', String(width)),
button('.remove-btn', 'Remove')
]);

from 
https://github.com/cyclejs/cyclejs/blob/master/examples/many/src/Item.js
Note, no events specified anywhere. This makes Tylor Steinberger's 
extremely simple Cycle.JS w/Jade Proof of Concept example possible, as 
noted by OP, but TS doesn't seem to be very enthusiastic about the idea, 
for performance and other reasons.

Yes I understand Elm is no longer First Order FRP
http://elm-lang.org/blog/farewell-to-frp
where Cycle.JS is higher order FRP
https://twitter.com/andrestaltz/status/730065452991455232
which Evan help clarify the differences in
https://www.youtube.com/watch?v=Agu6jipKfYw



On Friday, January 20, 2017 at 10:00:33 PM UTC-8, Peter Damoc wrote:
>
>
> On Sat, Jan 21, 2017 at 2:15 AM, jphedley  > wrote:
>
>> I wasn't aware of Jade Templates being a common use case for the Cycle.js 
>> community. I was only aware of this issue-
>> https://github.com/cyclejs/cyclejs/issues/321
>> resulting in this proof of concept-
>> http://www.webpackbin.com/Nkd5aKiIf
>> which is made possible by Cycle.JS not attaching event handlers in the 
>> view function, as noted by Andre Statlz in this discussion,
>>
>> https://www.reddit.com/r/javascript/comments/3zr6i0/conversation_whats_the_core_differences_between/
>> unlike Elm.
>>
>
>
> Well, Elm doesn't have templates because elm doesn't need templates. It 
> has the entire language available for you to build whatever html you want 
> based on your model. 
>
> Also, Elm doesn't attach event handlers in the view function, it just 
> describes what kind of message would the event generate. 
> You can think of these as translators from the language of the html 
> element to the language of your app. 
> So, instead of generating a "click" event, a button will generate a 
> specific message. 
>
> If you want your template to have no idea of these messages you can give 
> it the messages as parameters. 
> You will then use this template in some Elm Architecture construct 
>
> Your entire example, in Elm would look like this: 
>
> module Main exposing (..)
>
> import Html exposing (beginnerProgram, div, button, h1, text)
> import Html.Events exposing (onClick)
>
>
> main =
> beginnerProgram { model = 0, view = view, update = update }
>
>
> incTemplate msg count =
> div []
> [ button [ onClick msg ] [ text "Click me" ]
> , h1 [] [ text (toString count) ]
> ]
>
>
> view model =
> incTemplate Increment model
>
>
> type Msg
> = Increment
>
>
> update msg model =
> case msg of
> Increment ->
> model + 1
>
>
> I think it looks clearer. 
>
> As a side note, the Elm that is mentioned in that reddit discussion you 
> linked is no more. 
> Signals and FRP constructs are gone from the language. 
> All we have now is The Elm Architecture.
>
>
>
> -- 
> There is NO FATE, we are the creators.
> blog: http://damoc.ro/
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Forms with Floats / Dates

2017-01-21 Thread Rafał Cieślak
I'd consider storing the whole string in the model and passing it to value. 
This way you can capture whatever input the user types and convert it to 
float only when you actually need to do something with the float.

IMHO because the input tag allows you to type any kind of string, you 
should treat the value that comes from its onBlur as a string. You could 
set type_ to "number", but that would still not exclude some invalid inputs 
from being provided.

On Saturday, January 21, 2017 at 4:08:04 PM UTC+1, Simon wrote:
>
> I think it is not uncommon to collect dates and float values from users.
>
> update ...
> NewValue v -> 
> { model | floatvalue = String.toFloat v |> Result.withDefault 0.0 }
>
> floatInput : Float -> Html Msg 
> floatInput v =
> input 
> [ onInput NewValue 
> , value (toString v) 
> ] []
>
> The problem with the above is that the moment you type the . toFloat 
> fails and you get a 0 in your model. One way around it could be to delay 
> processing of the value by using onBlur (below), but I was wondering how 
> others handled this.
>
> floatInput_ : Float -> Html Msg 
> floatInput_ v =
> input 
> [ onBlur NewValue 
> , value (toString v) 
> ] []
>
> ​
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Pseudo Web Components in Elm

2017-01-21 Thread Peter Damoc
Hi Berry,

You understand correctly, that's the intended way of composing.

I have not thought seriously about themability but it should be possible
through the use of shared CSS (elm-css).

The CounterList example shows how the counters push data into the parents
through events.

Boxes can exist within boxes. AltMain shows this (it is a box that contains
other boxes)

Please add an issue about Safari in the repository. I'll investigate it
when I get back to a computer (I'm on my mobile now).

Thank you for the feedback!


On Sat, 21 Jan 2017 at 16:34, Berry Groenendijk 
wrote:

> Hi Peter,
>
> If I understand correctly, a box is basically a mini-main. And boxes can
> be composed into one big main. I like the resulting code, like:
>
> main : Html msg
> main =
> div []
> [ counter [ value 4 ] []
> , counter [ value 2 ] []
> ]
>
> The result is a very easy composable main. Questions that come to mind are:
>
> - Theme-ability: can components adhere to a general CSS theme?
> - And I did not see an example where information from one component is
> used in another. How would that look like? Can a box store information in a
> model in main, for example? I imagine a form box that gathers information
> from a user (including validation, etc.) and if form is valid the
> information is stored in the model in main. And some other component uses
> this information to show the data.
> - Can boxes exist within boxes?
>
> PS: the example runs in chrome. But, in Safari I get the following error:
>
>
> 
>
> Which is line 162 in box.js.
>
> Thanks!
>
> Berry
>
>
> Op zaterdag 21 januari 2017 10:43:09 UTC+1 schreef Peter Damoc:
>
> Hello Community,
>
> I've worked the last few days to bring about an older dream of mine:
> converting Elm programs into Html elements with the intention of composing
> them.
>
> The route I took was that of the pseudo Web Components.
>
> Here is the library that I made:
> https://github.com/pdamoc/elm-box
>
> It is implemented with Native so, don't expect to see it in the packages
> repository any time soon but I think this is an important topic and should
> be explored by more people.
>
> The Readme has instructions for both playing with it and for testing it in
> toy projects.
>
> The examples folder has a bunch of examples showing how I view implemented
> the old elm-architecture-tutorial examples using Boxes.
>
> The examples range from extremely simple to a more fancy example that
> integrates with elm-css.
>
> The API has passed through a few iterations and I think it is quite OK but
> if you have suggestions for improvements please contribute.
>
> There are, of course, a lot issues and caveats due to this being a quick
> and dirty implementation BUT, it think the code is good enough to be used
> to start this discussion.
>
> This is a very dear topic to me so, any questions or comments are
> appreciated.
>
> Thank you.
>
> --
> There is NO FATE, we are the creators.
> blog: http://damoc.ro/
>
>
>
>
>
>
>
>
>
>
>
>
> --
>
>
> 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+unsubscr...@googlegroups.com.
>
>
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Forms with Floats / Dates

2017-01-21 Thread Bernardo
Instead of onInput I listen to the *change *event so I don't validate and 
update the model on every key press. In most cases I don't see a reason to 
update the model on every key press.

On Saturday, 21 January 2017 12:16:03 UTC-3, Simon wrote:
>
> Correction 
>
> toString (toFloat "5.") == "5"-i.e. the `.` gets stripped off so you 
> can never actually add decimal values
>
>
>
> On Saturday, 21 January 2017 16:08:04 UTC+1, Simon wrote:
>>
>> I think it is not uncommon to collect dates and float values from users.
>>
>> update ...
>> NewValue v -> 
>> { model | floatvalue = String.toFloat v |> Result.withDefault 0.0 }
>>
>> floatInput : Float -> Html Msg 
>> floatInput v =
>> input 
>> [ onInput NewValue 
>> , value (toString v) 
>> ] []
>>
>> The problem with the above is that the moment you type the . toFloat 
>> fails and you get a 0 in your model. One way around it could be to delay 
>> processing of the value by using onBlur (below), but I was wondering how 
>> others handled this.
>>
>> floatInput_ : Float -> Html Msg 
>> floatInput_ v =
>> input 
>> [ onBlur NewValue 
>> , value (toString v) 
>> ] []
>>
>> ​
>>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Maintainers wanted

2017-01-21 Thread Simon
Despite the growth and strength of the Elm community, it is worth saying 
that your absence will really be missed Bogdan.

Simon


On Saturday, 21 January 2017 10:48:31 UTC+1, Bogdan Popa wrote:
>
> Ok, elm-community looks like a good place to move them to. Let's do that. 
> :)
>
> On Friday, January 20, 2017 at 8:42:29 PM UTC+2, Noah Hall wrote:
>>
>> Please move these to elm-community. I can help move them over. Reach 
>> on slack on #elm-community 
>>
>> On Fri, Jan 20, 2017 at 7:38 PM, Joey Eremondi  
>> wrote: 
>> > Might these be candidates for migrating to elm-community? 
>> > 
>> > On Fri, Jan 20, 2017 at 2:29 AM, Bogdan Popa  
>> wrote: 
>> >> 
>> >> Hi folks, 
>> >> 
>> >> Due to various reasons, I will no longer be focusing my attention on 
>> Elm 
>> >> for the foreseeable future. Unfortunately, this means that the 
>> libraries 
>> >> that I have created/have been maintaining so far will no longer be 
>> >> maintained by me. AFAICT, the following libraries are seeing a decent 
>> amount 
>> >> of use: 
>> >> 
>> >> * elm-combine 
>> >> * elm-datepicker 
>> >> * elm-route 
>> >> * elm-time 
>> >> 
>> >> It would be sad to see them die off and I would feel bad letting down 
>> any 
>> >> of their current users by not providing a path forward. If you depend 
>> on any 
>> >> of these and would like to step up and start maintaining one or more 
>> of 
>> >> them, please e-mail me directly. 
>> >> 
>> >> I had also been maintaining the Elm mode for Emacs for the past couple 
>> of 
>> >> years. I cannot give others commit access to that repository, but I'm 
>> sure 
>> >> @jcollard would happily do it if anyone wants to step up and maintain 
>> the 
>> >> project. 
>> >> 
>> >> Thanks! 
>> >> Bogdan 
>> >> 
>> >> -- 
>> >> 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...@googlegroups.com. 
>> >> For more options, visit https://groups.google.com/d/optout. 
>> > 
>> > 
>> > -- 
>> > 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...@googlegroups.com. 
>> > For more options, visit https://groups.google.com/d/optout. 
>>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Forms with Floats / Dates

2017-01-21 Thread Simon
Correction 

toString (toFloat "5.") == "5"-i.e. the `.` gets stripped off so you 
can never actually add decimal values



On Saturday, 21 January 2017 16:08:04 UTC+1, Simon wrote:
>
> I think it is not uncommon to collect dates and float values from users.
>
> update ...
> NewValue v -> 
> { model | floatvalue = String.toFloat v |> Result.withDefault 0.0 }
>
> floatInput : Float -> Html Msg 
> floatInput v =
> input 
> [ onInput NewValue 
> , value (toString v) 
> ] []
>
> The problem with the above is that the moment you type the . toFloat 
> fails and you get a 0 in your model. One way around it could be to delay 
> processing of the value by using onBlur (below), but I was wondering how 
> others handled this.
>
> floatInput_ : Float -> Html Msg 
> floatInput_ v =
> input 
> [ onBlur NewValue 
> , value (toString v) 
> ] []
>
> ​
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Forms with Floats / Dates

2017-01-21 Thread Simon


I think it is not uncommon to collect dates and float values from users.

update ...
NewValue v -> 
{ model | floatvalue = String.toFloat v |> Result.withDefault 0.0 }

floatInput : Float -> Html Msg 
floatInput v =
input 
[ onInput NewValue 
, value (toString v) 
] []

The problem with the above is that the moment you type the . toFloat fails 
and you get a 0 in your model. One way around it could be to delay 
processing of the value by using onBlur (below), but I was wondering how 
others handled this.

floatInput_ : Float -> Html Msg 
floatInput_ v =
input 
[ onBlur NewValue 
, value (toString v) 
] []

​

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Pseudo Web Components in Elm

2017-01-21 Thread Berry Groenendijk
Hi Peter,

If I understand correctly, a box is basically a mini-main. And boxes can be 
composed into one big main. I like the resulting code, like:

main : Html msg
main =
div []
[ counter [ value 4 ] []
, counter [ value 2 ] []
]

The result is a very easy composable main. Questions that come to mind are:

- Theme-ability: can components adhere to a general CSS theme?
- And I did not see an example where information from one component is used 
in another. How would that look like? Can a box store information in a 
model in main, for example? I imagine a form box that gathers information 
from a user (including validation, etc.) and if form is valid the 
information is stored in the model in main. And some other component uses 
this information to show the data.
- Can boxes exist within boxes?

PS: the example runs in chrome. But, in Safari I get the following error:



Which is line 162 in box.js.

Thanks!

Berry


Op zaterdag 21 januari 2017 10:43:09 UTC+1 schreef Peter Damoc:
>
> Hello Community, 
>
> I've worked the last few days to bring about an older dream of mine: 
> converting Elm programs into Html elements with the intention of composing 
> them. 
>
> The route I took was that of the pseudo Web Components. 
>
> Here is the library that I made:
> https://github.com/pdamoc/elm-box
>
> It is implemented with Native so, don't expect to see it in the packages 
> repository any time soon but I think this is an important topic and should 
> be explored by more people. 
>
> The Readme has instructions for both playing with it and for testing it in 
> toy projects. 
>
> The examples folder has a bunch of examples showing how I view implemented 
> the old elm-architecture-tutorial examples using Boxes. 
>
> The examples range from extremely simple to a more fancy example that 
> integrates with elm-css. 
>
> The API has passed through a few iterations and I think it is quite OK but 
> if you have suggestions for improvements please contribute. 
>
> There are, of course, a lot issues and caveats due to this being a quick 
> and dirty implementation BUT, it think the code is good enough to be used 
> to start this discussion. 
>
> This is a very dear topic to me so, any questions or comments are 
> appreciated.
>
> Thank you. 
>
> -- 
> There is NO FATE, we are the creators.
> blog: http://damoc.ro/
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Integrating prosemirror editor with elm

2017-01-21 Thread abhinav gupta
Hi
I want to use collaborative features of prosemirror 
, with changing as 
little code as possible. I have it implemented inside react.js, without 
changing much code. As I am learning elm and thinking of re-implementing 
that app with elm. Should I completely replace my react + redux stack or 
just replace redux part of it? So that it will be easy to integrate 
prosemirror.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Maintainers wanted

2017-01-21 Thread Bogdan Popa
Ok, elm-community looks like a good place to move them to. Let's do that. :)

On Friday, January 20, 2017 at 8:42:29 PM UTC+2, Noah Hall wrote:
>
> Please move these to elm-community. I can help move them over. Reach 
> on slack on #elm-community 
>
> On Fri, Jan 20, 2017 at 7:38 PM, Joey Eremondi  > wrote: 
> > Might these be candidates for migrating to elm-community? 
> > 
> > On Fri, Jan 20, 2017 at 2:29 AM, Bogdan Popa  > wrote: 
> >> 
> >> Hi folks, 
> >> 
> >> Due to various reasons, I will no longer be focusing my attention on 
> Elm 
> >> for the foreseeable future. Unfortunately, this means that the 
> libraries 
> >> that I have created/have been maintaining so far will no longer be 
> >> maintained by me. AFAICT, the following libraries are seeing a decent 
> amount 
> >> of use: 
> >> 
> >> * elm-combine 
> >> * elm-datepicker 
> >> * elm-route 
> >> * elm-time 
> >> 
> >> It would be sad to see them die off and I would feel bad letting down 
> any 
> >> of their current users by not providing a path forward. If you depend 
> on any 
> >> of these and would like to step up and start maintaining one or more of 
> >> them, please e-mail me directly. 
> >> 
> >> I had also been maintaining the Elm mode for Emacs for the past couple 
> of 
> >> years. I cannot give others commit access to that repository, but I'm 
> sure 
> >> @jcollard would happily do it if anyone wants to step up and maintain 
> the 
> >> project. 
> >> 
> >> Thanks! 
> >> Bogdan 
> >> 
> >> -- 
> >> 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...@googlegroups.com . 
> >> For more options, visit https://groups.google.com/d/optout. 
> > 
> > 
> > -- 
> > 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...@googlegroups.com . 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Pseudo Web Components in Elm

2017-01-21 Thread Peter Damoc
Hello Community,

I've worked the last few days to bring about an older dream of mine:
converting Elm programs into Html elements with the intention of composing
them.

The route I took was that of the pseudo Web Components.

Here is the library that I made:
https://github.com/pdamoc/elm-box

It is implemented with Native so, don't expect to see it in the packages
repository any time soon but I think this is an important topic and should
be explored by more people.

The Readme has instructions for both playing with it and for testing it in
toy projects.

The examples folder has a bunch of examples showing how I view implemented
the old elm-architecture-tutorial examples using Boxes.

The examples range from extremely simple to a more fancy example that
integrates with elm-css.

The API has passed through a few iterations and I think it is quite OK but
if you have suggestions for improvements please contribute.

There are, of course, a lot issues and caveats due to this being a quick
and dirty implementation BUT, it think the code is good enough to be used
to start this discussion.

This is a very dear topic to me so, any questions or comments are
appreciated.

Thank you.

-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.