pulsar/src/Magic.hs

66 lines
1.9 KiB
Haskell

{-# LANGUAGE NoImplicitPrelude #-}
module Magic where
import Numeric.Units.Dimensional.Prelude
import Data.String (String)
import Data.Kind (Type)
{--| The intent of the magic system is to allow for the creation of complex effects in the style of a programming language,
-- couched in the language of fantasy writing. A lot of the semantics will match Haskell for both learning and pragmatic reasons.
--
-- In this system, spells are built from individual effect blocks. Effect chains have an execution time. Once triggered, they
-- take mindspace while compiling, and are ready to be released once finished. Retaining a spell once its ready requires feats
-- and yet more mindspace.
-- On the bright side, once compilation is triggered, no further active action is required from the caster.
|--}
-- class Noun where
-- overlays :: [String] -- TODO: Replace this with proper Aspects once they're done
-- class Verb v where
-- data ActionTypes :: Type -> Type
-- effects :: ActionTypes n
-- instance Verb Create where
-- data ActionTypes = n -> n
-- -- TODO: How to structrue Verbs and Nouns so that they actually form restrictions
-- -- It may not be practical to do this at the type-level.
data Noun where
Noun :: {
canonicalName :: String,
description :: String
} -> Noun
data Verb n where
RawVerb :: {
canonicalName :: String,
description :: String
} -> Verb
AppliedVerb :: (n ~ Noun) => {
appliedName :: String,
description :: String
} -> Verb n
data Target t where
Target :: {
canonicalName :: String,
description :: String
} -> Target t
data Guideline v n t where
Guideline :: (v ~ Verb, n ~ Noun, t ~ Target) => {
level :: Int,
action :: t -> t,
description :: String
} -> Guideline v n t
data EffectBlock t where
SimpleEffect :: {
effect :: MagicGuideline Noun Verb
} -> EffectBlock t