Let’s start with Hello World

Now that we know how all things work together, let’s try our Hello World program in couple of ways.

The first and very simple way to impress people

import Html exposing (text)
main =
   text “Hello World!”

When you write front end application using Elm, you write everything in Elm including HTML. Will talk about it later. For now when you are in Elm you will everything in Elm except CSS.  Let’s look at the code above

import Html exposing (text)

We are importing the Html function sets and we are only exposing text function for this code to work.

main =
   text “Hello World!”

All Elm program starts with “main”, this is the entry for browser to know where to start. The main program executes text function which takes just one string parameter and create the DOM element for browser to render. This is the simple and easy to way to do it. But if you were following along you will notice, there is no model, view or update of any kind. Well that is because it is simple hello world program.

Starting out with Elm

Over the next three weeks I am planning to start writing about my journey into creating a crypto currency exchange rates web app using Elm. Two objectives with that,

  1. Learn to program using Elm
  2. Create an exchange application where I can subscribe for notification which I would like to use.

I have been using Elm at very small level for experimental purposes. There are lot of frameworks out there to build highly performing web application. Angular Js, React to name a few front runners. I have developed application using Angular 1.x, haven’t really took the plunge into 2.0 yet. So I will not be comparing any other frameworks. I will be focusing on Elm and for the benefits I will quoting other documents in the web.

There are two reasons why I chose to do my web development using Elm

  1. I am a big fan of functional programming. Elm is pure functional front end framework
  2. Run time errors, Based on my reading, code generated using Elm will not create ugly runtime errors
Technorati Tags: