Coder Social home page Coder Social logo

elm-hello's Introduction

"Hello World!" in Elm

A fresh take on the otherwise stale "Hello World!" application. Try it out!

preview of elm-hello

Features

✔️ Show "Hello World!" in a random langauge every click.

✔️ Animate the transition between different langauges.

✔️ Change the language automatically every 3 seconds.

✔️ Show a visual indicator of the automatic transition.

✔️ Build and upload to Github pages.

❌ Change the background to a random gradient every transition.

Thoughts

I created this project to learn the basics of Elm, and also to test one of Elm's claimed strengths. Since Elm eliminates runtime errors, it makes implementing new features and maintaining a project much easier. My thoughts on these strengths are still undecided - most likely due to this being my first experience in a purely functional programming langauge.

I am inexperience with Elm, but I found that generating random numbers could be quite tedious. Something that would usually be as simple as Math.random(), now requires a separate Msg in the update function, which requires two visits through the update function. I now require a Roll and a Show message in order to generate a random number to choose a random language.

Animations also proved to be quite difficult within Elm. In order to create a simple in-out effect it would require more Msg's and additional state. I was reluctant to add more Msg's and state (and possibly timers), because it seemed wrong and would significantly increase the complexity of the update function. I ended up using Keyed nodes, which is a bit of a hack, and only achieves the in effect. Despite this it does work - without the complexity cost of the alternative approach.

Elm is still in early development, and many of these issues are most likely due to my lack of understanding. If anyone would like to clear up, or ammend any of the points I have raised feel free to raise an issue or create a pull request.

Setup

Just in case your new to Elm and would like to play around with this project. It should be as simple as installing elm, running elm-reactor in the root directory of this project and then navigating to localhost:8000/src/index.html.

Building and uploading to Github pages is still a work in progress. The Github pages source has currently been set to the docs folder (sucks that you cannot choose the name of the folder), but will most likely moved into a separate gh-pages branch at some point. I use elm-make to generate docs/build.js, and then all other assets are currently manually synced between the src and docs directory. I might write a script at some point in the future to streamline this process.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.