sherpal/BattleForFlatland

More semantic in Asset type

Opened this issue · 0 comments

Currently the Asset type (in package assets in the frontend subproject) is simply a wrapper around a String url. It could be good to add more semantic in the type system. This semantic should reflect what the asset is used for.

For example, an asset could be some asset for an ability. We could then define

trait Asset[-For] {
 ...
}

and create an asset for an ability like Asset[Ability]. (I guess this should be contravariant)

This way, we can, at certain places, ask assets for specific things and have more type checking. Also serves as documentation.