[elm-discuss] Re: Encoding JSON and updating

2017-11-20 Thread David Legard
OK, thanks, I didn't fully understand your previous message. I'll do some more tinkering with 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] Re: Encoding JSON and updating

2017-11-20 Thread David Legard
OK, thanks for the suggestions. There's something going on beyond my comprehension level. I can read the data from http://localhost:3000/db, but when I try to send it back, even with an Http.emptyBody, I get: BadStatus { status = { code = 404, message = "Not Found" }, headers = Dict.fromList

[elm-discuss] Re: Encoding JSON and updating

2017-11-19 Thread David Legard
I'm testing it on *localhost*. -- 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

[elm-discuss] Encoding JSON and updating

2017-11-18 Thread David Legard
I am using a simple JSON decode and encode (following from examples at elm-tutorial ), but I'm clearly missing something. The *db.json* file has the simple structure { "plrs": { "ixd": "FF", "name": "Frank", "level": 3 } } .. and I decode that

[elm-discuss] Re: Expanding competence

2017-11-07 Thread David Legard
Many thanks for that recommendation. Yes, it is the back-end part that I was concerned about. -- 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] Expanding competence

2017-11-07 Thread David Legard
I have been working with Elm regularly since about 0.13, so I'm fairly competent up to and including JSON, Cmd, Sub, JS interop and topics like that. I have built some fairly detailed apps with those technologies included. I focus on educational software. What are the minimum extra skills I

[elm-discuss] Re: elm-seeds rocks!

2017-08-31 Thread David Legard
Many thanks for the link - those are terrific videos -- 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,

[elm-discuss] Re: More pattern matching

2017-08-24 Thread David Legard
Thanks, that's rather a clever little package. The maintainer says that guards were in the Elm compiler at one time, but then removed as being unfamiliar and largely unnecessary. It's nice to have this small (23-line) implementation around, though. -- You received this message because you

[elm-discuss] Re: More pattern matching

2017-08-22 Thread David Legard
Thanks for the suggestions. Not visually elegant, perhaps, but conceptually quite neat and satisfying. I shall incorporate these ideas into my app. Thanks again. -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group

[elm-discuss] More pattern matching

2017-08-22 Thread David Legard
Does Elm have anything between an *if-then-else* flow control and* case* ? My use case is, I need to parse a string in various ways to decide which Analysis ADT to assign to the string. Thus sconvert : String -> Analysis sconvert s = if s=="all" then AllDays else if s=="unplayed"

[elm-discuss] Re: Json file size

2017-08-14 Thread David Legard
The other 2 modes of doing this failed as follows: 1) db.json. The JSON loaded fine, according to the Debug.log, but the program failed on the first user input. That is, when I changed the input [textarea [cols 70,rows 20,placeholder "Enter text here", onInput Change ] [] ... Change s ->

[elm-discuss] Re: Json file size

2017-08-14 Thread David Legard
I ended up going the JS/ports route and it works fine now, so thanks for the suggestion. It was quite a shock going back to the catalogue of atrocities that is Javascript after so long writing in Elm. It was like being thrown back into a medieval time of druids and burning witches. Twenty

[elm-discuss] Re: Json file size

2017-08-11 Thread David Legard
Thanks, I'll look through that code. A couple of minor points -- I am not using a Dict, simply a list of records holding the word pairs. Is Dict better performing in this situation? My use case is slightly different - as the source language (Thai) is written without spaces between words, I

[elm-discuss] Json file size

2017-08-10 Thread David Legard
I have been porting a language translation engine from HTML/JS to Elm, and it was easy to implement. The problem is that the dictionary contains 15,000 word pairs. I can't include those items as Elm files (since Elm-make runs out of memory), so I decided to put them in a JSON file and import

[elm-discuss] Re: Cascading ul and li with onClick

2017-06-12 Thread David Legard
Thank you both very much for these prompt and useful answers. I went with Pi's suggestion simply because it involved less rewriting. It worked straight out of the box :) -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from

[elm-discuss] Cascading ul and li with onClick

2017-06-11 Thread David Legard
I use cascading lists of ul and li elements (nodes) to create a navigation tree menu. I keep a list of which nodes are open in my model, and when I click on a node, I toggle its presence in the list of open nodes. I can then display or hide relevant nodes depending on whether they are open or

[elm-discuss] Re: view function to call other view function with different Msg type

2017-04-25 Thread David Legard
> > Well, the problem is itemView can't be used , as it is 'Html ItemMsg', and > not 'Html Msg' > However, the Item module doesn't have access to 'Msg' ( which is top level > ), > Whenever I run into that problem, I create a separate file *MessageTypes.elm* with the Msg types in it and

[elm-discuss] Re: Noticeable lag when working with a model that contains large dataset

2017-04-03 Thread David Legard
Might it also be quicker to put the Parent -> Child link in the Child element? That way you avoid Lists in your definition type alias Parent = { id: Int , title: String } type alias Child = { id: Int , title: String , ancestor: Parent } A further step could be to

[elm-discuss] Re: can't understand compiler error

2017-02-24 Thread David Legard
Think of it in terms of the type signature, in your case viewValidation : Model -> Html msg You are giving this function a Model, and every branch of this function must return a Html msg, nothing more, nothing less. The function is a black box - it expects a Model as input. It will return an

[elm-discuss] @font-face rule?

2017-02-04 Thread David Legard
There was an Issue raised about this previously - https://github.com/rtfeldman/elm-css/issues/20 Many websites use trendy fonts like Futura, Apercu, Proxima Nova etc to stand out from the crowd.-- I wondered if there was a painless way to use the @font-face rule in pure Elm. Thanks. -- You

[elm-discuss] Re: Again: which editor do you like best for Elm?

2017-02-04 Thread David Legard
With the Fira Code font and ligatures enabled, of course... it looks like it was Made For 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] Re: How to structure Elm with multiple models?

2016-12-22 Thread David Legard
One method which was suggested for Messages is that you define them all in a 'super-module' which is imported by Main and any other modules that need them module Global exposing (..) type Msg = NoOp | Home | GoBack | ... | ... ...then... module Main exposing (..) import Global exposing

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

2016-11-16 Thread David Legard
I should have mentioned that this in on Elm 0.18. On Thursday, November 17, 2016 at 9:24:50 AM UTC+7, 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] elm-repl cannot find module Tuple

2016-11-16 Thread David Legard
Started an elm-repl session and the message came up I cannot find the module Tuple. Module 'Repl' is trying to import it. Any ideas? -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails

[elm-discuss] Re: control structure

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

[elm-discuss] Re: Is this a refresh issue, or something to do with ordering?

2016-09-22 Thread David Legard
Perfect. Many thanks. -- 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

[elm-discuss] Is this a refresh issue, or something to do with ordering?

2016-09-22 Thread David Legard
I have a very simple SPA, one textbox, two buttons, and a div for showing messages. The aim of the app is to analyse the text in the textbox (on clicking the 'Process' button) to show messages in the div. The other button, Reset, is supposed to clear the textbox and the messages. The 'update'

[elm-discuss] Re: Permission denied: Elm package install

2016-09-14 Thread David Legard
I often find this problem if I am working in a folder which syncs to the cloud - Dropbox, Cubby, Google Drive, etc. Methods I use to get round this 1. Install in a non-synced folder 2. Run as administrator -- You received this message because you are subscribed to the Google Groups "Elm

[elm-discuss] Re: What concepts and models did you had to learn in order to be able to write good Elm code?

2016-08-11 Thread David Legard
Not so much Elm itself, but functional programming in general. What wouldn't lodge into my thinking was: immutability + the complete lack of variables + and no global scope. How do you achieve stuff if you can't write x = x + 1 ? It took me ages to get comfortable with the functional way of

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

2016-08-10 Thread David Legard
Does Google's MDL spec include the concept of clickable images? I need to present a multi-lingual site where the language is changed by clicking on a small PNG flag. It's easy to do in elm-html .. img [ src ("UK.png"),flagstyle, onClick English] [] .. .. but I don't see in in the MDL spec or

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

2016-08-10 Thread David Legard
Does Google's MDL spec include the concept of clickable images? I need to present a multi-lingual site where the language is changed by clicking on a small PNG flag. It's easy to do in elm-html .. img [ src ("UK.png"),flagstyle, onClick English] [] .. .. but I don't see in in the MDL spec or

[elm-discuss] Re: Which text editor do you prefer for Elm?

2016-08-10 Thread David Legard
VS Code on one machine, Atom on another. Both very good. And Firacode as the font, of course, for those cool ligatures. -- 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

[elm-discuss] Re: Elm Brackets extension

2016-07-21 Thread David Legard
I'm quite a fan of Visual Studio Code -- it supports all the languages I use, and has the solid feel you would expect from a Microsoft product (for better or for worse). But I guess it's Windows only... -- You received this message because you are subscribed to the Google Groups "Elm

[elm-discuss] Re: [ANN] elm-mdl 6.0.0 released

2016-07-13 Thread David Legard
OK, thanks. -- 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: Demo: simple writing app with word counter and timer

2016-07-03 Thread David Legard
Style 3 is very nice. As to word counting, it shouldn't be that hard to figure out an algorithm which removes the need to traverse the entire string. For example, every time the current location is a space and the next keystroke is a non-space, you have begun a new word. -- or -- every time

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

2016-06-03 Thread David Legard
How difficult would it be to write an automated script to turn CSS into Elm-Css? > i.e. to turn h1 { background-color: green; } into h1 = style ["background-color","green"] -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe

[elm-discuss] Re: Elm Reactor, no longer displaying index.html?

2016-05-29 Thread David Legard
The syntax for embedding an app has changed 0.16 0.17 Fullscreen Elm.fullscreen(Elm.Main); Elm.Main.fullscreen(); This, and other 0.17 changes, can be found in the upgrade guide