Created
May 12, 2019 09:44
-
-
Save etorreborre/e04bc023a906fe15ce67ff02ed49b86d to your computer and use it in GitHub Desktop.
company-generators-1.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Data.Registry | |
| import Data.Registry.Hedgehog | |
| import Hedgehog.Gen | |
| import Hedgehog.Range | |
| import Protolude hiding (list) | |
| import Test.Data.Registry.Company | |
| registry = | |
| genFun Company | |
| <: genFun Department | |
| <: genFun Employee | |
| -- we can generate Lists or Maybe of elements | |
| <: fun (listOf @Department) | |
| <: fun (listOf @Employee) | |
| <: fun (maybeOf @Int) | |
| <: genVal genInt | |
| <: genVal genText | |
| genInt :: Gen Int | |
| genInt = integral (linear 1 3) | |
| genText :: Gen Text | |
| genText = text (linear 1 10) alpha | |
| myCompanyGen :: GenIO Company | |
| myCompanyGen = make registry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment