mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
Generate records.
This commit is contained in:
parent
52da8b764c
commit
043d3083fa
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user