hgeos-0.1.7.2: Simple Haskell bindings to GEOS C API

Copyright(C) Richard Cook, 2016
LicenseMIT
Maintainerrcook@rcook.org
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.Geolocation.GEOS.Trans

Description

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.

View sample

Synopsis

Documentation

areaM :: Geometry -> MaybeT IO Double Source

MaybeT-wrapped version of area

envelopeM :: Geometry -> MaybeT IO Geometry Source

MaybeT-wrapped version of envelope

geomTypeIdM :: Geometry -> MaybeT IO GeometryType Source

MaybeT-wrapped version of geomTypeId

getGeometryM :: Geometry -> Int -> MaybeT IO Geometry Source

MaybeT-wrapped version of getGeometry

getSizeM :: CoordinateSequence -> MaybeT IO Word Source

MaybeT-wrapped version of getSize

getXM :: CoordinateSequence -> Word -> MaybeT IO Double Source

MaybeT-wrapped version of getX

getYM :: CoordinateSequence -> Word -> MaybeT IO Double Source

MaybeT-wrapped version of getY

getZM :: CoordinateSequence -> Word -> MaybeT IO Double Source

MaybeT-wrapped version of getZ

isEmptyM :: Geometry -> MaybeT IO Bool Source

MaybeT-wrapped version of isEmpty

mkReaderM :: Context -> MaybeT IO Reader Source

MaybeT-wrapped version of mkReader

mkWriterM :: Context -> MaybeT IO Writer Source

MaybeT-wrapped version of mkWriter

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

setOrdinateM :: CoordinateSequence -> Word -> Word -> Double -> MaybeT IO () Source

MaybeT-wrapped version of setOrdinate

setXM :: CoordinateSequence -> Word -> Double -> MaybeT IO () Source

MaybeT-wrapped version of setX

setYM :: CoordinateSequence -> Word -> Double -> MaybeT IO () Source

MaybeT-wrapped version of setY

setZM :: CoordinateSequence -> Word -> Double -> MaybeT IO () Source

MaybeT-wrapped version of setZ

writeGeometryM :: Writer -> Geometry -> MaybeT IO String Source

MaybeT-wrapped version of area