grid 3.0.1 → 3.1
raw patch · 2 files changed
+27/−12 lines, 2 filesdep +cerealdep ~QuickCheckdep ~containersdep ~test-frameworkPVP ok
version bump matches the API change (PVP)
Dependencies added: cereal
Dependency ranges changed: QuickCheck, containers, test-framework
API changes (from Hackage documentation)
+ Math.Geometry.GridInternal: instance Constructor C1_0HexHexGrid
+ Math.Geometry.GridInternal: instance Constructor C1_0ParaHexGrid
+ Math.Geometry.GridInternal: instance Constructor C1_0ParaTriGrid
+ Math.Geometry.GridInternal: instance Constructor C1_0RectSquareGrid
+ Math.Geometry.GridInternal: instance Constructor C1_0TorSquareGrid
+ Math.Geometry.GridInternal: instance Constructor C1_0TriTriGrid
+ Math.Geometry.GridInternal: instance Datatype D1HexHexGrid
+ Math.Geometry.GridInternal: instance Datatype D1ParaHexGrid
+ Math.Geometry.GridInternal: instance Datatype D1ParaTriGrid
+ Math.Geometry.GridInternal: instance Datatype D1RectSquareGrid
+ Math.Geometry.GridInternal: instance Datatype D1TorSquareGrid
+ Math.Geometry.GridInternal: instance Datatype D1TriTriGrid
+ Math.Geometry.GridInternal: instance Generic HexHexGrid
+ Math.Geometry.GridInternal: instance Generic ParaHexGrid
+ Math.Geometry.GridInternal: instance Generic ParaTriGrid
+ Math.Geometry.GridInternal: instance Generic RectSquareGrid
+ Math.Geometry.GridInternal: instance Generic TorSquareGrid
+ Math.Geometry.GridInternal: instance Generic TriTriGrid
+ Math.Geometry.GridInternal: instance Serialize HexHexGrid
+ Math.Geometry.GridInternal: instance Serialize ParaHexGrid
+ Math.Geometry.GridInternal: instance Serialize ParaTriGrid
+ Math.Geometry.GridInternal: instance Serialize RectSquareGrid
+ Math.Geometry.GridInternal: instance Serialize TorSquareGrid
+ Math.Geometry.GridInternal: instance Serialize TriTriGrid
Files
- grid.cabal +6/−5
- src/Math/Geometry/GridInternal.hs +21/−7
grid.cabal view
@@ -1,5 +1,5 @@ name: grid-version: 3.0.1+version: 3.1 synopsis: Tools for working with regular grids (graphs, lattices). description: Provides tools for working with regular arrangements of tiles, such as might be used in a board game or some@@ -26,7 +26,8 @@ hs-source-dirs: src build-depends: base ==4.*, base-unicode-symbols ==0.2.*,- containers ==0.4.2.*+ cereal ==0.3.*,+ containers ==0.4.2.* || ==0.5.* ghc-options: -Wall exposed-modules: Math.Geometry.Grid, Math.Geometry.GridInternal,@@ -36,9 +37,9 @@ type: exitcode-stdio-1.0 build-depends: base ==4.*, exact-combinatorics ==0.2.*,- test-framework-quickcheck2 == 0.3.*,- QuickCheck == 2.4.*,- test-framework == 0.*,+ test-framework-quickcheck2 ==0.3.*,+ QuickCheck ==2.4.* || ==2.5.*,+ test-framework ==0.8.*, grid, base-unicode-symbols ==0.2.* hs-source-dirs: test
src/Math/Geometry/GridInternal.hs view
@@ -13,7 +13,7 @@ ------------------------------------------------------------------------ {-# LANGUAGE UnicodeSyntax, MultiParamTypeClasses, FunctionalDependencies, TypeSynonymInstances, FlexibleInstances, - FlexibleContexts #-}+ FlexibleContexts, DeriveGeneric #-} module Math.Geometry.GridInternal (@@ -42,6 +42,8 @@ import Data.List (groupBy, nub, nubBy, sortBy) import Data.Ord (comparing) import Data.Ord.Unicode ((≤), (≥))+import Data.Serialize (Serialize)+import GHC.Generics (Generic) -- | A regular arrangement of tiles. -- Minimal complete definition: @indices@, @distance@ and @size@.@@ -216,11 +218,13 @@ -- | A triangular grid with triangular tiles. -- The grid and its indexing scheme are illustrated in the user guide, -- available at <https://github.com/mhwombat/grid/wiki>.-data TriTriGrid = TriTriGrid Int [(Int, Int)] deriving Eq+data TriTriGrid = TriTriGrid Int [(Int, Int)] deriving (Eq, Generic) instance Show TriTriGrid where show (TriTriGrid s _) = "triTriGrid " ++ show s +instance Serialize TriTriGrid+ instance Grid TriTriGrid Int (Int, Int) where indices (TriTriGrid _ xs) = xs neighbours = triNeighbours@@ -269,11 +273,13 @@ -- | A Parallelogrammatical grid with triangular tiles. -- The grid and its indexing scheme are illustrated in the user guide, -- available at <https://github.com/mhwombat/grid/wiki>.-data ParaTriGrid = ParaTriGrid (Int, Int) [(Int, Int)] deriving Eq+data ParaTriGrid = ParaTriGrid (Int, Int) [(Int, Int)] deriving (Eq, Generic) instance Show ParaTriGrid where show (ParaTriGrid (r,c) _) = "paraTriGrid " ++ show r ++ " " ++ show c +instance Serialize ParaTriGrid+ instance Grid ParaTriGrid (Int, Int) (Int, Int) where indices (ParaTriGrid _ xs) = xs neighbours = triNeighbours@@ -318,12 +324,14 @@ -- | A rectangular grid with square tiles. -- The grid and its indexing scheme are illustrated in the user guide, -- available at <https://github.com/mhwombat/grid/wiki>.-data RectSquareGrid = RectSquareGrid (Int, Int) [(Int, Int)] deriving Eq+data RectSquareGrid = RectSquareGrid (Int, Int) [(Int, Int)] deriving (Eq, Generic) instance Show RectSquareGrid where show (RectSquareGrid (r,c) _) = "rectSquareGrid " ++ show r ++ " " ++ show c +instance Serialize RectSquareGrid+ instance Grid RectSquareGrid (Int, Int) (Int, Int) where indices (RectSquareGrid _ xs) = xs neighbours g (x, y) = @@ -375,11 +383,13 @@ -- | A toroidal grid with square tiles. -- The grid and its indexing scheme are illustrated in the user guide, -- available at <https://github.com/mhwombat/grid/wiki>.-data TorSquareGrid = TorSquareGrid (Int, Int) [(Int, Int)] deriving Eq+data TorSquareGrid = TorSquareGrid (Int, Int) [(Int, Int)] deriving (Eq, Generic) instance Show TorSquareGrid where show (TorSquareGrid (r,c) _) = "torSquareGrid " ++ show r ++ " " ++ show c +instance Serialize TorSquareGrid+ instance Grid TorSquareGrid (Int, Int) (Int, Int) where indices (TorSquareGrid _ xs) = xs neighbours (TorSquareGrid (r,c) _) (x,y) = @@ -420,10 +430,12 @@ -- | A hexagonal grid with hexagonal tiles -- The grid and its indexing scheme are illustrated in the user guide, -- available at <https://github.com/mhwombat/grid/wiki>.-data HexHexGrid = HexHexGrid Int [(Int, Int)] deriving Eq+data HexHexGrid = HexHexGrid Int [(Int, Int)] deriving (Eq, Generic) instance Show HexHexGrid where show (HexHexGrid s _) = "hexHexGrid " ++ show s +instance Serialize HexHexGrid+ instance Grid HexHexGrid Int (Int, Int) where indices (HexHexGrid _ xs) = xs neighbours g (x,y) = filter (g `contains`) @@ -458,10 +470,12 @@ -- | A parallelogramatical grid with hexagonal tiles -- The grid and its indexing scheme are illustrated in the user guide, -- available at <https://github.com/mhwombat/grid/wiki>.-data ParaHexGrid = ParaHexGrid (Int, Int) [(Int, Int)] deriving Eq+data ParaHexGrid = ParaHexGrid (Int, Int) [(Int, Int)] deriving (Eq, Generic) instance Show ParaHexGrid where show (ParaHexGrid (r,c) _) = "paraHexGrid " ++ show r ++ " " ++ show c++instance Serialize ParaHexGrid instance Grid ParaHexGrid (Int, Int) (Int, Int) where indices (ParaHexGrid _ xs) = xs