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

Use more domain-specific type than Maybe #5

Open
coreyhaines opened this issue Aug 9, 2017 · 0 comments
Open

Use more domain-specific type than Maybe #5

coreyhaines opened this issue Aug 9, 2017 · 0 comments

Comments

@coreyhaines
Copy link

https://github.com/seagreen/fpg-depths/blob/master/src/Building.elm#L10

Using Maybe can sometimes hide the domain meaning. Perhaps what you really have is something along the lines of

type BuildingCombatType
    = NotCombat
    | Combat { firepower : Int, sensors : Int }

(those names are bad, but perhaps better than using Maybe)

Or even move this up a ways, so you have a type alias for building stats, one for combat stats, then each building is something like

type Building
    = NonCombat BuildingData
    | Combat BuildingData CombatStats

Just a thought.

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