Skip to content

Instantly share code, notes, and snippets.

@j-hannes
Last active October 4, 2016 13:13
Show Gist options
  • Save j-hannes/12d6ef45c30d7e13147a2e07f79f55ba to your computer and use it in GitHub Desktop.
Save j-hannes/12d6ef45c30d7e13147a2e07f79f55ba to your computer and use it in GitHub Desktop.
Hello world example from elm-lang.org
module Main exposing (..)
import Html exposing (Html, span, text)
import Html.Attributes exposing (class)
main : Html a
main =
span [ class "welcome-message" ] [ text "Hello, World!" ]
@naddeoa
Copy link

naddeoa commented Oct 3, 2016

Just came across this while picking up Elm. Do you think you could explain what a is? I'm finding very limited documentation on main in terms of Program options, and Html's docs don't seem to document the Html function it exposes.

EDIT: Just came across the answer in the official docs

So the type List a is saying "I know I have a list, but it could be filled with anything". The lower-case a is called a type variable, meaning that there are no constraints in our program that pin this down to some specific type. In other words, the type can vary based on how it is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment