Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- parse file names like 00000000D77119212C419E59@1012_T1642235909_D31_Maf_EEvent(5)_C0.jpeg
- parseImage :: Path Abs File -> Either ParseError Image
- parseImage fn = let
- sgn = (char '-' >> return (-1)) <|> return 1
- nat = fst . flip (!!) 0 . take 1 . readDec <$> many1 digit
- int = (*) <$> sgn <*> nat
- f = toFilePath . filename $ fn
- p = do
- dev <- many1 hexDigit
- _ <- char '@'
- seq_ <- int
- _ <- char '_'
- _ <- char 'T'
- timestamp_ <- int
- _ <- char '_'
- _ <- char 'D'
- d_ <- int
- _ <- string "_Maf_EEvent"
- _ <- char '('
- eevent_ <- int
- _ <- string ")_C"
- c_ <- nat
- return $ Image fn dev seq_ timestamp_ d_ eevent_ c_
- in
- parse p f f
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement