diff --git a/Config/config.json b/Config/config.json index a041ee1..7a2218a 100644 --- a/Config/config.json +++ b/Config/config.json @@ -1,5 +1,5 @@ { - "dataseedpath" : "./data/small.json", + "dataseedpath" : "data/small.json", "dbPath" : "data/db.db", "bulkDataLink" : "https://data.scryfall.io/default-cards/default-cards-20230430090702.json" } diff --git a/mtgsearch.cabal b/mtgsearch.cabal index 4f02975..7b7ea58 100644 --- a/mtgsearch.cabal +++ b/mtgsearch.cabal @@ -48,6 +48,7 @@ library , http-client-tls , scotty , sqlite-simple + , strict , text default-language: Haskell2010 @@ -68,6 +69,7 @@ executable mtgsearch-exe , mtgsearch , scotty , sqlite-simple + , strict , text default-language: Haskell2010 @@ -89,5 +91,6 @@ test-suite mtgsearch-test , mtgsearch , scotty , sqlite-simple + , strict , text default-language: Haskell2010 diff --git a/package.yaml b/package.yaml index 9dff094..d4e0773 100644 --- a/package.yaml +++ b/package.yaml @@ -29,6 +29,7 @@ dependencies: - directory - http-client - http-client-tls +- strict ghc-options: - -Wall - -Wcompat diff --git a/src/Algorithm/Search.hs b/src/Algorithm/Search.hs index c244627..386b4e6 100644 --- a/src/Algorithm/Search.hs +++ b/src/Algorithm/Search.hs @@ -67,7 +67,7 @@ cardToHtml (Card _ _ _ _ _ _ _ _ [cardFace]) = singleCardFaceHTML cardFace cardToHtml (Card _ _ _ _ _ _ _ _ cardFaces) = "
" ++ concatMap singleCardFaceHTML cardFaces ++"
" singleCardFaceHTML :: CardFace -> String -singleCardFaceHTML (CardFace _ _ name cmc oracle_text type_line mana_cost (ImageUris _ _ _ image _ _ _ _)) = +singleCardFaceHTML (CardFace _ _ name _ oracle_text type_line mana_cost (ImageUris _ _ _ image _ _ _ _)) = "
" ++ "

" ++ unpack name ++ "

" ++ ""++ @@ -76,7 +76,3 @@ singleCardFaceHTML (CardFace _ _ name cmc oracle_text type_line mana_cost (Image "

Mana cost: " ++ filter (`notElem` ['{','}']) (unpack (Data.Maybe.fromMaybe "" mana_cost)) ++ "

"++ "
" - -parseCMC :: Maybe Int -> String -parseCMC (Just a) = show a -parseCMC Nothing = "" \ No newline at end of file diff --git a/src/Config.hs b/src/Config.hs index ee811dc..3875bd1 100644 --- a/src/Config.hs +++ b/src/Config.hs @@ -6,13 +6,14 @@ import Data.Aeson import Data.Text import qualified Data.ByteString.Lazy as B +import qualified Data.ByteString.Lazy.Char8 as C8 (pack) import GHC.Generics import Control.Exception (try) -import Data.ByteString.Builder (lazyByteString) -import qualified Data.Aeson.Key as B -import qualified Data.Data as B + import GHC.IO.Exception +import System.IO.Strict as L +import Data.ByteString.Builder (lazyByteString) data Config = Config{ @@ -31,10 +32,10 @@ configFile = "./Config/config.json" getJSON :: IO B.ByteString getJSON = do - a <- try $ B.readFile configFile :: IO (Either IOException B.ByteString ) + a <- try $ L.readFile configFile :: IO (Either IOException String) case a of - Right a -> return a - Left b -> error $ "Could not load configuration file" + Right a2 -> return $ C8.pack a2 + Left b -> error $ "Could not load configuration file " ++ (show b) @@ -51,11 +52,11 @@ readConfig = do getConfig :: IO Config getConfig = extract readConfig -getDataSeedPath ::IO (String) +getDataSeedPath ::IO String getDataSeedPath = do dataseedpath <$> getConfig -getDbPath ::IO (String) +getDbPath ::IO String getDbPath = do dbPath <$> getConfig diff --git a/src/Site/Static/index.html b/src/Site/Static/index.html index 48eaa6a..5f66075 100644 --- a/src/Site/Static/index.html +++ b/src/Site/Static/index.html @@ -5,7 +5,7 @@

TMagic the gathering search engine!

-

This site will be to search for magic the gathering cards using a custom sort of DSL!

+

In order to use this site