summaryrefslogtreecommitdiff
path: root/ScanningParser.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2014-05-14 23:04:50 -0400
committerjoe <joe@jerkface.net>2014-05-14 23:04:50 -0400
commit7307fb20e430ef896131f0fd6bfe2ae2371e1008 (patch)
treec7a9d747766c1f34fc6c9b7e9a929bba8e6583be /ScanningParser.hs
parenta9f569979d0618d55c273465d85c402d9b6c9a10 (diff)
validatecert.hs demonstrating squid's SslServerCertValidator feature.
Diffstat (limited to 'ScanningParser.hs')
-rw-r--r--ScanningParser.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/ScanningParser.hs b/ScanningParser.hs
index a0a5d23..f99e120 100644
--- a/ScanningParser.hs
+++ b/ScanningParser.hs
@@ -3,6 +3,7 @@
3module ScanningParser 3module ScanningParser
4 ( ScanningParser(..) 4 ( ScanningParser(..)
5 , scanAndParse 5 , scanAndParse
6 , scanAndParse1
6 ) where 7 ) where
7 8
8import Data.Maybe 9import Data.Maybe
@@ -61,3 +62,13 @@ scanAndParse psr@(ScanningParser ffst pbdy) ts = do
61 b <- ffst x 62 b <- ffst x
62 return (b,drop 1 ts) 63 return (b,drop 1 ts)
63 64
65scanAndParse1 :: ScanningParser a c -> [a] -> (Maybe c, [a])
66scanAndParse1 psr@(ScanningParser ffst pbdy) ts =
67 maybe (Nothing,[]) (uncurry pbdy) mb
68 where
69 mb = listToMaybe $ mapMaybe findfst' tss
70 tss = tails ts
71 findfst' ts = do
72 x <- listToMaybe ts
73 b <- ffst x
74 return (b,drop 1 ts)