I have a function that has a signature
tryParseAllFilesInDir :: FilePath -> [Parsec ByteString () (Maybe a)]
He tries to parse all the files in a directory with a specific Parser. It is given that only one file really succeeds , but I do not know which file is at runtime.
I want to take a list of optional parsers and render only the following Parser value. I do not know what functions I would use to achieve this.
I somehow need to switch from [Parsec ByteString () (Maybe a)] -> [Maybe a], and then [Maybe a] -> Just a.
If there is a better approach to this, I would appreciate it.
source
share