geojson 1.3.2 → 1.3.3
raw patch · 7 files changed
+27/−26 lines, 7 filesdep ~validation
Dependency ranges changed: validation
Files
- CHANGELOG.md +4/−0
- README.md +1/−1
- geojson.cabal +4/−4
- src/Data/LineString.hs +1/−4
- src/Data/LinearRing.hs +2/−2
- test/Data/LineStringTests.hs +6/−6
- test/Data/LinearRingTests.hs +9/−9
CHANGELOG.md view
@@ -1,5 +1,9 @@ # 1.3.0 +## 1.3.1->1.3.3++- Fixed Validation dependency.+ ## 1.2.0 -> 1.3.0 - `MultiPolygon`, `MultiPoint`, `MultiLine` were all corrected as they weren't compliant with the spec (See [here] (https://github.com/domdere/hs-geojson/issues/9) for reference).
README.md view
@@ -1,4 +1,4 @@-# geojson [](https://travis-ci.org/domdere/hs-geojson) [](https://hackage.haskell.org/package/geojson) [](https://gitter.im/domdere/hs-geojson)+# geojson [](https://travis-ci.org/newmana/hs-geojson) [Hackage](https://hackage.haskell.org/package/geojson) A thin GeoJSON Layer above the `aeson` library
geojson.cabal view
@@ -1,5 +1,5 @@ name: geojson-version: 1.3.2+version: 1.3.3 license: BSD3 license-file: LICENCE author: Dom De Re@@ -27,7 +27,7 @@ source-repository this type: git location: https://github.com/newmana/hs-geojson.git- tag: 1.3.2+ tag: 1.3.3 library hs-source-dirs: src@@ -38,7 +38,7 @@ , text >= 1.2 , scientific >= 0.2.0 , transformers >= 0.3- , validation >= 0.5+ , validation >= 1 , vector >= 0.10 exposed-modules: Data.Geospatial , Data.LinearRing@@ -71,7 +71,7 @@ , tasty-hspec , tasty-quickcheck , text >= 1.2- , validation >= 0.5+ , validation >= 1 other-modules: Arbitrary , Fixture , Data.LinearRingTests
src/Data/LineString.hs view
@@ -84,10 +84,7 @@ -- creates a LineString out of a list of elements, -- if there are enough elements (needs at least 2) elements ---fromList- :: (Validate v)- => [a]- -> v ListToLineStringError (LineString a)+fromList :: (Validate v) => [a] -> v ListToLineStringError (LineString a) fromList [] = _Failure # ListEmpty fromList [_] = _Failure # SingletonList fromList (x:y:zs) = _Success # LineString x y zs
src/Data/LinearRing.hs view
@@ -37,7 +37,7 @@ import Data.List (intercalate) import Data.List.NonEmpty as NL (NonEmpty, toList) import Data.Traversable (Traversable (..))-import Data.Validation (AccValidation, Validate (..), _Failure,+import Data.Validation (Validate (..), Validation, _Failure, _Success) -- |@@ -168,7 +168,7 @@ -- helpers -fromListAcc :: [a] -> AccValidation (NonEmpty (ListToLinearRingError a)) (LinearRing a)+fromListAcc :: [a] -> Validation (NonEmpty (ListToLinearRingError a)) (LinearRing a) fromListAcc = fromList showErrors :: (Show a) => NonEmpty (ListToLinearRingError a) -> String
test/Data/LineStringTests.hs view
@@ -1,7 +1,7 @@ module Data.LineStringTests where import Data.Foldable (Foldable (..))-import Data.Validation (AccValidation (..))+import Data.Validation (Validation (..)) import Test.Tasty import Test.Tasty.Hspec (Spec, context, describe, it, shouldBe, testSpec)@@ -72,13 +72,13 @@ testFromList = describe "fromList" $ do it "creates a LineString out of a list of elements" $ do- fromList ([0, 1] :: [Int]) `shouldBe` AccSuccess (makeLineString 0 1 [])- fromList ([0, 1, 2] :: [Int]) `shouldBe` AccSuccess (makeLineString 0 1 [2])- fromList ([0, 1, 2, 4, 5, 0] :: [Int]) `shouldBe` AccSuccess (makeLineString 0 1 [2, 4, 5, 0])+ fromList ([0, 1] :: [Int]) `shouldBe` Success (makeLineString 0 1 [])+ fromList ([0, 1, 2] :: [Int]) `shouldBe` Success (makeLineString 0 1 [2])+ fromList ([0, 1, 2, 4, 5, 0] :: [Int]) `shouldBe` Success (makeLineString 0 1 [2, 4, 5, 0]) context "when provided with invalid input" $ it "fails" $ do- fromList ([] :: [Int]) `shouldBe` AccFailure ListEmpty- fromList ([0] :: [Int]) `shouldBe` AccFailure SingletonList+ fromList ([] :: [Int]) `shouldBe` Failure ListEmpty+ fromList ([0] :: [Int]) `shouldBe` Failure SingletonList -- TODO -- (\xs -> safeLast (fromLineString xs) == Just (lineStringHead xs)) (xs :: LineString Int)
test/Data/LinearRingTests.hs view
@@ -2,7 +2,7 @@ import Data.Foldable (Foldable (..)) import Data.List.NonEmpty (NonEmpty (..))-import Data.Validation (AccValidation (..))+import Data.Validation (Validation (..)) import Test.Tasty import Test.Tasty.Hspec (Spec, context, describe, it, shouldBe, testSpec)@@ -82,16 +82,16 @@ testFromList = describe "fromList" $ do it "creates a LinearRing out of a list of elements" $ do- fromList ([0, 1, 2, 3] :: [Int]) `shouldBe` AccSuccess (makeLinearRing 0 1 2 [])- fromList ([0, 1, 2, 4, 0] :: [Int]) `shouldBe` AccSuccess (makeLinearRing 0 1 2 [4])- fromList ([0, 1, 2, 4, 5, 0] :: [Int]) `shouldBe` AccSuccess (makeLinearRing 0 1 2 [4, 5])- fromList ([0, 1, 2, 4, 5, 6] :: [Int]) `shouldBe` AccSuccess (makeLinearRing 0 1 2 [4, 5])+ fromList ([0, 1, 2, 3] :: [Int]) `shouldBe` Success (makeLinearRing 0 1 2 [])+ fromList ([0, 1, 2, 4, 0] :: [Int]) `shouldBe` Success (makeLinearRing 0 1 2 [4])+ fromList ([0, 1, 2, 4, 5, 0] :: [Int]) `shouldBe` Success (makeLinearRing 0 1 2 [4, 5])+ fromList ([0, 1, 2, 4, 5, 6] :: [Int]) `shouldBe` Success (makeLinearRing 0 1 2 [4, 5]) context "when provided with invalid input" $ it "fails" $ do- fromList [] `shouldBe` AccFailure (ListTooShort 0 :| [] :: NonEmpty (ListToLinearRingError Int))- fromList [0] `shouldBe` AccFailure (ListTooShort 1 :| [] :: NonEmpty (ListToLinearRingError Int))- fromList [0, 1] `shouldBe` AccFailure (ListTooShort 2 :| [] :: NonEmpty (ListToLinearRingError Int))- fromList [0, 1, 2] `shouldBe` AccFailure (ListTooShort 3 :| [] :: NonEmpty (ListToLinearRingError Int))+ fromList [] `shouldBe` Failure (ListTooShort 0 :| [] :: NonEmpty (ListToLinearRingError Int))+ fromList [0] `shouldBe` Failure (ListTooShort 1 :| [] :: NonEmpty (ListToLinearRingError Int))+ fromList [0, 1] `shouldBe` Failure (ListTooShort 2 :| [] :: NonEmpty (ListToLinearRingError Int))+ fromList [0, 1, 2] `shouldBe` Failure (ListTooShort 3 :| [] :: NonEmpty (ListToLinearRingError Int)) -- TODO -- > (\xs -> safeLast (fromLinearRing xs) == Just (ringHead xs)) (xs :: LinearRing Int)