Tiny refactors to make Hedgehog code look incer
Getty Ritter
7 years ago
56 | 56 | valueToPair (name, value) = (T.toLower name, T.strip (I2.vValue value)) |
57 | 57 | conv = HM.fromList . Fold.toList |
58 | 58 | |
59 |
textChunk :: Monad m => Gen |
|
59 | textChunk :: Monad m => Gen m Text | |
60 | 60 | textChunk = fmap T.pack $ Gen.list (Range.linear 1 20) $ Gen.alphaNum |
61 | 61 | |
62 |
mkIni :: Monad m => Gen |
|
62 | mkIni :: Monad m => Gen m I1.Ini | |
63 | 63 | mkIni = do |
64 | 64 | ss <- Gen.list (Range.linear 0 10) $ do |
65 | 65 | name <- textChunk |
68 | 68 | return (name, HM.fromList section) |
69 | 69 | return (I1.Ini (HM.fromList ss)) |
70 | 70 | |
71 |
mkComments :: Monad m => Gen |
|
71 | mkComments :: Monad m => Gen m (Seq.Seq I2.BlankLine) | |
72 | 72 | mkComments = fmap (Seq.fromList . nub) $ Gen.list (Range.linear 0 5) $ |
73 | 73 | Gen.choice |
74 | 74 | [ return I2.BlankLine |
75 | 75 | , I2.CommentLine <$> Gen.element ";#" <*> textChunk |
76 | 76 | ] |
77 | 77 | |
78 |
mkRichIni :: Monad m => Gen |
|
78 | mkRichIni :: Monad m => Gen m I2.Ini | |
79 | 79 | mkRichIni = do |
80 | 80 | ss <- Gen.list (Range.linear 0 10) $ do |
81 | 81 | name <- textChunk |