Skip to content

Instantly share code, notes, and snippets.

@johnwesonga
Last active July 24, 2019 06:02
Show Gist options
  • Save johnwesonga/b84687ba0757ab666475b88ad56790bf to your computer and use it in GitHub Desktop.
Save johnwesonga/b84687ba0757ab666475b88ad56790bf to your computer and use it in GitHub Desktop.
elm type alias
type SortDirection = Asc | Desc
type alias SortedLabels = {labels: List String , direction: SortDirection }
type alias Article = { name: String, keywords: SortedLabels }
addArticles: String -> List Article -> List Article
addArticles name article =
Article name (SortedLabels [] Asc) :: article
--Call the function
addArticles "food" [Article "start" (SortedLabels ["foo", "bar"] Asc), Article "start" (SortedLabels ["foo", "bar"] Asc)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment