Stylish Haskell
This commit is contained in:
parent
f12134bf55
commit
7d8bf5d857
|
@ -35,6 +35,7 @@
|
||||||
haskellPackages.haskell-language-server # you must build it with your ghc to work
|
haskellPackages.haskell-language-server # you must build it with your ghc to work
|
||||||
ghcid
|
ghcid
|
||||||
cabal-install
|
cabal-install
|
||||||
|
stylish-haskell
|
||||||
];
|
];
|
||||||
inputsFrom = map (__getAttr "env") (__attrValues self.packages.${system});
|
inputsFrom = map (__getAttr "env") (__attrValues self.packages.${system});
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,7 +5,7 @@ module DND
|
||||||
, module DND.Dice
|
, module DND.Dice
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import DND.Sheet.Content
|
import DND.Bob
|
||||||
import DND.Sheet.Parser
|
import DND.Dice
|
||||||
import DND.Dice
|
import DND.Sheet.Content
|
||||||
import DND.Bob
|
import DND.Sheet.Parser
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
module DND.Bob (bob) where
|
module DND.Bob (bob) where
|
||||||
|
|
||||||
import DND.Sheet.Content
|
import DND.Sheet.Content
|
||||||
|
|
||||||
bob :: Character
|
bob :: Character
|
||||||
bob = Character {skills=testSkills, trivia=testTrivia, stats=testStats, spells=Just testSpells, preamble=testPreamble, feats=Just testFeatures}
|
bob = Character {skills = testSkills, trivia = testTrivia, stats = testStats, spells = Just testSpells, preamble = testPreamble, feats = Just testFeatures}
|
||||||
|
|
||||||
testStats :: [Stat]
|
testStats :: [Stat]
|
||||||
testStats = [strStat,dexStat,conStat,intStat,wisStat,chaStat]
|
testStats = [strStat, dexStat, conStat, intStat, wisStat, chaStat]
|
||||||
|
|
||||||
testPreamble :: Preamble
|
testPreamble :: Preamble
|
||||||
testPreamble = Preamble 1 "Bob" "Elf" "Fighter" False
|
testPreamble = Preamble 1 "Bob" "Elf" "Fighter" False
|
||||||
|
|
|
@ -4,7 +4,7 @@ module DND.Dice
|
||||||
, advantage
|
, advantage
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import System.Random
|
import System.Random
|
||||||
|
|
||||||
rolls :: RandomGen a => Int -> Int -> a -> [Int]
|
rolls :: RandomGen a => Int -> Int -> a -> [Int]
|
||||||
rolls x y = take x . randomRs (1, y)
|
rolls x y = take x . randomRs (1, y)
|
||||||
|
|
|
@ -3,5 +3,5 @@ module DND.Sheet
|
||||||
, module DND.Sheet.Parser
|
, module DND.Sheet.Parser
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import DND.Sheet.Content
|
import DND.Sheet.Content
|
||||||
import DND.Sheet.Parser
|
import DND.Sheet.Parser
|
||||||
|
|
|
@ -11,11 +11,10 @@ module DND.Sheet.Content
|
||||||
, SpellComponent(..)
|
, SpellComponent(..)
|
||||||
, Feature(..)
|
, Feature(..)
|
||||||
, FeatInfo(..)
|
, FeatInfo(..)
|
||||||
, fiets
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Data.Aeson ( FromJSON, ToJSON )
|
import Data.Aeson (FromJSON, ToJSON)
|
||||||
import GHC.Generics ( Generic )
|
import GHC.Generics (Generic)
|
||||||
|
|
||||||
instance FromJSON Character
|
instance FromJSON Character
|
||||||
instance ToJSON Character
|
instance ToJSON Character
|
||||||
|
@ -54,59 +53,54 @@ data ScoreMod = None
|
||||||
|
|
||||||
data Character = Character
|
data Character = Character
|
||||||
{ preamble :: Preamble
|
{ preamble :: Preamble
|
||||||
, trivia :: Trivia
|
, trivia :: Trivia
|
||||||
, stats :: [Stat]
|
, stats :: [Stat]
|
||||||
, skills :: [Skill]
|
, skills :: [Skill]
|
||||||
, spells :: Maybe [Spell]
|
, spells :: Maybe [Spell]
|
||||||
, feats :: Maybe [Feature]
|
, feats :: Maybe [Feature]
|
||||||
} deriving ( Show, Eq, Ord, Generic)
|
} deriving ( Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
data Preamble = Preamble
|
data Preamble = Preamble
|
||||||
{ charLevel :: Int
|
{ charLevel :: Int
|
||||||
, charName :: String
|
, charName :: String
|
||||||
, charRace :: String
|
, charRace :: String
|
||||||
, charClass :: String
|
, charClass :: String
|
||||||
, jackOfAllTrades :: Bool
|
, jackOfAllTrades :: Bool
|
||||||
} deriving ( Show, Eq, Ord, Generic)
|
} deriving ( Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
data Trivia = Trivia
|
data Trivia = Trivia
|
||||||
{ background :: String
|
{ background :: String
|
||||||
, personalityTrait :: String
|
, personalityTrait :: String
|
||||||
, ideals :: String
|
, ideals :: String
|
||||||
, bonds :: String
|
, bonds :: String
|
||||||
, flaws :: String
|
, flaws :: String
|
||||||
, quirk :: String
|
, quirk :: String
|
||||||
} deriving ( Show, Eq, Ord, Generic)
|
} deriving ( Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
data Skill = Skill
|
data Skill = Skill
|
||||||
{ skillName :: String
|
{ skillName :: String
|
||||||
, skillMod :: ScoreMod
|
, skillMod :: ScoreMod
|
||||||
, relatedStat :: String
|
, relatedStat :: String
|
||||||
} deriving ( Show, Eq, Ord, Generic)
|
} deriving ( Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
fiets = Skill { skillName = "Stuff"
|
|
||||||
, skillMod = None
|
|
||||||
, relatedStat = "Strength"
|
|
||||||
}
|
|
||||||
|
|
||||||
data Stat = Stat
|
data Stat = Stat
|
||||||
{ statName :: String
|
{ statName :: String
|
||||||
, score :: Int
|
, score :: Int
|
||||||
, proficient :: Bool
|
, proficient :: Bool
|
||||||
} deriving ( Show, Eq, Ord, Generic)
|
} deriving ( Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
data Spell = Spell
|
data Spell = Spell
|
||||||
{ spellName :: String
|
{ spellName :: String
|
||||||
, spellLevel :: Int
|
, spellLevel :: Int
|
||||||
, castingTime :: String
|
, castingTime :: String
|
||||||
, range :: Int
|
, range :: Int
|
||||||
, components :: [SpellComponent]
|
, components :: [SpellComponent]
|
||||||
, duration :: String
|
, duration :: String
|
||||||
, attackSave :: String
|
, attackSave :: String
|
||||||
, damageEffect :: String
|
, damageEffect :: String
|
||||||
, description :: String
|
, description :: String
|
||||||
, school :: String
|
, school :: String
|
||||||
, atHighLevel :: String
|
, atHighLevel :: String
|
||||||
} deriving ( Show, Eq, Ord, Generic)
|
} deriving ( Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
data SpellComponent = Verbal
|
data SpellComponent = Verbal
|
||||||
|
@ -114,19 +108,19 @@ data SpellComponent = Verbal
|
||||||
| Material
|
| Material
|
||||||
deriving ( Show, Eq, Ord, Generic)
|
deriving ( Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
data FeatInfo = FeatInfo { featName :: String
|
data FeatInfo = FeatInfo { featName :: String
|
||||||
, featDescription :: String
|
, featDescription :: String
|
||||||
} deriving ( Show, Eq, Ord, Generic)
|
} deriving ( Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
data Feature = StatIncrease
|
data Feature = StatIncrease
|
||||||
{ featInfo :: FeatInfo
|
{ featInfo :: FeatInfo
|
||||||
, increase :: [Stat] }
|
, increase :: [Stat] }
|
||||||
| SetProficiency
|
| SetProficiency
|
||||||
{ featInfo :: FeatInfo
|
{ featInfo :: FeatInfo
|
||||||
, changeModState :: [ScoreMod]
|
, changeModState :: [ScoreMod]
|
||||||
}
|
}
|
||||||
| SetExpertise
|
| SetExpertise
|
||||||
{ featInfo :: FeatInfo
|
{ featInfo :: FeatInfo
|
||||||
, changeModState :: [ScoreMod]
|
, changeModState :: [ScoreMod]
|
||||||
}
|
}
|
||||||
| AddSpell
|
| AddSpell
|
||||||
|
|
|
@ -8,13 +8,13 @@ module DND.Sheet.Parser
|
||||||
, listSkillNames
|
, listSkillNames
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Data.Aeson
|
import Control.Monad
|
||||||
import DND.Sheet.Content
|
import Data.Aeson
|
||||||
import DND.Bob(bob)
|
import qualified Data.ByteString.Lazy as B
|
||||||
import Control.Monad
|
|
||||||
import qualified Data.ByteString.Lazy as B
|
|
||||||
import qualified Data.ByteString.Lazy.UTF8 as BSU
|
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 :: FilePath -> IO B.ByteString
|
||||||
--getSheet = B.readFile
|
--getSheet = B.readFile
|
||||||
|
|
Loading…
Reference in a new issue