@@ -40,7 +40,6 @@ module Hakyll.Core.Identifier.Pattern
4040 , filterMatches
4141 , capture
4242 , fromCapture
43− , fromCaptureString
4443 , fromCaptures
4544 ) where
4645
@@ -126,9 +125,9 @@ splits = inits &&& tails >>> uncurry zip >>> reverse
126125
127126-- | Match a glob against a pattern, generating a list of captures
128127--
129−capture :: Pattern -> Identifier -> Maybe [Identifier]
130−capture (Glob p) (Identifier i) = fmap (map Identifier) $ capture' p i
131−capture (Predicate _) _ = Nothing
128+capture :: Pattern -> Identifier -> Maybe [String]
129+capture (Glob p) (Identifier _ i) = capture' p i
130+capture (Predicate _) _ = Nothing
132131
133132-- | Internal verion of 'capture'
134133--
@@ -152,44 +151,32 @@ capture' (CaptureMany : ms) str =
152151--
153152-- Example:
154153--
155−-- > fromCapture (parseGlob "tags/*") (parseIdentifier "foo")
154+-- > fromCapture (parseGlob "tags/*") "foo"
156155--
157156-- Result:
158157--
159158-- > "tags/foo"
160159--
161−fromCapture :: Pattern -> Identifier -> Identifier
160+fromCapture :: Pattern -> String -> Identifier
162161fromCapture pattern = fromCaptures pattern . repeat
163162
164−-- | Simplified version of 'fromCapture' which takes a 'String' instead of an
165−-- 'Identifier'
166−--
167−-- > fromCaptureString (parseGlob "tags/*") "foo"
168−--
169−-- Result:
170−--
171−-- > "tags/foo"
172−--
173−fromCaptureString :: Pattern -> String -> Identifier
174−fromCaptureString pattern = fromCapture pattern . parseIdentifier
175−
176163-- | Create an identifier from a pattern by filling in the captures with the
177164-- given list of strings
178165--
179−fromCaptures :: Pattern -> [Identifier] -> Identifier
180−fromCaptures (Glob p) = fromCaptures' p
166+fromCaptures :: Pattern -> [String] -> Identifier
167+fromCaptures (Glob p) = Identifier Nothing . fromCaptures' p
181168fromCaptures (Predicate _) = error $
182169 "Hakyll.Core.Identifier.Pattern.fromCaptures: fromCaptures called on a " ++
183170 "predicate instead of a glob"
184171
185172-- | Internally used version of 'fromCaptures'
186173--
187−fromCaptures' :: [GlobComponent] -> [Identifier] -> Identifier
174+fromCaptures' :: [GlobComponent] -> [String] -> String
188175fromCaptures' [] _ = mempty
189176fromCaptures' (m : ms) [] = case m of
190− Literal l -> Identifier l `mappend` fromCaptures' ms []
177+ Literal l -> l `mappend` fromCaptures' ms []
191178 _ -> error $ "Hakyll.Core.Identifier.Pattern.fromCaptures': "
192179 ++ "identifier list exhausted"
193180fromCaptures' (m : ms) ids@(i : is) = case m of
194− Literal l -> Identifier l `mappend` fromCaptures' ms ids
181+ Literal l -> l `mappend` fromCaptures' ms ids
195182 _ -> i `mappend` fromCaptures' ms is