Copyright | (C) Richard Cook, 2016 |
---|---|
License | MIT |
Maintainer | rcook@rcook.org |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
These are MaybeT
monad transformer wrapper functions for the high-level API
to simplify error handling in client code.
For the low-level FFI bindings, see Data.Geolocation.GEOS.Imports.
For the high-level API, see Data.Geolocation.GEOS.
- areaM :: Geometry -> MaybeT IO Double
- createCoordSeqM :: Context -> Word -> Word -> MaybeT IO CoordinateSequence
- createLinearRingM :: CoordinateSequence -> MaybeT IO Geometry
- envelopeM :: Geometry -> MaybeT IO Geometry
- geomTypeIdM :: Geometry -> MaybeT IO GeometryType
- getCoordSeqM :: Geometry -> MaybeT IO CoordinateSequence
- getExteriorRingM :: Geometry -> MaybeT IO Geometry
- getGeometryM :: Geometry -> Int -> MaybeT IO Geometry
- getNumGeometriesM :: Geometry -> MaybeT IO Int
- getSizeM :: CoordinateSequence -> MaybeT IO Word
- getXM :: CoordinateSequence -> Word -> MaybeT IO Double
- getYM :: CoordinateSequence -> Word -> MaybeT IO Double
- getZM :: CoordinateSequence -> Word -> MaybeT IO Double
- intersectionM :: Geometry -> Geometry -> MaybeT IO Geometry
- isEmptyM :: Geometry -> MaybeT IO Bool
- mkReaderM :: Context -> MaybeT IO Reader
- mkWriterM :: Context -> MaybeT IO Writer
- readGeometryM :: Reader -> String -> MaybeT IO Geometry
- runGEOS :: (Context -> MaybeT IO a) -> IO (Maybe a)
- runGEOSEither :: (Context -> MaybeT IO a) -> IO (Either String a)
- setXM :: CoordinateSequence -> Word -> Double -> MaybeT IO ()
- setYM :: CoordinateSequence -> Word -> Double -> MaybeT IO ()
- setZM :: CoordinateSequence -> Word -> Double -> MaybeT IO ()
- writeGeometryM :: Writer -> Geometry -> MaybeT IO String
Documentation
createCoordSeqM :: Context -> Word -> Word -> MaybeT IO CoordinateSequence Source
MaybeT
-wrapped version of createCoordSeq
createLinearRingM :: CoordinateSequence -> MaybeT IO Geometry Source
MaybeT
-wrapped version of createLinearRing
geomTypeIdM :: Geometry -> MaybeT IO GeometryType Source
MaybeT
-wrapped version of geomTypeId
getCoordSeqM :: Geometry -> MaybeT IO CoordinateSequence Source
MaybeT
-wrapped version of getCoordSeq
getExteriorRingM :: Geometry -> MaybeT IO Geometry Source
MaybeT
-wrapped version of getExteriorRing
getGeometryM :: Geometry -> Int -> MaybeT IO Geometry Source
MaybeT
-wrapped version of getGeometry
getNumGeometriesM :: Geometry -> MaybeT IO Int Source
MaybeT
-wrapped version of getNumGeometries
intersectionM :: Geometry -> Geometry -> MaybeT IO Geometry Source
MaybeT
-wrapped version of intersection
readGeometryM :: Reader -> String -> MaybeT IO Geometry Source
MaybeT
-wrapped version of readGeometry
runGEOS :: (Context -> MaybeT IO a) -> IO (Maybe a) Source
Creates a 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:
runGEOS $ ctx -> do -- Use context return ()
runGEOSEither :: (Context -> MaybeT IO a) -> IO (Either String a) Source
Creates a 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