Skip to content

Draft: Wip/monomorphise data list

chessai requested to merge wip/monomorphise-data-list into master

Monomorphise Data.List to lists.

Deprecate GHC.OldList and Data.OldList

Benefits:

  • A seemingly natural expectation of Data.List is that its contents will be monomorphic to lists. This will make it match that expectation.
  • If a polymorphic variant is needed, it is better to use Data.Foldable. This is in line with the above expectation.
  • This makes Haskell easier to learn. Haskell learners typically start with lists, having to understand typeclasses/Foldable before then doesn't make any sense, is unnecessary noise to the learner, and is confusing during reading of the documentation and in error messages. I have heard several arguments from teachers of Haskell that students find the Foldable-generic interface of Data.List to be more confusing than Data.OldList, for example.
  • Generalised methods rely on inlining for dictionary elimination. Monomorphic ones do not.

cc @core-libraries cc @ekmett

This is a proposal. Please offer your thoughts.

@bgamari assuming this passes CI, we'll probably need a head.hackage job.

Edited by chessai

Merge request reports