News for hackers. Stuff that matters.
Re:IBM releases Elm-powered app by i_feel_great on Thursday January 10, 2019 @12:34AM (#18871762)
This inspired me to look up the Elm docs, and came across this gem:

  view model =
    div []
      [ button [ onClick Decrement ] [ text "-" ]
      , div [] [ text (String.fromInt model) ]
      , button [ onClick Increment ] [ text "+" ]
      ]
The html elements themselves are Elm functions. Code looks like data. Nice. Now considering Elm to be potentially useful tool to know.
Re:IBM releases Elm-powered app by grenadier21 on Thursday January 10, 2019 @12:46AM (#18871804)
That's how literally every VDOM-based framework looks, including React. Elm isn't special in this regard. It is special in many other regards, however, and I appreciate it for that. It's also interesting as one of the few languages that have parametric polymorphism but no ad-hoc polymorphism, which leads to some interesting designs. I don't like how only the BDFL is allowed to do certain things, like create new operators in external libraries, but overall, it's a very pleasant experience.
Re:IBM releases Elm-powered app by lalaithion on Thursday January 10, 2019 @10:30AM (#18874502)
"I don't like how only the BDFL is allowed to do certain things, like create new operators in external libraries"

Isn't this true for like, 95% of languages? Yes, Elm breaks from it's Haskell heritage in this regard, but this is a very common lack of feature.

Re:IBM releases Elm-powered app by grenadier21 on Saturday January 12, 2019 @01:16AM (#18890004)
Fair enough, but my main problem with it was that it existed, and then they removed it, which was very sad.
Re:IBM releases Elm-powered app by cttet on Thursday January 10, 2019 @01:36AM (#18871984)
"one of the few languages that have parametric polymorphism but no ad-hoc polymorphism"

I wonder what others are? Would like to try them.

Re:IBM releases Elm-powered app by Athas on Thursday January 10, 2019 @01:56AM (#18872044)
OCaml and Standard ML are two others, and I'd say OCaml is established enough that Elm is not really breaching new ground here. The main difference is that OCaml has other features you tend to use instead, particularly the module system.
Re:IBM releases Elm-powered app by ikfmpwdsoz on Thursday January 10, 2019 @08:07AM (#18873522)
OCaml is a very fun language in my experience. Apparently they were going to add ad-hoc polymorphism in the form of modular implicits, but I have no idea what happened to that.
Re:IBM releases Elm-powered app by logicchains on Thursday January 10, 2019 @09:04AM (#18873852)
It's due around the time OCaml multicore support and Half Life 3 are released.
Re:IBM releases Elm-powered app by rs86 on Thursday January 10, 2019 @10:13PM (#18880728)
Can't the module system be used for ad hoc polymorphism?
Re:IBM releases Elm-powered app by bschwindHN on Thursday January 10, 2019 @12:48AM (#18871809)
If you like that, you might be interested in ClojureScript's reagent:

https://reagent-project.github.io/

And check out re-frame as well, which adds on tools for handling data flow and many other things:

https://github.com/Day8/re-frame

Re:IBM releases Elm-powered app by vga805 on Thursday January 10, 2019 @01:48AM (#18872020)
re-frame is beautiful.

the real world implementation in re-frame up on https://github.com/gothinkster/realworld has excellent comments and is a great way to learn it after the docs

Re:IBM releases Elm-powered app by dom96 on Thursday January 10, 2019 @04:10AM (#18872540)
If you're interested in this then you might like how Nim approaches this with its React-like framework Karax.

No square or other brackets, just indentation defines the structure and it's beautiful. The only oddity is that 'div' has to be written as 'tdiv'. Here is an example from the Nim forum's frontend code: https://github.com/nim-lang/nimforum/blob/master/src/fronten...

Re:IBM releases Elm-powered app by fxfan on Thursday January 10, 2019 @01:01AM (#18871858)
This is actually cool. Scala.js + scalatags has this looking like this:

```

  val model = div(
      button( onClick := decrement )( "-" ), // decrement is typechecked as being a function of event 
      div( float := float.letf )( model.toInt ) //left float is typechecked and hence the misspelling is caught at compile time so big changes can be made with confidence
  )
```
Re:IBM releases Elm-powered app by cttet on Thursday January 10, 2019 @01:43AM (#18872007)
This was also the thing that attracted me to Elm years ago. But at that time Elm doesn't have a CSS module yet. Now with Elm-UI, it is like my dream HTML/CSS replacement.

However that was all for static UI though. Writing Elm app is still a pain if you are not a Javascript expert. Elm's implementation of the web API is minimal and the progress is extremely slow. In addition, most function that's in libraries in Javascript's ecosystem can not be directly used as you have to write Ports, which requires a lot of Javascript experience.

Re:IBM releases Elm-powered app by hellofunk on Thursday January 10, 2019 @05:04AM (#18872733)
Elm-UI is in a questionable state. Their github page originally said it was no longer maintained. Now they acknowledge that they are struggling to update to the latest version of Elm which caused many syntax breakages.
Re:IBM releases Elm-powered app by korla on Thursday January 10, 2019 @06:23AM (#18873085)
It looks like it is no longer maintained: https://github.com/gdotdesign/elm-ui/issues/100
Re:IBM releases Elm-powered app by nhanb on Thursday January 10, 2019 @06:59AM (#18873238)
cttet probably meant this: https://github.com/mdgriffith/elm-ui
Re:IBM releases Elm-powered app by cttet on Friday January 11, 2019 @12:33AM (#18881247)
As nhanb mentioned I meant https://github.com/mdgriffith/elm-ui. There is a great talk about it: https://www.youtube.com/watch?v=Ie-gqwSHQr0
Re:IBM releases Elm-powered app by bgorman on Saturday January 12, 2019 @12:46PM (#18892315)
It might be worth looking at the Reagent framework for Clojurescript.