Created
May 14, 2019 18:31
-
-
Save dhinojosa/b878981f676b6b5d25585edeeff68d9d to your computer and use it in GitHub Desktop.
Capitalize the first letter, all API calls model the possibility of things going wrong, but not with exceptions but with explicit types
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
-- From https://github.com/dhinojosa/elm-study/blob/master/src/PigLatin.elm | |
capFirst : String -> String | |
capFirst s = | |
case uncons s of | |
Just ( h, t ) -> | |
cons (Char.toUpper h) t | |
Nothing -> | |
"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment