Skip to content

Instantly share code, notes, and snippets.

@etorreborre
Created May 12, 2019 09:44
Show Gist options
  • Select an option

  • Save etorreborre/e04bc023a906fe15ce67ff02ed49b86d to your computer and use it in GitHub Desktop.

Select an option

Save etorreborre/e04bc023a906fe15ce67ff02ed49b86d to your computer and use it in GitHub Desktop.
company-generators-1.hs
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