Notes - mcandre/haskellSDL2Examples GitHub Wiki
Notes on Haskell SDL 2 Examples
I'm glad to see a lot of good habits in the code:
- Organized with the Cabal build system, with src/ and assets/ directories.
- Self-contained example code snippets
- Qualified imports
- Explicit type signatures
- Code sectioned into configuration, application portions
- Error handling in case of SDL errors
- Clear separation of responsibility into different functions (main, updateState, etc.)
Overall, solid Haskell style. Any complaints I might have with the code are quite minor.
- Some trailing whitespace in drawState
- LICENSE could be written as a .md Markdown file like README.md
- We can provide more context for Haskell newbies by documenting how to install adjacent, but not all, dependencies.
- libpng16-16.dll could be moved out of version control if we include a link to it in the readme dependencies
- Calculating the current frame is complicated enough that it could be spun off into a separate function
- The monad transformer function
~>>
is unused, maybe remove it? - The monad transormers
~>>
,~>~
, andinto
could be commented with English-pronounceable names, especially for Haskellers who haven't mastered monads. - Cabal reports a missing dependency, mtl, when trying to build the lessons.
- Cabal 1.16 silently fails to build the lesson executables, and doesn't feature a
run
task.
https://github.com/mcandre/haskellSDL2Examples/branches/active
polarina/sdl2 and ods94065/sdl2-image are nice alternatives to official Hackage sdl2, sdl2-image. I might reach out to the authors and suggest a minor name change so that these can be published on Hackage alongside the other sdl2, sdl2-image.
What would lesson 16 look like? What if we combined the walking animation in lesson 14 with keyboard interaction in 4 to create a working avatar?
https://github.com/mcandre/haskellSDL2Examples/compare/lesson16