Re: [elm-discuss] Json file size

2017-08-11 Thread Peter Damoc
Use the dictionary as a JS service.

You can load the dictionary in JS and use ports to interrogate it.
https://ellie-app.com/3Z8hSkXxxBGa1/0

If you like to live dangerously you can also use Kernel code to interrogate
the JS dictionary datastructure synchronously.
Since the dictionary is fixed, the purity of the function is maintained and
this falls into one of those extremely rare use cases where one drops to JS
for performance reasons.




On Fri, Aug 11, 2017 at 5:32 AM, David Legard  wrote:

> 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 that.
>
> It works when I load the application, but as soon as I start interacting
> with the app, the console logs the error:
>
> Main.elm:1381 Uncaught RangeError: Maximum call stack size exceeded
> at Object.cmp (Main.elm:1381)
> at Function.compare [as func] (Main.elm:1162)
> at A2 (Main.elm:92)
> at Function.func (Main.elm:4598)
> at A2 (Main.elm:92)
> at Main.elm:8952
> at Main.elm:16
> at A2 (Main.elm:93)
> at Function.func (Main.elm:5075)
> at A2 (Main.elm:92)
>
> Does anyone have any idea how I can circumvent this problem? 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.
>



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

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

It works when I load the application, but as soon as I start interacting 
with the app, the console logs the error:

Main.elm:1381 Uncaught RangeError: Maximum call stack size exceeded
at Object.cmp (Main.elm:1381)
at Function.compare [as func] (Main.elm:1162)
at A2 (Main.elm:92)
at Function.func (Main.elm:4598)
at A2 (Main.elm:92)
at Main.elm:8952
at Main.elm:16
at A2 (Main.elm:93)
at Function.func (Main.elm:5075)
at A2 (Main.elm:92)

Does anyone have any idea how I can circumvent this problem? 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.