Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save deepak/45455666762ed02efc2e354460f87a61 to your computer and use it in GitHub Desktop.
Save deepak/45455666762ed02efc2e354460f87a61 to your computer and use it in GitHub Desktop.
elm beautiful type annotation
module Scratch exposing (..)
import String
-- arguments first then return
-- so the arguments are wrapped in braces for disambiguation
-- http://guide.elm-lang.org/types/reading_types.html
twoIdentity : a -> a -> List a
twoIdentity a b =
[ a, b ]
call : (a -> b) -> a -> b
call a b =
(a b)
uppercase : String -> String
uppercase a =
String.toUpper a
-- to try in `elm-repl`
-- import Scratch
-- Debug.log "call:" (Scratch.call Scratch.uppercase "foobar")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment