elf*_*elf 1 haskell quickcheck
我正在学习quickcheck(和haskell),我有de bellow代码:
newtype Urls = FN { unFN :: String } deriving Show
instance Arbitrary Urls where
arbitrary = do protocol <- elements ["http://"]
name <- listOf $ elements ['a'..'z']
domain <- elements [".com",".com.br",".net"]
return (FN (protocol ++ name ++ domain))
Run Code Online (Sandbox Code Playgroud)
我的问题是关于我如何使listOf永远不会返回空(NonEmpty),因为现在对于生成的一些数据我收到像{unFN ="http://.net"}这样的字符串,简化了我希望该名称永远不会为空
| 归档时间: |
|
| 查看次数: |
740 次 |
| 最近记录: |