haskell-nix/hnix

Please, make the statement "Monoid is not []" true

开放

#880 创建于 2021年3月11日

 (5 条评论) (0 个反应) (0 位负责人)Nix (116 个派生)github user discovery
API breaking refactoringgood first issue

仓库指标

星标
 (835 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

One of the core stones HNix stumbles on is pretty pervasive String (as exceptions that gather provenance info, and in REPL) and, especially, List being used across the whole project.

The List is famously a one-directionally linked chain structure.

That means that per every cell used there is a cell that holds a pointer. And there is no way to append to list without traverse of the whole list.

Appending x meaning traverse every time, which is doing x^2 actions, so indeed - exponential append.

The most frequent thing the structure builder does is appending.

So, lets look at what actions happen with the Monoid, and most probably replace the List with an efficient Monoid, for example: https://hackage.haskell.org/package/acc

贡献者指南