You can get good code without Elm's type system, but what you won't get is a compiler as an assistant.
Made a small typo? The compiler tells you. Mixed up the first and second arguments to a function? Usually a type error, so the compiler tells you. Most importantly, refactoring becomes easy. You changed the interface or return type of a function? The compiler will literally tell you every place in your code that needs to be changed because of this. You can have confidence that refactoring won't break everything, because if it compiles, there's *no possible way* to get a type error at runtime. (Except for an ever shrinking list of obscure corner cases). On Thu, Oct 6, 2016 at 2:41 AM, Zachary Kessin <[email protected]> wrote: > I think this is true of compilers in general. There are a number of scheme > compilers that output C code out there, I expect if you took the output of > one of them and looked at it vs hand written C they would look very > different. > > Zach > ᐧ > > On Thu, Oct 6, 2016 at 12:22 PM, Will White <[email protected]> > wrote: > >> Have you seen the JS that Elm compiles to? I've attached what Elm TodoMVC >> <http://evancz.github.io/elm-todomvc/> compiles to. Here's the one of >> the first functions: >> >> function F2(fun) >> { >> function wrapper(a) { return function(b) { return fun(a,b); }; } >> wrapper.arity = 2; >> wrapper.func = fun; >> return wrapper; >> } >> >> >> It's JS, but it's not the kind of application code I'd write in JS. My >> point is that Elm application code is really on another level. >> >> >> On Wednesday, October 5, 2016 at 6:50:52 PM UTC+1, Sarkis Arutiunian >> wrote: >>> >>> Recently I read article about Functional programming, all 5 parts >>> <https://medium.com/@cscalfani/so-you-want-to-be-a-functional-programmer-part-1-1f15e387e536#.5il2s42gl>. >>> Yes it's pretty interesting article, written in interesting way. And I >>> really like pattern of 'functional programming', immutability and etc. >>> >>> >>> But there is a question. Where the line between propriety and paranoia? >>> >>> >>> I prefer use native javaScript for everything where I can do it without >>> any libraries. Yes exactly you should use some UI libraries like React and >>> some module bundler like webpack. But I think propriety of using this tools >>> is obvious. It's better to use JSX then use native js to create DOM or it's >>> better to use webpack at least to uglify and optimize your code because >>> some things just impossible to achieve without webpack. >>> >>> And we have absolutely opposite situation with Elm. Yes they have some >>> features to make function a little bit shorter than you'll do it in vanilla >>> javaScript and only in some case. It's not that difference like create >>> nodes with JSX or js. >>> >>> >>> And all this stuff about immutability, can be easily achieved in plain >>> javaScript. Eventually is Elm code will be converted to plain javaScript >>> and not vice versa, so that's mean you can do all that stuff in javaScript >>> but for sure there are some features in javaScript which you can't do in >>> Elm. And using Elm you are limited with one pattern. And what if it's not >>> enough or it's not best solution in some case, what than? For example right >>> now I'm working on new CMS for one of my projects, on React/GraphQL/Nodejs >>> and hybrid storage MongoDb with mySQL. I would like to use this pattern in >>> some cases but I just can't use it everywhere, so that's mean I shouldn't >>> use Elm? >>> >>> >>> Don't think that I'm against to Elm. I just want to see opinion of >>> others. And I want to see that line, between propriety and paranoia. >>> >>> >>> 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 [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Zach Kessin > SquareTarget <http://squaretarget.rocks?utm_source=email-sig> > Twitter: @zkessin <https://twitter.com/zkessin> > Skype: zachkessin > > -- > 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. > -- 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.
