Re: [elm-discuss] Re: Making imports more pleasant

2016-08-22 Thread Francesco Orsenigo
Are you going to write such plugin for every possible editor? Is every newbie going to have such plugin? What about browsing code from GitHub? A language's readability should not depend on tooling. On Mon, Aug 22, 2016 at 5:52 PM, William Bailey wrote: > For years I coded

Re: [elm-discuss] Re: Making imports more pleasant

2016-08-22 Thread Francesco Orsenigo
, Will White <will.n.wh...@gmail.com> wrote: > I don't think it should be disallowed entirely. Disallowing it would make > Html and other familiar things like that harder to read, without helping > understanding. > > On Monday, August 22, 2016 at 11:10:38 AM UTC+1, Fra

Re: [elm-discuss] Re: Making imports more pleasant

2016-08-22 Thread Francesco Orsenigo
The only issue I have with imports is that any code that contains several unqualified imports is a pain in the ass to learn. Example: https://github.com/Bogdanp/elm-combine/blob/2.2.1/examples/Python.elm As a newbie, it's immensely frustrating being unable to easily track which of the `import

[elm-discuss] Record syntax overhaul

2017-03-01 Thread Francesco Orsenigo
I'm posting this here rather than in elm-dev because the discussion might get both long and broad. Also, as much as I would like to help out, I understand that only Evan changes the compiler. The matter has been discussed already, and it might be useful to get an idea of the prior thoughts:

[elm-discuss] Re: Modeling cross-references

2016-09-23 Thread Francesco Orsenigo
I'm writing a real time strategy game and I'm using numeric ids on everything. For example, each unit has an Id, and the command to attack another unit contains the target unit id. I keep all units in a (Dict UnitId Unit), so I can access each quickly. It's not as handy (or fast) as having

[elm-discuss] Re: How to use elm-style-animation to make smoothly moving clock hand

2016-09-26 Thread Francesco Orsenigo
Subscribe to `AnimationFrame.times` , store the time it gives you in the model, and render the clock with that time, adjusted for whatever speed or starting time you need. -- You received this message

[elm-discuss] Re: Modeling cross-references

2016-09-24 Thread Francesco Orsenigo
If the random access happens only on user input, ie it's not something you need to do several thousands times per second, stick to Lists. If you need a particular sorting order, stick to Lists. You can use `Dict.foldl/r` to map a dictionary to a list in a single step, rather than first

Re: [elm-discuss] How do you test a TEA `update` function?

2016-11-08 Thread Francesco Orsenigo
Ok, but is it justified to make your code more complicated just to enable testing? -- 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] Re: Convincing my team that Elm isn't just going to die like CoffeeScript

2016-11-06 Thread Francesco Orsenigo
CoffeeScript and Elm address two vastly different problems. CoffeeScript addressed "Writing JS is a pain in the ass": it was syntactic sugar and the need for it drastically lessened with ES6. CS was killed by the new JS extensions. Elm addresses run time errors and JS Fatigue, neither of which

Re: [elm-discuss] How do you test a TEA `update` function?

2016-11-09 Thread Francesco Orsenigo
Fair enough! On Thu, Nov 10, 2016 at 3:23 AM, Mark Hamburg <mhamburg...@gmail.com> wrote: > We didn't do it to enable testing. We did it because it also regularizes a > lot of other module interactions. Improving testing is a bonus. > > Mark > > On Nov 8, 2016, at 1:3

[elm-discuss] Re: Convincing my team that Elm isn't just going to die like CoffeeScript

2016-11-07 Thread Francesco Orsenigo
On Tuesday, November 8, 2016 at 2:45:26 AM UTC+11, Ian Dickinson wrote: > > >> With respect, I'm not sure that the essence of JS fatigue is new features > of the language itself, although I suppose ES5 to ES2015 is quite a big > change. As I hear it, it's rather the explosion of build tools,

[elm-discuss] How do you test a TEA `update` function?

2016-11-06 Thread Francesco Orsenigo
How do you write unit tests to ensure that an `update : Msg -> Model -> ( Model, Cmd Msg )` function is producing the correct commands? What if the function is supposed to produce several commands batched together? Same thing for a `view : Model -> Html Msg`. Suppose I want to test whether,

Re: [elm-discuss] why no more primes on 0.18 ?

2016-10-19 Thread Francesco Orsenigo
Primes can be confusing even when doing pure maths (I studied physics), it's just so easy to miss them, so good riddance. When it comes to model names, I always try to 1) pipe my functions so that I need the least intermediate variable names and 2) use descriptive names no matter what; for

[elm-discuss] Re: How to write function that updates arbitrary element of a record

2016-10-20 Thread Francesco Orsenigo
Can't you just create a smaller component that does the validation on itself, and then compose several of them into a list/dictionary? componentUpdate : (String -> Bool) -> Msg -> String componentUpdate hasError msg oldString = case UserEntersSomething newString if hasError newString then

[elm-discuss] Re: elm-repl cannot find module Tuple

2016-11-17 Thread Francesco Orsenigo
Delete elm-stuff/ and reinstall all packages. I assume you are upgrading from 0.17. On Thursday, November 17, 2016 at 1:24:50 PM UTC+11, David Legard wrote: > > Started an elm-repl session and the message came up > > I cannot find the module Tuple. > > > Module 'Repl' is trying to import it. >

[elm-discuss] Re: Why Range syntax got removed in favor of List.range

2016-11-13 Thread Francesco Orsenigo
Why would you want two different (and entirely equivalent) solutions to the same problem? On Monday, November 14, 2016 at 8:37:34 AM UTC+11, Andrew Radford wrote: > > Yeah It would be great if there was [x..y] and Range > >> >>> -- You received this message because you are subscribed to the

Re: [elm-discuss] Re: Why Range syntax got removed in favor of List.range

2016-11-14 Thread Francesco Orsenigo
Yup. It is just not used often enough to warrant special syntax. On Tue, Nov 15, 2016 at 10:09 AM, Witold Szczerba wrote: > I think List.range is just fine. No need for special syntax and strange > function names like ".." (hard to browse, find online, etc.). > > On Mon,

[elm-discuss] Re: Anyone working on audio stuff?

2016-10-09 Thread Francesco Orsenigo
I did this https://github.com/xarvh/elm-audio On Sunday, October 9, 2016 at 11:24:10 AM UTC+11, ratvis wrote: > > Either just HTLM5 audio element or web-audio? I kind of thought after .17 > came out, some more stuff would come out. > Just a wrapper thing around html5 audio (onPause,

[elm-discuss] Re: Scaling Elm

2017-04-20 Thread Francesco Orsenigo
I would add a dropdown. Even a simple dropdown poses some interesting challenges to the architecture: - Dropdowns are ubiquitous in web apps. - Dropdowns interact: when opening one, any other dropdown must close. - Implementing keyboard support requires side effects and state. - Dropdowns can

Re: [elm-discuss] Re: Scaling Elm

2017-04-23 Thread Francesco Orsenigo
e-dropdown-in-elm-part-1-d7ac2d106f13 > part 2 > https://medium.com/elm-shorts/a-reusable-dropdown-in-elm-part-2-9659ef988441 > > > Op donderdag 20 april 2017 23:45:07 UTC+2 schreef Francesco Orsenigo: >> >> >> I would add a dropdown. >> Even a simple drop

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

2017-03-06 Thread Francesco Orsenigo
@Martin Bailey if I found myself with 50 messages in the model update I'd take as a sign that I need to abstract things more. Regarding the update of nested attributes, I agree that there is not a good way to do it, hence this thread. =) @Michael Jones Maybe something like this could work

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

2017-03-05 Thread Francesco Orsenigo
Hi Martin, I wonder if for your case a different way to organise your code would be viable: -- Family.elm updateFamily msg family = case msg of ChangeName newName -> ( { family | name = newName }, Cmd.none ) Save -> ( model, saveFamily family ) selectedView family = UI.form

[elm-discuss] Re: Would Enums make a good addition to Elm?

2017-08-03 Thread Francesco Orsenigo
> > Also worth noting that (2) is already slated to be fixed directly. It's a > lower priority than other things in the hopper right now, but it'd probably > still be higher priority than adding an enum feature.  > This is fantastic news! -- You received this message because you are

[elm-discuss] Re: elm-format did something change?

2017-08-15 Thread Francesco Orsenigo
> > I suppose the question is, is there a consensus on which version is > considered to be the most 'definitive' for 0.18 code? > The last one. Other than that, or what you consider "last" there is no consensus and it's fine. In fact, you don't even have to use elm-format at all or feel

[elm-discuss] Re: State of CSS in Elm

2017-07-04 Thread Francesco Orsenigo
FWIW I am working on a major overhaul of https://github.com/xarvh/elm-styled-html The core idea is that CSS should be just normal Elm code, so that any pattern, syntax and tool that you can use for normal Elm code, you can use for CSS: modularisation, common variables, generator functions,

Re: [elm-discuss] Re: Moving on

2017-04-26 Thread Francesco Orsenigo
Eirik, I think it's a bit unfair to call it "One Correct Way™". The idea is "One Really Good Way that is Reasonably Future-Proof™". Maybe this hasn't been communicated effectively. Also, in production we keep getting run-time errors with third-party libraries that use React, so my experience

[elm-discuss] Re: Moving on

2017-04-25 Thread Francesco Orsenigo
I have felt very much as Duane describes, powerless and at the mercy of the whims of a few unreachable No Red Ink devs. I could not contribute my elm-audio library and found myself frustrated by the lack of progress along many fronts. However, I have since come to reconsider this. The point is,

Re: [elm-discuss] Re: Elm Textfield + a barcode scanner

2017-04-29 Thread Francesco Orsenigo
now my workaround? It "just-works" on Firefox, so this is the > browser I use for e2e tests… > > On Sat, Apr 29, 2017 at 11:57 PM, Francesco Orsenigo < > francesco.orsen...@gmail.com> wrote: > >> This is an interesting problem and I wonder if it would happe

[elm-discuss] Announcement: (yet another) elm-gamepad

2017-08-08 Thread Francesco Orsenigo
http://package.elm-lang.org/packages/xarvh/elm-gamepad/latest Gamepads cannot be implemented in pure Elm so I published a package and, in the docs, I tell the user "hey you need to manually add a port, you can find the code in the port/ directory". I hope this is an acceptable compromise

Re: [elm-discuss] Re: Best practices to create examples for an elm package?

2017-05-09 Thread Francesco Orsenigo
> I have my examples/elm-package.json include ../src, and have my CI script > build all the examples so that I remember to update the examples of the API > changes. > > Also, imo it's good to have a separate examples/elm-package.json because > you often want other dependencies to make a

[elm-discuss] Re: Best practices to create examples for an elm package?

2017-05-09 Thread Francesco Orsenigo
A personal pain point of mine is when the examples just import TheModule exposing (..) rather than just using fully qualified references TheModule.aFunction . First of all, because that's not how the library will be used. Second, and more important, unless you know already what the library

Re: [elm-discuss] Re: Adding CSS produced by a view function to the document's

2017-06-08 Thread Francesco Orsenigo
The idea is to keep a set of all the rules added to the header, add only those that are missing and never remove any. This will not work for for rules whose definitions are changed dynamically, but seems like an acceptable trade off. The ability to calculate all the styles that *might* appear

[elm-discuss] Adding CSS produced by a view function to the document's

2017-06-05 Thread Francesco Orsenigo
I am experimenting with view functions that produce both html content and the style that should be applied to that markup, as in myView : Model -> ( Html msg, List CssRule ) So far, I have been rendering the above by creating a

Re: [elm-discuss] Adding CSS produced by a view function to the document's

2017-06-06 Thread Francesco Orsenigo
trigger needless parsing of the mounted > CSS. > > > > > > On Mon, Jun 5, 2017 at 1:46 PM, Francesco Orsenigo <francesco...@gmail.com > > wrote: > >> I am experimenting with view functions that produce both html content and >> the style that should be applied to that

[elm-discuss] Re: Where for local functions

2017-06-18 Thread Francesco Orsenigo
Hi Igor, my understanding is that `where` has not been implemented and will not be implemented to 1) keep the syntax lean and 2) ensure a consistent coding style. I don't think Elm should have a `where` clause. Coming from Haskell and physics, I instinctively liked the `where` syntax better,

[elm-discuss] Re: Elm Textfield + a barcode scanner

2017-04-29 Thread Francesco Orsenigo
This is an interesting problem and I wonder if it would happen also with some other form of automated input (say, selenium). It might very well be a problem with Elm. On Saturday, April 29, 2017 at 12:51:48 AM UTC+10, Chris Van Vranken wrote: > > I'm using a barcode scanner to enter data into