serokell / universum

:milky_way: Prelude written in @Serokell
MIT License
176 stars 26 forks source link

Consider attaching CallStack to functions from Unsafe #222

Open Martoon-00 opened 4 years ago

Martoon-00 commented 4 years ago

For instance, have

-- | Extract the first element of a list, which must be non-empty.
head :: HasCallStack => [a] -> a
head = \case
  [] -> error "..."
  x : _ -> x

Motivation: Universum is primarily designed to be used in business logic, if someone needs advanced and lightweight manipulation with lists, he better import Data.List or some library with special data structures as Universum provides far not all possible useful functions anyway.

Pros:

Cons: