[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 -> ({model | sourcetext = s},Cmd.none)


.. the call stack error occurred. Theoretically, the Decoding had occurred 
prior to any user input, but who knows


2) The pure Elm approach

I began with the dictionary in one huge Elm variable

List (String,String)


then, after doing some reading about compiler crashes, cut it into several 
files.


dictionary : List Word
dictionary = [D1.words,D2.words,D3.words . ] |> List.concat |> makeWords

makeWord : (String,String) -> Word 
makeWord (e,t) = Word e t

makeWords : List (String,String) -> List Word 
makeWords = List.map makeWord

But it still wouldn't compile.

-- 
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: 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 lines of Javascript 
caused me more pain than 700 lines of Elm.

One thing I came across which I haven't seen documented is the way to write 
Unicode literals in Elm (I have to work with the Thai alphabet, which is at 
\U0E00 on up.)

Anyway, Elm likes its Unicode literals as

gorgai : Char
gorgai = '\x0E01'

-- 
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: Json file size

2017-08-14 Thread Steve Schafer
I think your problem is this bug: 
https://github.com/elm-lang/elm-compiler/issues/1521

The workaround is to disable the Elm debugger.


On Friday, August 11, 2017 at 5:03:41 AM UTC-4, David Legard wrote:
>
> 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 need access to all the Dict keys 
> when parsing a text to determine where the word breaks go, so it's not just 
> a matter of interrogating the database.
>
> Also, the Dict items need to be sorted in a particular way (by length of 
> the key), which is an added challenge.
>
> Anyway, thanks for showing me a new direction to pursue.
>

-- 
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: Json file size

2017-08-13 Thread Ian Mackenzie
I suspect there will be a way of making this work without dropping into JS. It 
looks like you're hitting some sort of very deep recursion which is causing a 
stack overflow - try seeing if you can isolate which of your function calls is 
triggering the stack overflow, and see if you can change some function from 
recursive to non-recursive (or tail recursive). If you have example code, that 
would also be helpful...

-- 
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: 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 need access to all the Dict keys 
when parsing a text to determine where the word breaks go, so it's not just 
a matter of interrogating the database.

Also, the Dict items need to be sorted in a particular way (by length of 
the key), which is an added challenge.

Anyway, thanks for showing me a new direction to pursue.

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