Stylish Haskell

This commit is contained in:
Nox Sluijtman 2024-11-18 17:24:26 +01:00
parent f12134bf55
commit 7d8bf5d857
Signed by: Egg
SSH key fingerprint: SHA256:2sG9X3C7Xvq2svGumz1/k7cm8l4G9+qAtAeugqB4J9M
7 changed files with 51 additions and 56 deletions

View file

@ -11,11 +11,10 @@ module DND.Sheet.Content
, SpellComponent(..)
, Feature(..)
, FeatInfo(..)
, fiets
) where
import Data.Aeson ( FromJSON, ToJSON )
import GHC.Generics ( Generic )
import Data.Aeson (FromJSON, ToJSON)
import GHC.Generics (Generic)
instance FromJSON Character
instance ToJSON Character
@ -54,59 +53,54 @@ data ScoreMod = None
data Character = Character
{ preamble :: Preamble
, trivia :: Trivia
, stats :: [Stat]
, skills :: [Skill]
, spells :: Maybe [Spell]
, feats :: Maybe [Feature]
, trivia :: Trivia
, stats :: [Stat]
, skills :: [Skill]
, spells :: Maybe [Spell]
, feats :: Maybe [Feature]
} deriving ( Show, Eq, Ord, Generic)
data Preamble = Preamble
{ charLevel :: Int
, charName :: String
, charRace :: String
, charClass :: String
{ charLevel :: Int
, charName :: String
, charRace :: String
, charClass :: String
, jackOfAllTrades :: Bool
} deriving ( Show, Eq, Ord, Generic)
data Trivia = Trivia
{ background :: String
{ background :: String
, personalityTrait :: String
, ideals :: String
, bonds :: String
, flaws :: String
, quirk :: String
, ideals :: String
, bonds :: String
, flaws :: String
, quirk :: String
} deriving ( Show, Eq, Ord, Generic)
data Skill = Skill
{ skillName :: String
, skillMod :: ScoreMod
{ skillName :: String
, skillMod :: ScoreMod
, relatedStat :: String
} deriving ( Show, Eq, Ord, Generic)
fiets = Skill { skillName = "Stuff"
, skillMod = None
, relatedStat = "Strength"
}
data Stat = Stat
{ statName :: String
, score :: Int
{ statName :: String
, score :: Int
, proficient :: Bool
} deriving ( Show, Eq, Ord, Generic)
data Spell = Spell
{ spellName :: String
, spellLevel :: Int
, castingTime :: String
, range :: Int
, components :: [SpellComponent]
, duration :: String
, attackSave :: String
{ spellName :: String
, spellLevel :: Int
, castingTime :: String
, range :: Int
, components :: [SpellComponent]
, duration :: String
, attackSave :: String
, damageEffect :: String
, description :: String
, school :: String
, atHighLevel :: String
, description :: String
, school :: String
, atHighLevel :: String
} deriving ( Show, Eq, Ord, Generic)
data SpellComponent = Verbal
@ -114,19 +108,19 @@ data SpellComponent = Verbal
| Material
deriving ( Show, Eq, Ord, Generic)
data FeatInfo = FeatInfo { featName :: String
data FeatInfo = FeatInfo { featName :: String
, featDescription :: String
} deriving ( Show, Eq, Ord, Generic)
data Feature = StatIncrease
{ featInfo :: FeatInfo
, increase :: [Stat] }
| SetProficiency
{ featInfo :: FeatInfo
| SetProficiency
{ featInfo :: FeatInfo
, changeModState :: [ScoreMod]
}
| SetExpertise
{ featInfo :: FeatInfo
{ featInfo :: FeatInfo
, changeModState :: [ScoreMod]
}
| AddSpell

View file

@ -8,13 +8,13 @@ module DND.Sheet.Parser
, listSkillNames
) where
import Data.Aeson
import DND.Sheet.Content
import DND.Bob(bob)
import Control.Monad
import qualified Data.ByteString.Lazy as B
import Control.Monad
import Data.Aeson
import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString.Lazy.UTF8 as BSU
import Data.Maybe (fromJust)
import Data.Maybe (fromJust)
import DND.Bob (bob)
import DND.Sheet.Content
--getSheet :: FilePath -> IO B.ByteString
--getSheet = B.readFile