google / google/codeworld

Encapsulated applications

未关闭
#492 17 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
discussion
主要语言
Haskell
星标
1.3k
派生
201
PR 合并指标
30 天内没有已合并 PR

描述

Definitely a speculative proposal, but it might lead somewhere.

The proposal is to create an abstract type to encapsulate and build up simulations, interactions, etc. Something like:

data Application state -- abstract

defaultApplication :: state -> Application state

withTimeStep :: (Double -> state -> state) -> Application state -> Application state
withEventHandler :: (Event -> state -> state) -> Application state -> Application state
withPicture :: (state -> Picture) -> Application state -> Application state

applicationOf :: Application state -> IO ()

The various event handlers, time steps, and visualization functions would all be run, in some defined order. Pictures would be stacked with the outermost picture on top.

Advantages:

1. No need to add a time step if it's not needed.
2. Ability to abstract different effects that span events, time, and pictures (such as UI controls).
3. Ability to incorporate more components (for example, sound?) without making the top-level entry point more complex.

The API is probably not right yet, but that's the idea.

贡献指南

打开贡献指南

调研方向

首先检查现有的顶层应用流程,以及事件处理器、时间步和图片目前是如何组合的。判断提议的抽象和 API 是否合适,定义排序和堆叠语义,并在实现之前与维护者确认设计。

由索引模型根据 Issue 内容生成。

评估

技术栈
haskell
领域
api, tooling
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。