Plutarch codegen: Recursive data type support
还没有人认领这个 Issue。
评估
调研方向
首先阅读 Plutarch pfix 定义,并跟踪递归类型和相互递归类型现有的代码生成入口点。将 issue 中的 List、F 和 G 示例与生成的项进行比较。完成的标准是:为递归数据类型定义并演示一种统一的生成方法,其中包括相关的多态构造器处理。
由索引模型根据 Issue 内容生成。
描述
One does not simply recurse in Plutarch.
My raw lambda calculus skills are not at the level where I'm just popping out fixpoint based terms so let's get back to the drawing board:
For a canonical recursive data type example and some mutually recursive ones:
sum List a = Cons a (List a) | Nil
sum F a = Rec (G a) | Nil
sum G a = Rec (F a) | Nil
What we do eventually is invoke some polymorphic class method on the constituents of each constructor (if it's a sum type, but also for products and records). This is where the problem happens right? How would we use pfix in this situation?
(let's imagine we have an annotation that tells us whether a type is infinite or not).
pfix :: Term s (((a :--> b) :--> (a :--> b)) :--> (a :--> b))
fib :: Term s (PInteger :--> PInteger)
fib = phoistAcyclic $
pfix #$ plam $ \self n ->
pif
(n #== 0)
0
$ pif
(n #== 1)
1
$ self # (n - 1) + self # (n - 2)
Main question is: How do we generate code in a uniform manner such that we can recurse properly?
- 主要语言
- Haskell
- 星标
- 33
- 派生
- 1
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
mlabs-haskell/lambda-buffers 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 25/100
mlabs-haskell/lambda-buffers#296 ·
-
难度 5/5 一周以上 新手友好度 20/100
mlabs-haskell/lambda-buffers#295 ·
-
难度 4/5 3-5 天 新手友好度 20/100
mlabs-haskell/lambda-buffers#294 ·
-
Dykstra HF未关闭
难度 4/5 3-5 天 新手友好度 35/100
mlabs-haskell/lambda-buffers#293 ·
-
Nix-free path未关闭devops
难度 5/5 一周以上 新手友好度 25/100
mlabs-haskell/lambda-buffers#292 ·
查看 mlabs-haskell/lambda-buffers 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 3 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
simplex-chat/simplex-chat#7714 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
component: hls-eval-plugin type: bug
难度 2/5 1-3 小时 新手友好度 65/100
haskell/haskell-language-server#5144 · 2 条评论 ·
维护者通常 1 天内回复