packages feed

hgeos 0.1.4.0 → 0.1.5.0

raw patch · 4 files changed

+30/−1 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Geolocation.GEOS: getErrorMessage :: IO String
+ Data.Geolocation.GEOS.Imports: c_getErrorMessage :: IO CString
+ Data.Geolocation.GEOS.Trans: runGEOSEither :: (Context -> MaybeT IO a) -> IO (Either String a)

Files

hgeos.cabal view
@@ -1,5 +1,5 @@ name:                 hgeos-version:              0.1.4.0+version:              0.1.5.0 synopsis:             Simple Haskell bindings to GEOS C API description:   Simple Haskell bindings to the <https://trac.osgeo.org/geos/ GEOS>
src/lib/Data/Geolocation/GEOS.hs view
@@ -32,6 +32,7 @@     , envelope     , geomTypeId     , getCoordSeq+    , getErrorMessage     , getExteriorRing     , getGeometry     , getNumGeometries@@ -147,6 +148,10 @@     return $ if isNullPtr h                 then Nothing                 else Just $ CoordinateSequence sr h++-- |Returns message in case of error+getErrorMessage :: IO String+getErrorMessage = c_getErrorMessage >>= peekCString  -- |Returns a 'Geometry' instance representing the exterior ring of the -- supplied 'Geometry'
src/lib/Data/Geolocation/GEOS/Imports.hs view
@@ -50,6 +50,7 @@     , c_GEOSisEmpty_r     , c_GEOSversion     , c_finishGEOS_r+    , c_getErrorMessage     , c_initializeGEOSWithHandlers     ) where 
src/lib/Data/Geolocation/GEOS/Trans.hs view
@@ -35,6 +35,7 @@     , mkWriterM     , readGeometryM     , runGEOS+    , runGEOSEither     , writeGeometryM     ) where @@ -124,6 +125,28 @@ -- @ runGEOS :: (Context -> MaybeT IO a) -> IO (Maybe a) runGEOS = withGEOS . (runMaybeT .)++-- |Creates a <https://trac.osgeo.org/geos/ GEOS> context, passes it to a block+-- and releases the context and all associated objects such as readers, writers+-- and geometries at the end inside a @MaybeT IO@ monad returning a message in+-- case of error:+--+-- @+--    result <- runGEOSEither $ \ctx -> do+--+--        -- Use context+--+--        return ()+--    case result of+--          Left m -> putStrLn $ "Failed: " ++ m+--          Right r -> putStrLn $ "Succeeded: " ++ show r+-- @+runGEOSEither :: (Context -> MaybeT IO a) -> IO (Either String a)+runGEOSEither action = do+    result <- runGEOS action+    case result of+         Nothing -> Left <$> getErrorMessage+         Just r -> return $ Right r  -- | @MaybeT@-wrapped version of 'area' writeGeometryM :: Writer -> Geometry -> MaybeT IO String