relvox / iridescence-elm / Utils.Common

A module providing utility functions for common operations.

This module contains functions that help with common operations such as finding distinct elements in a list, zipping two lists, etc.

distinct : List comparable -> List comparable

Removes duplicate elements from a list. The elements in the list must be comparable.

distinctKey : (a -> comparable) -> List a -> List a

Removes duplicate elements from a list based on a key extracted by the provided function. The function extractKey is used to extract a key from each element, and only one element for each distinct key is retained in the output list.

zip : List a -> List b -> List ( a, b )

Zips two lists into a single list of pairs. If the lists have different lengths, the extra elements in the longer list are ignored.