[elm-discuss] Re: How to do JSON export/import for apps?

2017-12-25 Thread art yerkes
You're on the right track not duplicating json decoding and encoding when they're part of larger things. You can do the same with init, too. Having state in components comes up a lot as a question in elm, I wrote about my take on how this should ideally work: https://medium.com/@prozacchiwawa/

Re: [elm-discuss] Re: Randoms as LazyLists

2017-11-13 Thread art yerkes
nerator s) start |> LL.map Tuple.first On Mon, Nov 13, 2017 at 1:48 AM, 'Rupert Smith' via Elm Discuss < elm-discuss@googlegroups.com> wrote: > On Saturday, November 11, 2017 at 6:33:34 PM UTC, art yerkes wrote: >> >> I always interpreted the warning in the d

[elm-discuss] Re: Randoms as LazyLists

2017-11-11 Thread art yerkes
I always interpreted the warning in the documentation as "Don't use the name LazyListView or the Nil and Cons constructors, instead using head, tail and headAndTail for most pattern matchng". I think it makes sense not to use the internal representation given that Dict and Array change when be

[elm-discuss] Re: Higher-order functions with a function using an extensible record?

2017-10-08 Thread art yerkes
It's a niggle, but I think it's more correct to say that type inference isn't completely decidable in the presence of subtyping. On Friday, October 6, 2017 at 6:45:42 AM UTC-7, Rémi Lefèvre wrote: > > Thank you very much, this is perfectly clear. > > For some reason, I was confused by extensible

[elm-discuss] Re: Why is the signature of 'program.subs' 'model -> Sub msg' ?

2017-07-17 Thread art yerkes
Updates take CPU time, heat up your user's laptop, reinvigorate cold memory, often when your user is trying to use their computer for other things. If running some code won't be useful, you should avoid running it. It also saves the environment just a tiny amount. On Monday, July 17, 2017 at

Re: [elm-discuss] Re: Looping While/Until

2017-07-11 Thread art yerkes
and recursive function definitions in > functional languages are, in their essence, the same thing. > > ( You cannot simulate every while loop with things like List.map though. > See https://en.wikipedia.org/wiki/LOOP_(programming_language) ) > > > > > > > On Tuesd

[elm-discuss] Re: Looping While/Until

2017-07-11 Thread art yerkes
You might need to do optimizations until there are no more changes to make. Conceptually, you can express it as a while loop. On Monday, July 10, 2017 at 8:28:15 AM UTC-7, Erkal Selman wrote: > > What exactly do you need the while-loop for? > > On Thursday, July 6, 2017 at 7:04:18 AM UTC+2, John

[elm-discuss] Re: Looping While/Until

2017-07-06 Thread art yerkes
Lazy lists are a slightly more versatile way to do iteration in elm. They can iterate up to a certain index (like a for loop, using iterate and take). And emulate a while loop using http://package.elm-lang.org/packages/elm-community/lazy-list/1.0.0/Lazy-List#takeWhile . Lazy list has toList a

[elm-discuss] Re: Missing json decoding tool to decode multitouch events cleanly

2017-05-06 Thread art yerkes
Something to note about event objects in javascript is that they can go out of scope when you carry them away from the event handler, consequently, elm does all decoding on the same stack as the event, and you're likely to get a runtime error if you store the raw event value. I decided to write

[elm-discuss] Re: Scaling Elm

2017-04-19 Thread art yerkes
That's a pretty good list. I'd add interacting with sound, files and focus, which require side-effect like interaction and haven't really been addressed well yet. On Wednesday, April 19, 2017 at 2:11:05 AM UTC-7, Peter Damoc wrote: > > Hello community, > > Scaling Elm apps seams to be a recurr

[elm-discuss] Re: Notify me when JWT expires

2017-04-13 Thread art yerkes
Thanks for sharing 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.c

Re: [elm-discuss] Re: Collecting use cases for File, ArrayBuffer and TypedArrays/DataViews

2017-04-09 Thread art yerkes
Clients usually don't need to validate tokens. I'm doing something a little special. Still, it's a pain. On Sun, Apr 9, 2017 at 8:55 AM, 'Rupert Smith' via Elm Discuss < elm-discuss@googlegroups.com> wrote: > On Sunday, April 9, 2017 at 2:59:26 PM UTC+1,

[elm-discuss] Re: Collecting use cases for File, ArrayBuffer and TypedArrays/DataViews

2017-04-09 Thread art yerkes
Since this thread has risen from the grave completely, handling JWT validation is kind of gross in elm. https://gist.github.com/prozacchiwawa/d51b4e49e59a2aa0d3a28b328f62627d Note that this requires a version of billstclair's sha256 that disables internal utf-8 handling (if there's demand, I'll

[elm-discuss] Re: Is there a way to get a compile-time error when a field is added to a record type but its corresponding JSON encoder is not?

2017-04-08 Thread art yerkes
I wrote this recently: http://package.elm-lang.org/packages/prozacchiwawa/elm-json-codec/1.0.0/JsonCodec which at least for normally sized objects will fail to compile if you're missing a field in an object. It isn't perfect but one advantage is that you build encoder and decoder pairs togethe

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

2017-03-19 Thread art yerkes
It's not a huge deal but other strongly typed languages definitely allow arbitrary expressions in record update syntax. # type t = { a : int ; b : float } ;; type t = { a : int; b : float; } # let emptyT () = { a = 1 ; b = 3.0 } ;; val emptyT : unit -> t = # let x = { (emptyT ()) with a = 7

Re: [elm-discuss] Can I run Elm with/on Nodejs

2017-02-25 Thread art yerkes
I've also been using elm on the server side, and have some thoughts: In elm-0.18 you'll use a Platform.program or Platform.programWithFlags and pass command line arguments via the flags from a small javascript runner. Unlike Sonny Michaud's approach, I've used the normal init/update/subscripti

[elm-discuss] Re: Polymorphic components

2017-02-18 Thread art yerkes
Most languages have some form of runtime dispatch but in elm you have to write it yourself, so it's up to you to choose a dispatch model. A couple of patterns for this: https://medium.com/@debois/elm-components-3d9c00c6c612#.hht7utwro https://medium.com/@prozacchiwawa/the-im-stupid-elm-language-

[elm-discuss] Re: [ANN] Ellie - the Elm platform in the browser

2017-02-13 Thread art yerkes
That's really fantastic work. Congratulations. On Monday, February 13, 2017 at 8:08:45 AM UTC-8, Luke Westby wrote: > > Hey friends! > > I made this so you can share and run Elm stuff from the browser with full > access to ports, external JS, css, and all the community packages. > > https://www.

Re: [elm-discuss] I wish ELM could just be used in the browser

2017-01-31 Thread art yerkes
The current elm try page uses a server side compiler, which is ok, but not ideal for some uses. The ghcjs compiled elm compiler, with other build infrastructure in javascript is here: https://www.npmjs.com/package/elm-basic-compile On Tue, Jan 31, 2017 at 3:02 AM, Zachary Kessin wrote: > I thin

Re: [elm-discuss] I wish ELM could just be used in the browser

2017-01-29 Thread art yerkes
Your post makes me wonder about an alternate future where browsers just adopted every new environment that wanted to become a standard language for web development. We'd have some horrible mixture of: javascript, perl, tcl, scheme, emacs-lisp, common-lisp, actionscript, dart, java as a source

[elm-discuss] Re: Guidance for using "type alias" vs. single-constructor union types

2017-01-16 Thread art yerkes
You could try elm-generic-dict to have arbitrary keys in dicts. On Monday, January 16, 2017 at 6:31:28 AM UTC-8, Austin Bingham wrote: > > Ah ha! That bit of syntax is exactly what I was looking for. That get's me > a lot of what I was hoping for. > > Regarding the use of helper functions, I agre

Re: [elm-discuss] Re: Elm "faster than JavaScript" (version 0.18) - NOT - Parts I and II...

2017-01-15 Thread art yerkes
After working with the elm compiler just a bit from the outside, I think there might be build time improvements to be had by improving the build info dropped in elm-stuff. I think reducing the number of graph.dat and .elmi files read during the build process might help. On Sat, Jan 14, 2017 at 10

[elm-discuss] Re: Proposal: Main.attach(node) to attach Elm to existing DOM?

2017-01-14 Thread art yerkes
+1 As an aside, you can use a dom mutation observer to avoid the blink, but it'd be better with proper support. On Saturday, January 14, 2017 at 1:31:17 AM UTC-8, Josh Adams wrote: > > +1 > > Not much more to add, but figured it was worth mentioning since you're > looking for feedback :) I have

Re: [elm-discuss] Re: Elm "faster than JavaScript" (version 0.18) - NOT - Parts I and II...

2016-12-31 Thread art yerkes
ber 2016 03:25:53 UTC+7, art yerkes wrote: >>> >>> The promise of never needing to really get dirty and debug live Elm code >>> is real, and it's true that nothing else quite lives up to that. >>> >> >> Amen to that: the advantage of being simple a

Re: [elm-discuss] Re: Elm "faster than JavaScript" (version 0.18) - NOT - Parts I and II...

2016-12-30 Thread art yerkes
, and Fable have the best chance of getting there reasonably > quickly, with Elm also actively developed, but I think we are looking at a > minimum of a year for any of them to get to stable status. > > On Thursday, 29 December 2016 22:23:50 UTC+7, art yerkes wrote: >> >>

Re: [elm-discuss] Re: Elm "faster than JavaScript" (version 0.18) - NOT - Parts I and II...

2016-12-29 Thread art yerkes
I can comment a bit on purescript and fable (and ghcjs) from a n00b perspective in all three. - Purescript's type system is not as well polished as haskell and has IMO a steeper learning curve. - Purescript's package ecosystem is very immature. - Purescript's js interop is very easy and doesn't

[elm-discuss] Re: How do you name messages?

2016-10-21 Thread art yerkes
I'd be on board with using both: case action of ... ClickRegistrationSubmit form -> let vErrors = validate form in vErrors |> Maybe.map (\ve -> update (ShowValidationErrors ve)) |> Maybe.withDefault (update (SubmitForm form)) separates concerns and levels of abs

[elm-discuss] Re: Can I throw strings at the elm compiler?

2016-10-21 Thread art yerkes
Recently, I've been working on a cradle for the compiler that can serve as an example for your use case https://github.com/prozacchiwawa/elm-basic-compile On Thursday, October 20, 2016 at 9:47:28 PM UTC-7, Adam Fluke wrote: > > So I know that answer may be no, but I thought I'd ask incase I miss

Re: [elm-discuss] Re: Creating an API to be consumed by JS developers

2016-10-10 Thread art yerkes
Elm has very little friction when used as a library from javascript if your API can be expressed in terms of callback streams or promises, although it'll be necessary to write trivial wrapper code to do give it a nice API (for example, to match requests to responses when fulfilling promises).

[elm-discuss] Re: Confused by error (inline function, >, tagged type)

2016-09-25 Thread art yerkes
Because it messes up atom support for elmx, I often defined this: gt : a -> b -> bool gt a b = a > b And used it like: if a `gt` b then You could use that for your tagged type and it'd perhaps have reasonable readability.. On Saturday, September 24, 2016 at 3:24:21 PM UTC-7, Brian Marick wrot

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-15 Thread art yerkes
HttpError has BadResponse Int String which you can use to detect non-200 results to http requests. The way to do it in elm is to write a function that wraps the creation of login enabled http requests and translates 401 errors into a suitable message (which is why Task.perform has two function

[elm-discuss] Re: no user not a github project

2016-09-15 Thread art yerkes
I discovered this recently when trying out elm-server-side-renderer . The elm compiler is parsing the repository url in elm-package.json and using what would be the user name and repository fields for these. Apparently, what you have is what happens when the repository url doesn't point to gi

[elm-discuss] Re: Design of Large Elm apps

2016-08-05 Thread art yerkes
In my app, my elm code was structured like this (note that this is an SPA with no server integration ...) /Master.elm <-- SPA host. Hosts a header, drawer, login dialog and view stack /Account/Login.elm <-- Login dialog /Account/WorkoutEditor.elm <-- Views that can be accessed only by logging i

[elm-discuss] Re: [ANN] elm-mdl 7.0.0 — supports all components of Material Design Lite

2016-08-04 Thread art yerkes
Thanks for your effort in writing elm-mdl. It's really amazing. On Thursday, August 4, 2016 at 6:15:15 AM UTC-7, Rupert Smith wrote: > > On Wednesday, August 3, 2016 at 11:07:00 PM UTC+1, debois wrote: >> >> I'm very happy to announce the release of elm-mdl 7.0.0. >> > Wow, can't wait to try this

[elm-discuss] Re: Unit Types : A Radical Proposal

2016-07-28 Thread art yerkes
F# is kind of radical in that it has units. https://fsharpforfunandprofit.com/posts/units-of-measure/ It's not perfect, but it could serve as a starting point for evaluating different ways of having units as part of a language. On Thursday, July 28, 2016 at 11:42:44 AM UTC-7, John Bugner wrote:

Re: [elm-discuss] Touch module in Elm 0.17

2016-07-27 Thread art yerkes
A proper expression of touch includes multiple touches that can come and go independently, along with extra parameters for each (pressure is one but velocity is another too). Neither was relevant to the things I was writing but it'd be awesome to see a touch API that exposes touch fully in a way t

[elm-discuss] Re: port module for JS interop.. without main/view ?

2016-07-24 Thread art yerkes
You do need a main, at the very least to pass init, update and subscriptions to the runtime that will iterate your app. View can return a single DOM node and be satisfied. It won't actually be displayed, but needs to be there. Elm works well in this scenario. Here's an example I did a while

Re: [elm-discuss] Re: Inter-Component Communication in 0.17

2016-07-15 Thread art yerkes
Try testing any part of such a big ball of mud. TEA components can even be poked in the repl, which you can't do with a Main module easily. On Friday, July 15, 2016 at 5:08:23 PM UTC-7, Max Goldstein wrote: > > Allow me to suggest that this approach is *totally overkill*. It might not > be, but

[elm-discuss] Re: Type Checking in non-Pure Languages

2016-06-13 Thread art yerkes
In ocaml, you still tend to write pure code as much as possible, but it's definitely not guaranteed. For a few reasons related to sum types and ocaml's build process, checked exceptions would actually help a lot more than they do in java, so I think it's a shame they aren't in ocaml, as it'd w

Re: [elm-discuss] Touch module in Elm 0.17

2016-05-16 Thread art yerkes
I do it like this: D.oneOf [ D.at ["touches", "0"] (D.object2 TouchPosition ("pageX" := D.float) ("pageY" := D.float)) , D.object2 TouchPosition ("pageX" := D.float) ("pageY" := D.float) ] Which can be bound to both touch and mouse events and yields whatever the event has. On Sunday, May 15, 2