Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add aliases to make program types more beginner friendly #22

Open
JoelQ opened this issue Apr 7, 2021 · 0 comments
Open

Add aliases to make program types more beginner friendly #22

JoelQ opened this issue Apr 7, 2021 · 0 comments

Comments

@JoelQ
Copy link

JoelQ commented Apr 7, 2021

The return types of picture, animation, and game are pretty intense for newcomers, particularly those not super comfortable with advanced type signatures. Additionally, they are hard-coded with internal types which causes confusion. I think hiding that behind a type alias would make the experience much more approachable. Something like:

type alias PictureProgram = 
  Platform.Program () Screen ( Basics.Int, Basics.Int )

type alias AnimationProgram =
  Platform.Program () Animation Msg

type alias GameProgram memory =
  Platform.Program () (Game memory) Msg

This would allow folks to write programs like:

main : PictureProgram
main =
  picture [ circle blue 40 ]

or

main : AnimationProgram
main =
  animation view

or

main : GameProgram Memory
main =
  game view update initialMemory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant