Created
September 13, 2016 06:32
-
-
Save deepak/45455666762ed02efc2e354460f87a61 to your computer and use it in GitHub Desktop.
elm beautiful type annotation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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