← all modules

Sky.Core.List

Sky.Core.List
  Sky.Core.List — list combinators.

Values
  any : (a -> Bool) -> List a -> Bool
      `any pred list` — True iff `pred` holds for at least one element.
  append : List a -> List a -> List a
      `append xs ys` — concatenate two lists.
  concat : List (List a) -> List a
      `concat lists` — flatten a list of lists.
  concatMap : (a -> List b) -> List a -> List b
      `concatMap fn list` — map each element to a list and flatten
  cons : a -> List a -> List a
      `cons x list` — prepend `x` (the `::` operator as a named function).
  drop : Int -> List a -> List a
      `drop n list` — `list` without its first `n` elements. `drop 0` and
  filter : (a -> Bool) -> List a -> List a
      `filter pred list` — keep only elements satisfying `pred`.
  filterMap : (a -> Maybe b) -> List a -> List b
      `filterMap fn list` — map each element and keep only the `Just` results
  foldl : (a -> b -> b) -> b -> List a -> b
      `foldl fn acc list` — left fold: `fn aN (… (fn a1 (fn a0 acc)))`.
  foldr : (a -> b -> b) -> b -> List a -> b
      `foldr fn acc list` — right fold: `fn a0 (fn a1 (… (fn aN acc)))`.
  indexedMap : (Int -> a -> b) -> List a -> List b
      `indexedMap fn list` — apply `fn` to each zero-based `(index, element)`
  isEmpty : List a -> Bool
      `isEmpty list` — True iff the list has no elements.
  length : List a -> Int
      `length list` — number of elements (O(1) on the slice representation).
  map : (a -> b) -> List a -> List b
      `map fn list` — apply `fn` to each element.
  range : Int -> Int -> List Int
      `range lo hi` — `[lo, lo + 1, …, hi]` (inclusive). `lo > hi` gives `[]`.
  reverse : List a -> List a
      `reverse list` — the list in reverse order.
  sort : List comparable -> List comparable
      `sort list` — ascending, stable sort. The elements must be comparable:
  sortBy : (a -> comparable) -> List a -> List a
      `sortBy keyFn list` — stable sort by the key `keyFn elem`, which must be
  sortWith : (a -> a -> Int) -> List a -> List a
      `sortWith cmp list` — stable sort by a custom comparator. `cmp a b`
  take : Int -> List a -> List a
      `take n list` — first `n` elements (or fewer when `list` is shorter).
  zip : List a -> List b -> List ( a, b )
      `zip xs ys` — pair-wise zip, truncated to the shorter list's length.
  all
  find
  head
  tail
  member