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

Code reuse with a row #1

Open
ursi opened this issue Oct 30, 2020 · 0 comments
Open

Code reuse with a row #1

ursi opened this issue Oct 30, 2020 · 0 comments

Comments

@ursi
Copy link

ursi commented Oct 30, 2020

https://github.com/gorillatron/Dungeon-Of-Xuul-Text-Adventure/blob/31126956cda0d2a636aa235d0ed3a08965d574c1/src/Game/Data/Item/Equipment.purs#L29-L50

You can simplify this as

type BaseProps =
  ( name :: String
  , description :: String
  , stats :: Stats
  , levelRequirement :: Level 
  )
 
type EquipmentProps = { | BaseProps }
-- or
-- type EquipmentProps = Record BaseProps

type WeaponProps = { damage :: Int | BaseProps } 
  
type ShieldProps = { block :: Int | BaseProps } 
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