Skip to content

Add aliases to make program types more beginner friendly #22

@JoelQ

Description

@JoelQ

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions