Skip to content

Instantly share code, notes, and snippets.

@etorreborre
Last active May 12, 2019 10:26
Show Gist options
  • Select an option

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

Select an option

Save etorreborre/386e7164c161d94d918bf68dc20e24c0 to your computer and use it in GitHub Desktop.
override-department-names
-- short and upper cased names
genDepartmentName = T.take 5 . T.toUpper <$> genText
registry' =
specializeGen @Department genDepartmentName
registry
-- we get specific department names
λ> fmap departmentName <$> (replicateM 5 $ sampleIO (make @(GenIO Department) registry'))
["CE","UNZ","FG","V","HIB"]
-- but company names are more random
λ> fmap companyName <$> (replicateM 5 $ sampleIO (make @(GenIO Company) registry'))
["ZgX","cI","nNY","muP","e"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment