haskell / containers

Assorted concrete container types
https://hackage.haskell.org/package/containers
318 stars 178 forks source link

More efficient folds for Seq #1036

Open meooow25 opened 2 months ago

meooow25 commented 2 months ago

We can define folds for Seq more efficiently. See thread starting https://github.com/haskell/containers/issues/1016#issuecomment-2336465956 and in particular the code by treeowl in https://github.com/haskell/containers/issues/1016#issuecomment-2337033674

The catch is that we need GADTs, which is not portable.

meooow25 commented 1 month ago

Might be worth noting that we already use a couple of extensions in a non-portable way

  1. CPP - Primarily to guard GHC features, including other extensions, or provide faster implementations on GHC
  2. BangPatterns - Compared to the portable alternative (seq), this is just so much nicer to use and read.