News for hackers. Stuff that matters.
Re:IBM releases Elm-powered app by yakshaving_jgt on Thursday January 10, 2019 @07:44AM (#18873416)
> North Korean style crap

This confirms my belief that most criticisms of Elm are emotional responses, not rational ones.

Allowing arbitrary JS functions to be called from wherever would indeed break everything. Want to use `Math.random()`? Whoops! There goes referential transparency. Want to use `document.querySelector()`? Hello runtime errors my old friend. Want to use `function(x) { return x / 0; }`?

Yeah, have fun with that. I'll stay in North Korea ¯\_(ツ)_/¯

Re:IBM releases Elm-powered app by chickenfries on Thursday January 10, 2019 @09:47AM (#18874171)
I literally have never experienced a bug because of the existence of Math.random(). I don’t think I’ve ever used it outside of a coding interview. Similarly, I don’t spend time debugging runtime errors caused by document.querySelector()? If I do it’s usually only once when I write the initial query. I don’t understand your last argument: why would I divide by 0?

Everyone’s relationship to their tools of choice has an emotional component. Check out this talk, you might find it interesting:

“The Pervert’s Guide To Programming Languages” https://youtu.be/mZyvIHYn2zk

Re:IBM releases Elm-powered app by aarpmcgee on Thursday January 10, 2019 @10:30AM (#18874499)
The core question is, "have you ever experienced a runtime error?" Have you ever spent time debugging a runtime error deployed to production?

You can't get those in Elm.

Re:IBM releases Elm-powered app by chickenfries on Thursday January 10, 2019 @12:46PM (#18876022)
No the core question is “does the time and effort spent on those cases justify the cost of switching to elm?” I have to weigh the benefit of no runtime exceptions against things like having to write interop code for libraries that I may have to integrate with.

It might make sense for other people. It doesn’t add up for me.

Re:IBM releases Elm-powered app by StreamBright on Thursday January 10, 2019 @12:00PM (#18875461)
Re:IBM releases Elm-powered app by yakshaving_jgt on Thursday January 10, 2019 @12:44PM (#18876002)
You’ve already posted this.

It’s intellectually dishonest to point to implementation bugs as fundamental flaws.

Re:IBM releases Elm-powered app by chickenfries on Thursday January 10, 2019 @12:48PM (#18876052)
This matters in the real world question of “should I use elm” even if it doesn’t matter to the theoretical question of “is the elm language sound?”. Especially since there is only one implementation of elm that updates very infrequently.
Re:IBM releases Elm-powered app by yakshaving_jgt on Thursday January 10, 2019 @12:55PM (#18876133)
Only insofar as you would check any technology for how well it’s made generally.

After a couple of years running in production, my opinion is that it is well-made generally.

Finding clever ways to break a technology isn’t a fair reflection of “real world” use, in my opinion.

Re:IBM releases Elm-powered app by chickenfries on Thursday January 10, 2019 @05:14PM (#18878814)
Fair enough. I don’t considering your complaints about Math.random() or division by zero to be a fair reflection of “real world use.”
Re:IBM releases Elm-powered app by StreamBright on Thursday January 10, 2019 @02:52PM (#18877408)
What are you talking about? You said no runtime errors because you have pure functions and now it turns out that actually implementation also matters?????

Imagine my shock................

Re:IBM releases Elm-powered app by sawady on Thursday January 10, 2019 @11:41AM (#18875217)
List.tail []
Re:IBM releases Elm-powered app by yakshaving_jgt on Thursday January 10, 2019 @11:59AM (#18875455)

  tail : List a -> Maybe (List a)
Nice try though.

https://github.com/elm/core/blob/master/src/List.elm#L548

Re:IBM releases Elm-powered app by sawady on Thursday January 10, 2019 @02:51PM (#18877395)
Haha, sorry. You know what I mean, a partial function.
Re:IBM releases Elm-powered app by yakshaving_jgt on Thursday January 10, 2019 @04:23PM (#18878353)
Except in Elm, the function isn't partial.

You're thinking of the partial functions from Haskell's Prelude.

Re:IBM releases Elm-powered app by StreamBright on Thursday January 10, 2019 @10:31AM (#18874505)
>>> I literally have never experienced a bug because of the existence of Math.random().

You must be doing something wrong than. :)

The world is impure. Pretending it is not is just laughable. I am saying this and I am actually writing only functional code for living, but I understand when I cannot solve the problem with functional concepts.

Few example:

- now()

- random()

- runSqlQuery()

- open a file

My code might be 90% pure functions but the rest is mutations, handling non-idempotent things, dealing with state, as the world is.

Re:IBM releases Elm-powered app by StreamBright on Thursday January 10, 2019 @07:50AM (#18873447)
I gave you examples of using JS type safe way. You don't care. One question I alway use to tilt FP purist zealots:

How about Time.now()? :) Source of disturbance, it should not be allowed to be used in programming etc. etc.

Re:IBM releases Elm-powered app by yakshaving_jgt on Thursday January 10, 2019 @08:16AM (#18873565)
Uhh… What? I’m confused. Did you think this would be a smoking gun to your argument?

Of course Time.now() is an effectful routine.

This is not a strange idea to “FP purist zealots” either.

How is it defined in Elm?

  Time.now : Task x Posix
How is it defined in Haskell?

  Data.Time.Clock.getCurrentTime :: IO UTCTime
And no, you have not given any examples of using JavaScript in a type-safe way. If you think you have, it means you don’t adequately understand type-safety.