hepevt 0.1 → 0.2
raw patch · 2 files changed
+10/−10 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Data.HEPEVT: parseEvents :: String -> ByteString -> [Event]
+ Data.HEPEVT: parseEvents :: ByteString -> [Event]
Files
- Data/HEPEVT.hs +9/−9
- hepevt.cabal +1/−1
Data/HEPEVT.hs view
@@ -17,30 +17,30 @@ parseEventFile :: String -> IO [Event] parseEventFile fname = do- S.readFile fname >>= return . parseEvents fname+ S.readFile fname >>= return . parseEvents data Line = Meta String | E [Double] | P [Double] | V [Double] | Blank deriving (Show, Eq) -parseLine :: String -> Line+parseLine :: S.ByteString -> Line parseLine line =- let ws = words line in- parseLine' ws line+ let ws = S.words line in+ parseLine' (map S.unpack ws) line where parseLine' ("E":xs) _ = E $ map parseDouble xs parseLine' ("P":xs) _ = P $ map parseDouble xs parseLine' ("V":xs) _ = V $ map parseDouble xs- parseLine' _ line = if length line > 1 then Meta line else Blank+ parseLine' _ line = if S.length line > 1 then Meta (S.unpack line) else Blank -getLines :: [String] -> [Line]+getLines :: [S.ByteString] -> [Line] getLines = map parseLine type ParseState = [Event] -parseEvents :: String -> S.ByteString -> [Event]-parseEvents fname dat =+parseEvents :: S.ByteString -> [Event]+parseEvents dat = let ls = S.split '\n' dat in - reverse $ foldl process [] $ getLines (map S.unpack ls)+ reverse $ foldl process [] $ getLines ls where process events (E ds) = (ds, []):events process ((el, vl):events) (V ds) = (el, ds:vl):events
hepevt.cabal view
@@ -7,7 +7,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented.-Version: 0.1+Version: 0.2 -- A short (one-line) description of the package. Synopsis: HEPEVT parser and writer