mirror of
https://github.com/github/semantic.git
synced 2024-12-25 07:55:12 +03:00
Use the Applicative instance to generate BranchElements.
This commit is contained in:
parent
ea79ce4f04
commit
5d9de67ecc
@ -206,7 +206,7 @@ instance Arbitrary BranchElement where
|
||||
arbitrary = oneof [ Child <$> key <*> joinTheseOf contents
|
||||
, Margin <$> joinTheseOf margin ]
|
||||
where key = listOf1 (elements (['a'..'z'] ++ ['A'..'Z'] ++ ['0'..'9']))
|
||||
contents = key >>= \ key -> wrap key <$> listOf (padding '*')
|
||||
contents = wrap <$> key <*> listOf (padding '*')
|
||||
wrap key contents = "(" ++ key ++ contents ++ ")" :: String
|
||||
margin = listOf (padding '-')
|
||||
padding char = frequency [ (10, pure char)
|
||||
|
Loading…
Reference in New Issue
Block a user