In this thread 
<https://groups.google.com/forum/#!topic/elm-discuss/u_ui3PlDwLc> we 
collected use cases for dealing with loading files and decoding and 
constructing of binary data.

I would now like to take this discussion to the next stage and start 
collecting design ideas for those use cases. I think it would be best to 
try and see what we would like an Elm solution to the collected use cases 
to look like, where the goal would be for the solution to feel "elmish" but 
ideally also be informed by the capabilities and limitations of the 
available native browser APIs. Let us explore the design space a little and 
see what we can come up with.

I think that discussing several different proposals in detail in one 
dicussion thread will quickly become unwieldy, so my thought was that we 
could try to discuss individual ideas as gists with specific feedback 
happening there, and use this thread for big picture ideas and to 
synchronize what is happening on the gists.

Simon has already started with a draft of reading local files and uploading 
them as signed uploads to S3 - Simon, could you create a gist for that?

I started reading up a bit on the TypedArray/DataView apis and created 
drafts for 3 use cases that, in addition to Simon's read-and-upload example 
represent some of the major use case themes.

Here is what one of the simplest use cases could look like, reading local 
text files: 
https://gist.github.com/danyx23/35cea7421be6691cbda9e437d58641f0

Here are some initial thoughts on what a binary data decoder could look 
like. I haven't thought about this in detail, it is really just a 
conversation starter. This is a very bare-bones api idea - it is probably a 
lot more elmish to create a BinaryDecoder library similar to the 
Json.Decoder library.
https://gist.github.com/danyx23/852d793f44a74008868d37596069d49a

And finally a rough brainstorm what creating binary data in Elm could look 
like. When creating/writing binary, we have the problem that this will 
mutate the underlying ArrayBuffer, thus undermining some guarantees we have 
with normal Elm code. Maybe this will have to be modelled as a Cmd instead? 
https://gist.github.com/danyx23/a1f88da8913299bdb153a83979234878

I am very interested in what you all think and in alternative design ideas 
and/or feedback on these very rough 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 from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to