Skip to content

Commit

Permalink
fix the other packages not compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
bristermitten committed Jun 11, 2024
1 parent 6150f7d commit e5c6aed
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions templatespiler-generator/src/Templatespiler/Generate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ arbitraryCombinator (ArrayCombinator count g) =
join
<$> Gen.list
(Range.singleton count)
(arbitraryType g)
(arbitraryBindingOrCombinator g)
arbitraryCombinator (SepByCombinator sep bs) = do
bs' <- arbitraryInput bs
pure [Text.intercalate sep bs']
arbitraryCombinator (ListCombinator g) = do
i <- Gen.int (Range.linear 1 10)
outputs <- join <$> Gen.list (Range.singleton i) (arbitraryType g)
outputs <- join <$> Gen.list (Range.singleton i) (arbitraryBindingOrCombinator g)
pure ([show i] <> outputs)
arbitraryCombinator (GroupCombinator bs) = arbitraryInput bs

Expand All @@ -42,6 +42,11 @@ arbitraryType :: Type -> Gen [Text]
arbitraryType (TerminalType t) = arbitraryTerminalType t
arbitraryType (CombinatorType c) = arbitraryCombinator c

arbitraryBindingOrCombinator :: BindingOrCombinator -> Gen [Text]
arbitraryBindingOrCombinator (NamedBinding b) = arbitraryBinding b
arbitraryBindingOrCombinator (GroupBinding bs) = arbitraryInput bs
arbitraryBindingOrCombinator (UnnamedBinding c) = arbitraryCombinator c

arbitraryTerminalType :: TerminalType -> Gen [Text]
arbitraryTerminalType IntType = pure . show <$> arbitrarySaneInt
arbitraryTerminalType StringType = pure . toText <$> Gen.string (Range.linear 1 20) Gen.alphaNum
Expand Down

0 comments on commit e5c6aed

Please sign in to comment.