-
-
Save kozross/fd5a1ec16403de70190dc61b5655e635 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkFreshRoute :: (Functor f) => URL -> (Maybe a -> f a) -> [Int] -> f (RouteState a) | |
mkFreshRoute url@(URL v) f = \case | |
[] -> Terminal . RouteEnd . (url,) <$> f Nothing | |
(ix : ixes) -> let next = mkFreshRoute url f ixes in | |
NonTerminal Nothing <$> case v V.! ix of | |
Capture _ -> This . WildcardLink <$> next | |
NonCapture lit -> That . LiteralLink . HM.singleton lit <$> next |
treblacy
commented
Jan 7, 2021
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment