monads - Combine scalacheck Gen with Future In Scala -


basically trying make generators result of http requests, due end types gen[eithert[future, error, t]].

the problem there doesn't appear monadic instances (so can sequence, or monad transformers) let me compose different instances of gen[eithert[future, error, t]]

as example, suppose have following functions

def genuser: gen[eithert[future, error, user]]

and

def genaccounts(user: user): gen[eithert[future, error, list[account]]

the idea able compose gen[eithert[future, error,t] types, genaccounts calls genuser, i.e. like

def genaccounts(user: user): gen[eithert[future, error, list[account]] = { user <- genuser accounts <- genaccounts(user) } yield accounts

also scalacheck gen provide way lift future gen (i.e. way go gen[future[t]] gen[t]). if blocking, not huge issue if happens once when generate final gen property


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -