why pipes defines inner functions

試著忘記壹切 提交于 2019-12-05 12:47:45

GHC will only inline non-recursive functions, and only when they are "fully applied" from a syntactic point of view (i.e. at the call site they are applied to the number of arguments that appear in the left hand side in the definition).

In the examples you posted there are no arguments, however the definitions are likely recursive and wouldn't be inlined. Doing this transformation probably allows the definitions to be inlined and specialized (for the concrete types of m etc.) at the call site.

Is this some trick to enable some optimizations? I find it ugly, if it's some optimization trick I really wish the compiler could do it without things like that.

Yeah it's super lame.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!