Skip to content

Instantly share code, notes, and snippets.

@pakoito
Created May 21, 2017 13:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pakoito/00db608857b0a96ea8829387f1a5c785 to your computer and use it in GitHub Desktop.
Save pakoito/00db608857b0a96ea8829387f1a5c785 to your computer and use it in GitHub Desktop.
Kind ECS
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
data family Component a :: *
data instance Component Health = HealthC
data instance Component Stamina = StaminaC
newtype Health =
Health Int
deriving (Show)
newtype Stamina =
Stamina Int
deriving (Show)
components :: Component a -> [a]
components a = []
addComponent :: Component a -> a -> [a]
addComponent t a = [a]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment