xcb-types 0.11.0 → 0.12.0
raw patch · 4 files changed
+21/−21 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Data.XCB.Types: XEvent :: Name -> Int -> Maybe Alignment -> [GenStructElem typ] -> Maybe Bool -> GenXDecl typ
+ Data.XCB.Types: XEvent :: Name -> Int -> Maybe Alignment -> Maybe Bool -> [GenStructElem typ] -> Maybe Bool -> GenXDecl typ
Files
- Data/XCB/FromXML.hs +17/−17
- Data/XCB/Pretty.hs +2/−2
- Data/XCB/Types.hs +1/−1
- xcb-types.cabal +1/−1
Data/XCB/FromXML.hs view
@@ -26,10 +26,10 @@ import Data.List as List import qualified Data.Map as Map-import Data.Maybe+import Data.Maybe (catMaybes, mapMaybe) -import Control.Monad-import Control.Monad.Reader+import Control.Monad (MonadPlus (mzero, mplus), guard, liftM, liftM2)+import Control.Monad.Reader (ReaderT, runReaderT, ask, lift, withReaderT) import System.IO (openFile, IOMode (ReadMode), hSetEncoding, utf8, hGetContents) @@ -58,7 +58,7 @@ fromStrings xs = let rs = mapAlt fromString xs Just headers = runReaderT rs headers- in headers + in headers -- The 'Parse' monad. Provides the name of the -- current module, and a list of all of the modules.@@ -120,19 +120,19 @@ Just (XError name code alignment elems) -> Just $ ErrorDetails name code alignment elems _ -> error "impossible: fatal error in Data.XCB.FromXML.findError" where f (XError name _ _ _) | name == pname = True- f _ = False - + f _ = False+ findEvent :: Name -> [XDecl] -> Maybe EventDetails-findEvent pname xs = +findEvent pname xs = case List.find f xs of Nothing -> Nothing- Just (XEvent name code alignment elems noseq) ->- Just $ EventDetails name code alignment elems noseq+ Just (XEvent name code alignment xge elems noseq) ->+ Just $ EventDetails name code alignment xge elems noseq _ -> error "impossible: fatal error in Data.XCB.FromXML.findEvent"- where f (XEvent name _ _ _ _) | name == pname = True+ where f (XEvent name _ _ _ _ _) | name == pname = True f _ = False -data EventDetails = EventDetails Name Int (Maybe Alignment) [StructElem] (Maybe Bool)+data EventDetails = EventDetails Name Int (Maybe Alignment) (Maybe Bool) [StructElem] (Maybe Bool) data ErrorDetails = ErrorDetails Name Int (Maybe Alignment) [StructElem] ---@@ -221,11 +221,12 @@ xevent el = do name <- el `attr` "name" number <- el `attr` "number" >>= readM+ let xge = ensureUpper `liftM` (el `attr` "xge") >>= readM let noseq = ensureUpper `liftM` (el `attr` "no-sequence-number") >>= readM (alignment, xs) <- extractAlignment (elChildren el) fields <- mapM structField $ xs guard $ not $ null fields- return $ XEvent name number alignment fields noseq+ return $ XEvent name number alignment xge fields noseq xevcopy :: Element -> Parse XDecl xevcopy el = do@@ -235,12 +236,12 @@ -- do we have a qualified ref? let (mname,evname) = splitRef ref details <- lookupEvent mname evname- return $ let EventDetails _ _ alignment fields noseq =+ return $ let EventDetails _ _ alignment xge fields noseq = case details of Nothing -> error $ "Unresolved event: " ++ show mname ++ " " ++ ref Just x -> x - in XEvent name number alignment fields noseq+ in XEvent name number alignment xge fields noseq -- we need to do string processing to distinguish qualified from -- unqualified types.@@ -262,11 +263,11 @@ split c = go where go [] = ([],[]) go (x:xs) | x == c = ([],xs)- | otherwise = + | otherwise = let (lefts, rights) = go xs in (x:lefts,rights)- + xerror :: Element -> Parse XDecl xerror el = do name <- el `attr` "name"@@ -508,4 +509,3 @@ -- adapted from Network.CGI.Protocol readM :: (MonadPlus m, Read a) => String -> m a readM = liftM fst . listToM . reads-
Data/XCB/Pretty.hs view
@@ -187,11 +187,11 @@ ,text "as" ,toDoc typ ]- toDoc (XEvent nm n alignment elems (Just True)) =+ toDoc (XEvent nm n alignment _ elems (Just True)) = hang (text "Event:" <+> text nm <> char ',' <> toDoc n <+> toDoc alignment <+> parens (text "No sequence number")) 2 $ vcat $ map toDoc elems- toDoc (XEvent nm n alignment elems _) =+ toDoc (XEvent nm n alignment _ elems _) = hang (text "Event:" <+> text nm <> char ',' <> toDoc n <+> toDoc alignment) 2 $ vcat $ map toDoc elems toDoc (XRequest nm n alignment elems mrep) =
Data/XCB/Types.hs view
@@ -82,7 +82,7 @@ data GenXDecl typ = XStruct Name (Maybe Alignment) [GenStructElem typ] | XTypeDef Name typ- | XEvent Name Int (Maybe Alignment) [GenStructElem typ] (Maybe Bool) -- ^ The boolean indicates if the event includes a sequence number.+ | XEvent Name Int (Maybe Alignment) (Maybe Bool) [GenStructElem typ] (Maybe Bool) -- ^ bools: #1 if xge is true; #2 if the event includes a sequence number. | XRequest Name Int (Maybe Alignment) [GenStructElem typ] (Maybe (GenXReply typ)) | XidType Name | XidUnion Name [GenXidUnionElem typ]
xcb-types.cabal view
@@ -1,5 +1,5 @@ Name: xcb-types-Version: 0.11.0+Version: 0.12.0 Cabal-Version: >= 1.10 Synopsis: Parses XML files used by the XCB project Description: This package provides types which mirror the structures