[elm-discuss] Re: Unsafe mechanism

2017-03-14 Thread Rex van der Spuy
On Monday, March 13, 2017 at 5:06:44 AM UTC-4, Oliver Searle-Barnes wrote: > > What if unsafe because a first class concept in Elm? You could mark > functions as "unsafe". Any function that calls an unsafe function would > also be required to be declared as unsafe e.g. > I use Elm entirely

[elm-discuss] Re: Unsafe mechanism

2017-03-14 Thread Kasey Speakman
Seems like mostly semantics, but ok I'll take your criticisms. However, I didn't realize that Http had `toTask`. Thanks for letting me know that. :) I'm still not using Http because I'm not wasting my time maintaining encoders/decoders. And since I have to go out to a port, I'm just using a

[elm-discuss] Re: Unsafe mechanism

2017-03-13 Thread Zinggi
Sorry, but there were many wrong / half truths in here, so I had to respond ;) Elm does not allow user code to do side effects > This is wrong, that's what Task and ultimately Cmd are for. It's true that there is no way to do *uncontrolled* side effects, e.g. a function that sends an https

[elm-discuss] Re: Unsafe mechanism

2017-03-13 Thread Kasey Speakman
The landscape as I see it: Elm does not allow user code to do side effects (i.e. communication/IO). In Haskell, a function with side-effects is marked as "unsafe" if it declares IO in it's signature e.g. `readFileText: string -> IO string`. Since front-end IO is somewhat narrow in what is

[elm-discuss] Re: Unsafe mechanism

2017-03-13 Thread Dmitry Utkin
Hi Oliver, Your code sample looks very similar to https://github.com/eirslett/elm-task-port-example/blob/master/example/Main.elm That's a repo related to proposal on adding `Task-based ports`. They were proposed more than once already, but I'm not aware of any opinion on the subject in the