From 043d3083fac21942de83d06780d9335a1cc54d4c Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 22 Jul 2019 15:26:02 -0400 Subject: [PATCH] Generate records. --- semantic-core/test/Generators.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/semantic-core/test/Generators.hs b/semantic-core/test/Generators.hs index f82e65f8b..a1c235223 100644 --- a/semantic-core/test/Generators.hs +++ b/semantic-core/test/Generators.hs @@ -6,6 +6,7 @@ module Generators , variable , boolean , lambda + , record , apply , ifthenelse ) where @@ -50,8 +51,11 @@ lambda bod = do arg <- name Gen.subterm bod (Core.lam arg) +record :: MonadGen m => m (Term Core.Core User) -> m (Term Core.Core User) +record bod = Core.record <$> Gen.list (Range.linear 0 5) ((,) . namedValue <$> name <*> bod) + atoms :: MonadGen m => [m (Term Core.Core User)] atoms = [boolean, variable, pure Core.unit] literal :: MonadGen m => m (Term Core.Core User) -literal = Gen.recursive Gen.choice atoms [lambda literal] +literal = Gen.recursive Gen.choice atoms [lambda literal, record literal]