hipe 0.1.0.0 → 0.1.1.0
raw patch · 4 files changed
+23/−15 lines, 4 filesdep ~containersdep ~hxt
Dependency ranges changed: containers, hxt
Files
- hipe.cabal +7/−4
- src/Data/Geometry/Ipe/IpeGeometryTypes.hs +6/−2
- src/Data/Geometry/Ipe/Pickle.hs +9/−9
- src/Data/Geometry/Ipe/ReadIpeGeometry.hs +1/−0
hipe.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.1.0.0+version: 0.1.1.0 -- A short (one-line) description of the package. synopsis: Support for reading and writing ipe7 files (http://ipe7.sourceforge.net)@@ -41,11 +41,14 @@ -- Constraint on the version of Cabal needed to build this package. cabal-version: >=1.8 +-- -- Specify where we can find the source code+-- Hs-source-dirs: src+ library -- Specify where we can find the source code Hs-source-dirs: src - GHC-Options: -Wall+ -- GHC-Options: -Wall -- Modules exported by the library. exposed-modules: Data.Geometry.Ipe.IpeGeometry@@ -62,8 +65,8 @@ -- Other library packages from which modules are imported. build-depends: base >= 4.3 && < 5- , containers >= 0.4.2.1- , hxt == 9.1.5+ , containers >= 0.5+ , hxt >= 9.3.1 , hgeometry >= 0.1 , parsec >= 3 , split >= 0.1.4.2
src/Data/Geometry/Ipe/IpeGeometryTypes.hs view
@@ -38,8 +38,6 @@ data IpePolyline' a = IpePolyline [LineSegment2' a] AMap deriving (Show, Eq) -toPolyLine :: IpePolyline' a -> Polyline2' a-toPolyLine (IpePolyline ls _) = Polyline2 ls instance IsPoint2Functor IpePolyline' where p2fmap f (IpePolyline lines a) = IpePolyline (map (p2fmap f) lines) a@@ -51,6 +49,12 @@ attrs (IpePolyline _ a) = a updateWith f (IpePolyline p a) = IpePolyline p (f a) ++toPolyLine :: IpePolyline' a -> Polyline2' a+toPolyLine (IpePolyline ls _) = Polyline2 ls++fromPolyline :: Polyline2' a -> IpePolyline' a+fromPolyline (Polyline2 ls) = IpePolyline ls M.empty -------------------------------------------------------------------------------------- -- | Polygons
src/Data/Geometry/Ipe/Pickle.hs view
@@ -219,21 +219,21 @@ -- | Pickler that pickles an AMap into attributes xpVarTextAttrs :: PU AMap-xpVarTextAttrs = PU { appPickle = \(m,st) -> M.foldrWithKey addAtt' st m- , appUnPickle = \st ->- (Just . M.fromList . mapMaybe toPair . attributes $ st, st)+xpVarTextAttrs = PU { appPickle = \m st -> M.foldrWithKey addAtt' st m+ , appUnPickle = UP $ \st ->+ (Right . M.fromList . mapMaybe toPair . attributes $ st, st) , theSchema = theSchema xpText -- schema is not used here I guess } where- addAtt' k v = addAtt $ XN.mkAttr (mkName k) (txt v)- txt v = contents $ appPickle xpText (v, emptySt)+ addAtt' k v = putAtt (mkName k) (txt v)+ txt v = contents $ appPickle xpText v emptySt -- | Get the name and the value from this attribute toPair :: XmlTree -> Maybe (String,String)-toPair t@(XN.NTree (XAttr qn) chs) = do- v <- fst . appUnPickle xpText $ St { attributes = []- , contents = chs}- return (localPart qn, v)+toPair t@(XN.NTree (XAttr qn) chs) = let st = emptySt { contents = chs} in+ case fst . runUP (appUnPickle xpText) $ st of+ (Left _) -> Nothing+ (Right s) -> Just (localPart qn, s) ----------------------------------------------------------------------- -- Parsing stuff starts here
src/Data/Geometry/Ipe/ReadIpeGeometry.hs view
@@ -24,6 +24,7 @@ ----------------------------------------------------------------------------------- -- | Typeclass expressing which ipetypes we can convert into a IGC +-- | minimal implementation: toIGC class IsConvertableToIGC t where toIGC :: t a -> IGC a