madlang 3.1.0.2 → 3.1.0.5
raw patch · 2 files changed
+4/−15 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- madlang.cabal +1/−1
- src/Text/Madlibs/Ana/ParseUtils.hs +3/−14
madlang.cabal view
@@ -1,5 +1,5 @@ name: madlang-version: 3.1.0.2+version: 3.1.0.5 synopsis: Randomized templating language DSL description: Madlang is a text templating language written in Haskell, meant to explore computational creativity and generative
src/Text/Madlibs/Ana/ParseUtils.hs view
@@ -26,6 +26,7 @@ import Text.Madlibs.Cata.SemErr import Text.Madlibs.Internal.Types import Text.Madlibs.Internal.Utils+import Debug.Trace -- | A map with all the modifiers for Madlang modifierList :: M.Map String (T.Text -> T.Text)@@ -103,11 +104,6 @@ orderHelper :: Key -> [(Prob, [PreTok])] -> Bool orderHelper key = any (\pair -> key /= "" && key `elem` (map unTok . snd $ pair)) -hasNoDeps :: [(Prob, [PreTok])] -> Bool-hasNoDeps = all isPreTok . (>>= snd)- where isPreTok PreTok{} = True- isPreTok _ = False- maybeList :: Maybe [a] -> [a] maybeList (Just x) = x maybeList Nothing = []@@ -125,13 +121,6 @@ | key2 == "Return" = LT | orderHelper key1 l2 = LT | orderHelper key2 l1 = GT- | any (flip orderHelper l1) (flatten l2) = LT- | any (flip orderHelper l2) (flatten l1) = GT- | hasNoDeps l1 = LT- | hasNoDeps l2 = GT- | key2 `elem` allDeps context key1 = LT- | key1 `elem` allDeps context key2 = GT+ | key2 `elem` (traceShow (key1, key2, GT) $ allDeps context key1) = GT+ | key1 `elem` (traceShow (key1, key2, LT) $ allDeps context key2) = LT | otherwise = EQ--flatten :: [(Prob, [PreTok])] -> [Key]-flatten = (>>= (fmap unTok . snd))