summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstuebinm2022-02-28 00:39:54 +0100
committerstuebinm2022-03-19 19:57:16 +0100
commit596096823872aaa491e1a208f70da820322a766f (patch)
tree320185abe5882b3732d6a23879e13fcb87d83039
parentb7c0cd8fbef6147bf1ff2e30abfcf5c4c025862b (diff)
separate tiled modules out into own package
Diffstat (limited to '')
-rw-r--r--lib/CheckDir.hs2
-rw-r--r--lib/CheckMap.hs2
-rw-r--r--lib/LayerData.hs2
-rw-r--r--lib/LintWriter.hs2
-rw-r--r--lib/Properties.hs11
-rw-r--r--lib/Util.hs2
-rw-r--r--package.yaml10
-rw-r--r--tiled/Data/Tiled.hs (renamed from lib/Tiled.hs)3
-rw-r--r--tiled/Data/Tiled/Abstract.hs (renamed from lib/TiledAbstract.hs)4
-rw-r--r--walint.cabal25
10 files changed, 46 insertions, 17 deletions
diff --git a/lib/CheckDir.hs b/lib/CheckDir.hs
index a19a412..300cf00 100644
--- a/lib/CheckDir.hs
+++ b/lib/CheckDir.hs
@@ -41,7 +41,7 @@ import System.FilePath (splitPath, (</>))
import qualified System.FilePath as FP
import System.FilePath.Posix (takeDirectory)
import Text.Dot (showDot)
-import Tiled (Tiledmap)
+import Data.Tiled (Tiledmap)
import Types (Dep (Local, LocalMap), Hint (Hint),
Level (..), hintLevel)
import Util (PrettyPrint (prettyprint), ellipsis)
diff --git a/lib/CheckMap.hs b/lib/CheckMap.hs
index 23267a8..9dc3a4c 100644
--- a/lib/CheckMap.hs
+++ b/lib/CheckMap.hs
@@ -32,7 +32,7 @@ import LintWriter (LintResult, invertLintResult,
runLintWriter)
import Properties (checkLayer, checkMap, checkTileset)
import System.FilePath (takeFileName)
-import Tiled (Layer (layerLayers, layerName),
+import Data.Tiled (Layer (layerLayers, layerName),
LoadResult (..),
Tiledmap (tiledmapLayers, tiledmapTilesets),
loadTiledmap)
diff --git a/lib/LayerData.hs b/lib/LayerData.hs
index 6956c92..46d6449 100644
--- a/lib/LayerData.hs
+++ b/lib/LayerData.hs
@@ -8,7 +8,7 @@ import Control.Monad.Zip (mzipWith)
import Data.Set (insert)
import Data.Vector (maximum, uncons)
import qualified Text.Show as TS
-import Tiled (GlobalId (unGlobalId), Layer (..))
+import Data.Tiled (GlobalId (unGlobalId), Layer (..))
import Util (PrettyPrint (..))
-- | A collision between two layers of the given names.
diff --git a/lib/LintWriter.hs b/lib/LintWriter.hs
index d0c6c4e..b55b16e 100644
--- a/lib/LintWriter.hs
+++ b/lib/LintWriter.hs
@@ -48,7 +48,7 @@ import Universum
import Badges (Badge)
import Data.Map (fromListWith)
import LintConfig (LintConfig')
-import TiledAbstract (HasName (getName))
+import Data.Tiled.Abstract (HasName (getName))
import Types (Dep, Hint, Level (..), Lint (..), hint,
lintsToHints)
diff --git a/lib/Properties.hs b/lib/Properties.hs
index eb31403..846430b 100644
--- a/lib/Properties.hs
+++ b/lib/Properties.hs
@@ -18,14 +18,13 @@ import Universum hiding (intercalate, isPrefixOf)
import Data.Text (intercalate, isInfixOf, isPrefixOf)
import qualified Data.Text as T
import qualified Data.Vector as V
-import Tiled (Layer (..), Object (..), Property (..),
+import Data.Tiled (Layer (..), Object (..), Property (..),
PropertyValue (..), Tile (..),
Tiledmap (..), Tileset (..))
-import TiledAbstract (HasData (..), HasName (..),
- HasProperties (..), HasTypeName (..),
- IsProperty (..), layerIsEmpty)
-import Util (mkProxy, naiveEscapeHTML, prettyprint,
- showText)
+import Data.Tiled.Abstract (HasName (..), HasProperties (..),
+ HasTypeName (..), IsProperty (..), HasData (..))
+import Util (layerIsEmpty, mkProxy, naiveEscapeHTML,
+ prettyprint)
import Badges (Badge (Badge),
BadgeArea (BadgePoint, BadgeRect),
diff --git a/lib/Util.hs b/lib/Util.hs
index 1ffbbe5..d5e9e98 100644
--- a/lib/Util.hs
+++ b/lib/Util.hs
@@ -17,7 +17,7 @@ import Universum
import Data.Aeson as Aeson
import qualified Data.Set as S
import qualified Data.Text as T
-import Tiled (Layer (layerData), PropertyValue (..),
+import Data.Tiled (Layer (layerData), PropertyValue (..),
Tileset (tilesetName), layerName, mkTiledId)
-- | helper function to create proxies
diff --git a/package.yaml b/package.yaml
index f9498d6..53ef4c2 100644
--- a/package.yaml
+++ b/package.yaml
@@ -15,10 +15,20 @@ dependencies:
- bytestring
- text
+internal-libraries:
+ tiled:
+ source-dirs: 'tiled'
+ dependencies:
+ - vector
+ exposed-modules:
+ - Data.Tiled
+ - Data.Tiled.Abstract
+
library:
source-dirs: 'lib'
dependencies:
- containers
+ - tiled
- text
- vector
- transformers
diff --git a/lib/Tiled.hs b/tiled/Data/Tiled.hs
index 3162dfd..046a080 100644
--- a/lib/Tiled.hs
+++ b/tiled/Data/Tiled.hs
@@ -15,7 +15,7 @@
-- cover some of the types and records that are available in the format. For
-- those you should read the TMX documentation at
-- http://doc.mapeditor.org/en/latest/reference/tmx-map-format/
-module Tiled where
+module Data.Tiled where
import Universum
@@ -383,6 +383,7 @@ instance ToJSON Tiledmap where
toJSON = genericToJSON (aesonOptions 8)
data LoadResult = Loaded Tiledmap | IOErr String | DecodeErr String
+ deriving Show
-- | Load a Tiled map from the given 'FilePath'.
loadTiledmap :: FilePath -> IO LoadResult
diff --git a/lib/TiledAbstract.hs b/tiled/Data/Tiled/Abstract.hs
index f55e75e..5a5b7c0 100644
--- a/lib/TiledAbstract.hs
+++ b/tiled/Data/Tiled/Abstract.hs
@@ -1,11 +1,11 @@
{-# LANGUAGE OverloadedStrings #-}
-module TiledAbstract where
+module Data.Tiled.Abstract where
import Universum
import qualified Data.Vector as V
-import Tiled (GlobalId, Layer (..), Object (..), Property (..),
+import Data.Tiled (GlobalId, Layer (..), Object (..), Property (..),
PropertyValue (..), Tile (..), Tiledmap (..),
Tileset (..), mkTiledId)
import Util (showText)
diff --git a/walint.cabal b/walint.cabal
index 94d79f5..cd79a59 100644
--- a/walint.cabal
+++ b/walint.cabal
@@ -1,4 +1,4 @@
-cabal-version: 1.12
+cabal-version: 2.0
-- This file has been generated from package.yaml by hpack version 0.34.5.
--
@@ -28,8 +28,6 @@ library
LintWriter
Paths
Properties
- Tiled
- TiledAbstract
Uris
Paths_walint
hs-source-dirs:
@@ -53,12 +51,33 @@ library
, regex-tdfa
, text
, text-metrics
+ , tiled
, transformers
, universum
, uri-encode
, vector
default-language: Haskell2010
+library tiled
+ exposed-modules:
+ Data.Tiled
+ Data.Tiled.Abstract
+ other-modules:
+ Paths_walint
+ hs-source-dirs:
+ tiled
+ default-extensions:
+ NoImplicitPrelude
+ ghc-options: -Wall -Wno-name-shadowing -Wno-unticked-promoted-constructors
+ build-depends:
+ aeson
+ , base
+ , bytestring
+ , text
+ , universum
+ , vector
+ default-language: Haskell2010
+
executable walint
main-is: Main.hs
other-modules: