[elm-discuss] Re: [Feature] Ability to suppress some warnings (or don't generate them at all)

2017-08-10 Thread Jakub Hampl
Warnings are really recommendations - if you choose to ignore them you'll 
be fine. In elm, dangerous things are errors, not warnings. So I suggest if 
you don't like the suggestions, simply stop using the --warn flag.

On Wednesday, 9 August 2017 03:44:11 UTC+1, Incomplete wrote:
>
> Whenever I `elm-make`, I give it the `--warn` option, however, this often 
> makes the compiler generate warnings like "Top-level value `foo` does not 
> have a type annotation.", if there are a lot of these, it would make the 
> real warnings hard to notice.
>
> Sometimes I deliberately omit type annotations for top level values, the 
> reason is that these values are just some strings and numbers, (like CSS 
> colors, some constants, etc.), or even initial model of type Model, there 
> is really no need to annotate them, and annotating them would make the code 
> looks uglier (because in the case of CSS colors, you often have several 
> colors in succession, like `white=Css.hex "aabbcc" \n black=Css.hex 
> "bbccdd" \n green=Css.hex "ccddee", if you annotate them, it becomes 
> verbose).
>
> As someone pointed out, a good consequence of type inference is that you 
> don't have to write type declarations if you don't want to, however, I 
> think Elm may have a different opinion on this.
>

-- 
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: Drawing Directed Graphs (?) in Elm

2017-08-05 Thread Jakub Hampl
In principle this sort of thing would be in scope for elm-visualisation to 
implement. However, as that particular approach entails a lot of work, I would 
like to hear about the details of the use case and whether the force layout 
approach could not be adapted to work. 

-- 
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: How to manage long running computations in Elm?

2017-07-03 Thread Jakub Hampl
In JS, you could measure the time of each iteration and then only do so many 
that it would fit into a “frame budget” (so < 16ms, or if you are updating the 
DOM you would probably only spend say 10ms). However, I’m not sure how easy 
that would be in Elm.

On Jul 2, 2017, 20:59 +0300, 'Rupert Smith' via Elm Discuss 
<elm-discuss@googlegroups.com>, wrote:
> On Friday, June 30, 2017 at 9:43:51 AM UTC+1, Jakub Hampl wrote:
> > One way of approaching this is to show the user progress in an interesting 
> > way. In this example, the computation that calculates the final layout of a 
> > network graph (which is pretty expensive) is animated so the user can watch 
> > the algorithm converge.
>
> Nice example, I like how you can interrupt it by clicking on one of the other 
> examples, so the UI is not getting frozen.
>
> One thing about this example, is that is driven off of a timer tick. So if 
> each iteration of the node layout takes say one microsecond of CPU time, and 
> the timer ticks every millisecond - it will only use 1/1000th of the CPU. Its 
> fine for animation.
>
> In my case I don't want to use a timer tick to drive the computation, because 
> I want to use 100% of the CPU (or close to it) to complete a computation as 
> quickly as possible, but still not block user interaction.
>
> We had a good first Elm Scotland Meetup btw, hope you can make the next one.
> --
> You received this message because you are subscribed to a topic in the Google 
> Groups "Elm Discuss" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/elm-discuss/M5teKjboylI/unsubscribe.
> To unsubscribe from this group and all its topics, 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: How to manage long running computations in Elm?

2017-06-30 Thread Jakub Hampl
One way of approaching this is to show the user progress in an interesting 
way. In this example 
, the 
computation that calculates the final layout of a network graph (which is 
pretty expensive) is animated so the user can watch the algorithm converge.

On Wednesday, 14 June 2017 04:39:57 UTC+3, Matthieu Pizenberg wrote:
>
> One thing that I think I would have tried in this case, it to delegate the 
>> long running computation to a webworker 
>> , and then talk with it 
>> through a port.
>
>
> I'm not from the web community. I had bases in html+css+js, but pretty 
> much had to relearn my JS when started to try elm, so I've never used web 
> workers before. Not sure I'd like to take some time to learn how it works.
>
> On Wednesday, June 14, 2017 at 5:10:30 AM UTC+8, Rupert Smith wrote:
>>
>> Did you try this technique? Its not ideal, but at least it makes it no 
>> longer a stopper.
>>
>
> Nope, but thanks, I keep the idea in mind. Actually, It wasn't the only 
> issue I had since this was mainly image manipulation. The lack of binary 
> data type support was also very restricting. Then I didn't want to invest 
> too much energy in this. I prefer to wait and see for now, busy with other 
> matters. I'm still confident in the fact that elm is a great language and 
> evolves slowly but surely. I'm just here a bit too early for some of my 
> needs. For the rest, I'm very happy with elm.
>

-- 
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: Force directed graph drawing in Elm

2017-06-06 Thread Jakub Hampl
I've spent some time working on a QuadTree based approach, but haven't had
the time to benchmark it properly yet. I don't see why it would be
significantly slower than D3, as the algorithm underpinning it would be the
same.

Sent from my iPhone

On 5 June 2017 at 22:49, Erkal Selman <erkalsel...@gmail.com> wrote:

> I would be very interested in the pure elm implementations of
> force-directed graph drawing.
> For this project: https://erkal.github.io/kite/
> Currently, I interact with D3 via ports.
>
> I have a question: Is it possible to compete with D3-Force
> <https://github.com/d3/d3-force> in performance?
>
>
>
>
>
> On Saturday, June 3, 2017 at 7:57:14 AM UTC+2, Chad Stearns wrote:
>>
>> Awesome Jakub.
>>
>> When you merge that PR, I will probably start using it immediately.
>>
>> On Thursday, June 1, 2017 at 3:51:58 AM UTC-4, Jakub Hampl wrote:
>>>
>>> Actually there are two different libraries that do this:
>>>
>>> - https://github.com/folkertdev/graph-layout
>>> - https://github.com/gampleman/elm-visualization/pull/4
>>>
>>> I would suggest taking a look at these (both use somewhat of a different
>>> approach) and seeing how they fit your needs. Neither of them is published
>>> yet, but I plan to ship that PR soon-ish.
>>>
>>> On Tuesday, 30 May 2017 22:54:20 UTC+1, Chad Stearns wrote:
>>>>
>>>> Hey Jan,
>>>>
>>>> I think I can help you with this. I am working on a force diagram for
>>>> my client. Right now I have some stuff going in D3, but integrating that
>>>> into an Elm app is pretty sketchy. Its forcing me to consider an all-Elm
>>>> solution. I don't really know anything about force graph mathematics, but I
>>>> could learn, and I have published a few Elm packages.
>>>>
>>>> I agree with your itemization of the functionality. How can we
>>>> collaborate?
>>>>
>>>> Best,
>>>> -Chad
>>>>
>>>> On Sunday, May 28, 2017 at 8:03:05 AM UTC-4, Jan Hrček wrote:
>>>>>
>>>>> Hello all,
>>>>>
>>>>> I was surprised that there's no elm package that would enable to
>>>>> render force directed graph layout animation purely in elm (please let me
>>>>> know if there's any existing package supporting this). So I tried
>>>>> implementing it myself and here's my first prototype [1] (source code here
>>>>> [2]). I'm playing with an idea of making this into reusable library.
>>>>>
>>>>> Would some of you find such library useful? If so what functionality
>>>>> it should provide?
>>>>>
>>>>> My idea for the functionality provided by the library would be this:
>>>>>
>>>>> What you provide:
>>>>> - a graph with some data (probably based on elm-community/graph)
>>>>> - parameters of the layout algorithms (similar to what you see in the
>>>>> prototype)
>>>>> - node and edge rendering function (something returning Svg elements
>>>>> for rendering nodes and edges, given (x,y) coordinates of the nodes)
>>>>>
>>>>> What library would do for you:
>>>>> - it would enrich the graph by adding "node position" information and
>>>>> would simulate how these positions change over time
>>>>>
>>>>> I'd be grateful for any comments / questions / ideas for improving my
>>>>> existing code.
>>>>> regards,
>>>>> Jan Hrček
>>>>>
>>>>> [1] http://janhrcek.cz/elm-graph-layout.html
>>>>> [2] https://github.com/jhrcek/force-layout
>>>>>
>>>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Elm Discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/elm-discuss/a4noPF9YIhg/unsubscribe.
> To unsubscribe from this group and all its topics, 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: Force directed graph drawing in Elm

2017-06-01 Thread Jakub Hampl
Actually there are two different libraries that do this:

- https://github.com/folkertdev/graph-layout
- https://github.com/gampleman/elm-visualization/pull/4

I would suggest taking a look at these (both use somewhat of a different 
approach) and seeing how they fit your needs. Neither of them is published 
yet, but I plan to ship that PR soon-ish.

On Tuesday, 30 May 2017 22:54:20 UTC+1, Chad Stearns wrote:
>
> Hey Jan,
>
> I think I can help you with this. I am working on a force diagram for my 
> client. Right now I have some stuff going in D3, but integrating that into 
> an Elm app is pretty sketchy. Its forcing me to consider an all-Elm 
> solution. I don't really know anything about force graph mathematics, but I 
> could learn, and I have published a few Elm packages.
>
> I agree with your itemization of the functionality. How can we collaborate?
>
> Best,
> -Chad
>
> On Sunday, May 28, 2017 at 8:03:05 AM UTC-4, Jan Hrček wrote:
>>
>> Hello all,
>>
>> I was surprised that there's no elm package that would enable to render 
>> force directed graph layout animation purely in elm (please let me know if 
>> there's any existing package supporting this). So I tried implementing it 
>> myself and here's my first prototype [1] (source code here [2]). I'm 
>> playing with an idea of making this into reusable library.
>>
>> Would some of you find such library useful? If so what functionality it 
>> should provide?
>>
>> My idea for the functionality provided by the library would be this:
>>
>> What you provide: 
>> - a graph with some data (probably based on elm-community/graph)
>> - parameters of the layout algorithms (similar to what you see in the 
>> prototype)
>> - node and edge rendering function (something returning Svg elements for 
>> rendering nodes and edges, given (x,y) coordinates of the nodes)
>>
>> What library would do for you: 
>> - it would enrich the graph by adding "node position" information and 
>> would simulate how these positions change over time
>>
>> I'd be grateful for any comments / questions / ideas for improving my 
>> existing code.
>> regards,
>> Jan Hrček
>>
>> [1] http://janhrcek.cz/elm-graph-layout.html
>> [2] https://github.com/jhrcek/force-layout
>>
>

-- 
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: Best practices to create examples for an elm package?

2017-05-11 Thread Jakub Hampl
In elm-visualisation I use option #3 but build things into a /docs 
directory that github serves. This is done 
via https://github.com/gampleman/elm-example-publisher, which has a UI 
somewhat resembling bl.ocks.org

On Monday, 8 May 2017 04:58:26 UTC+1, Matthieu Pizenberg wrote:
>
> Exploring a bit the packages repository, I've come accross the following 
> options:
>
> 1. no examples/ dir, all in readme and documentation. 
> (elm-array-exploration, ...)
> 2. examples/ dir with nothing more than `.elm` files (elm-decode-pipeline, 
> elm-monocle, ...)
> 3. examples/ dir with an `elm-package.json` file (elm-transducers, ...)
> 4. examples/ dir with a `package.json` node builder (elm-kinto, ...)
>
> I personally have a mix of (2) and (3). However I feel like they all have 
> issues.
>
> 1. Sometimes, having a "ready to build" example is useful.
> 2. It relies on building from the root directory of the package (where the 
> `elm-package.json` file lives). It also means that the example file can 
> "cheat" by accessing non exposed modules.
> 3. If you add your `src/` dir in the json, then you can also "cheat" like 
> in 2. If you do not, and you use your package as if it was loaded from elm 
> packages, then you cannot verify that your latest modifications (not pushed 
> yet) are working with your examples.
> 4. Well, it's a bit too heavy of a machinery most of the times. Plus it 
> also requires an `elm-package.json` file anyway so the same issues as (2) 
> and (3) apply.
>
> *Do you think there is a best practice? Are there alternatives to those 
> four?*
>

-- 
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: ANN: TypedSvg

2017-04-20 Thread Jakub Hampl
https://codepen.io/anon/pen/gWrbxr

On Wednesday, 19 April 2017 14:16:08 UTC+1, Duane Johnson wrote:
>
>
> On Tue, Apr 18, 2017 at 7:20 AM, Jakub Hampl <kop...@gmail.com 
> > wrote:
>
>> Think of the  element akin to the  element in HTML. Yes, fairly 
>> often you will simply pass a string to it, but it needing lower level 
>> styling is pretty common.
>>
>> For the API you proposed, what would happen if you passed in both a 
>> non-empty list of svgs and a string?
>>
>
> Do you happen to have an example of the  element in use as a parent 
> node of several child nodes? Up to this point, I've simply used it as a 
> "label"-like feature of my SVG graphics, where the attributes of the  
> element have sufficed to place a single line or label in the correct 
> location, with the right color etc.
>

-- 
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: ANN: TypedSvg

2017-04-18 Thread Jakub Hampl
Think of the  element akin to the  element in HTML. Yes, fairly 
often you will simply pass a string to it, but it needing lower level 
styling is pretty common.

For the API you proposed, what would happen if you passed in both a 
non-empty list of svgs and a string?


RE: strokeWidth - that's a bug, the attribute is actually called 
stroke-width 
<https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-width>.

On Tuesday, 18 April 2017 12:08:23 UTC+1, Rupert Smith wrote:
>
> On Tuesday, April 18, 2017 at 10:59:20 AM UTC+1, Jakub Hampl wrote:
>>
>>
>> https://developer.mozilla.org/en-US/docs/Web/SVG/Element#Text_content_elements
>>
>>  elements can contain quite a number of children that allow you to 
>> do very precise formatting of the actual text content. There are plenty of 
>> usecases like custom fonts, rendering text on a path, text effects, etc.
>>
>
> Yes. I suspected this might be the case. 
>
> Perhaps it is more often the case than the simple situation of inserting a 
> hello is?
>
> How about this for the signature for a text node:
>
> text : List (Attribute msg) -> List (Svg msg) -> String -> Svg msg
>
> Lets you specify the actual text as a String, and you can supply empty 
> lists if you don't need any attributes or other Svg elements?
>

-- 
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: ANN: TypedSvg

2017-04-18 Thread Jakub Hampl
https://developer.mozilla.org/en-US/docs/Web/SVG/Element#Text_content_elements

 elements can contain quite a number of children that allow you to do 
very precise formatting of the actual text content. There are plenty of 
usecases like custom fonts, rendering text on a path, text effects, etc.

However having the thing that inserts a text node called text when there 
exists also a text element is confusing. Also text nodes are much rarer in 
practice in SVG than in HTML, so using a longer function name would make 
sense. 

I think textNode : String -> Svg msg would make sense and make text : List 
(Attribute msg) -> List (Svg msg) -> Svg msg would make sense.

On Monday, 17 April 2017 16:07:44 UTC+1, Duane Johnson wrote:
>
>
> On Mon, Apr 17, 2017 at 4:49 AM, 'Rupert Smith' via Elm Discuss <
> elm-d...@googlegroups.com > wrote:
>
>> Not much progress with this recently, sorry. But starting to look at it 
>> again today and I am back to work this week. I'm just trying to render some 
>> simple diagrams with boxes and text and arrows and such-like. 
>>
>
> Great!
>  
>
>>
>> The way you put text in a diagram is a bit strange, as you use 
>> "TypedSvg.text_" to render the  node but then "TypedSvg.Core.text" to 
>> insert the actual text. So that is how SVG works but I think perhaps a 
>> helper function could make it nicer.
>>
>
> Yeah, I think that's reasonable. Would it make sense to have:
>
> `text : List (Attribute msg) -> String -> Svg msg`
> a helper method that takes attributes and a string, and returns a text 
> node with text
>
> `textNode : List (Attribute msg) -> List (Svg msg) -> Svg msg`
> what is now "text_"
>
> `textContent : String -> Svg msg`
> what is now "text"
>
> The reason I think it makes sense to use the more-desirable "text" method 
> as the helper itself is because I can't think of a use case where you'd 
> want to add anything other than one piece of text content inside a text 
> node. And if there is such a use case, it seems obscure. So that makes me 
> want to make the short and concise function the one that is most useful, 
> and the more verbose ones used in rare cases.
>
> Duane
>
>

-- 
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: Divide by zero?

2017-02-21 Thread Jakub Hampl
If you have such a case where correctness is much more important than 
ergonomics, nothing is stopping you from creating your own type that 
performs maths safely and using it through out your app. 

For many apps the ergonomic impact of that would be too large, so this is 
not done.

On Tuesday, 21 February 2017 11:22:54 UTC, Rupert Smith wrote:
>
> On Tuesday, February 21, 2017 at 2:19:33 AM UTC, Max Goldstein wrote:
>>
>> I don't think anyone likes that 2 // 0  == 0, but no one has a better 
>> idea.
>>
>
> I have a better idea. Make it a runtime error and halt the program. 
>

-- 
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: Documentation storage : IN or OUT ?

2016-12-17 Thread Jakub Hampl
Also note that for publishing public packages the compiler forces every 
exported function to have documentation 

-- 
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: D3 4.0 or D3-shape

2016-10-25 Thread Jakub Hampl
I'm the author of the aforementioned library. Arc generators happen to be next 
on my roadmap, which you can see on 
https://github.com/gampleman/elm-visualization/projects/1. I've marked things 
that should be reasonably easy contributions there as well :)

-- 
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] D3js for 0.17??

2016-10-18 Thread Jakub Hampl
I wrote a library that is somewhat similar to d3 called 
gampleman/elm-visualization. It doesn't do any selections and doesn't contain 
all the "utilities" that d3 has (on purpose) and the number of visualisation 
tools available is limited (still working on expanding it). 

-- 
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.