google / google/codeworld

Encapsulated applications

Abierto
#492 17 comentarios 0 reacciones 0 asignados Ver en GitHub
discussion
Lenguaje dominante
Haskell
Estrellas
1.3k
Forks
201
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.