-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HDBC DomainAPI #40
base: master
Are you sure you want to change the base?
HDBC DomainAPI #40
Conversation
@jfoutz unable to compile your code because of the missing cabal file. Did you forget to commit? |
Yes. Added and pushed. This should cover the DomainAPI only, i'll have another update for design goals tomorrow. (at least some of the design goals will move to the next sprint.) |
mkData6 f (x1:x2:x3:x4:x5:x6:[]) = Just $ f (fromSql x1) (fromSql x2) (fromSql x3) (fromSql x4) (fromSql x5) (fromSql x6) | ||
mkData9 f (x1:x2:x3:x4:x5:x6:x7:x8:x9:[]) = Just $ f (fromSql x1) (fromSql x2) (fromSql x3) (fromSql x4) (fromSql x5) (fromSql x6) (fromSql x7) (fromSql x8) (fromSql x9) | ||
mkData9 _ _ = Nothing | ||
mkData11 f (x1:x2:x3:x4:x5:x6:x7:x8:x9:x10:x11:[]) = Just $ f (fromSql x1) (fromSql x2) (fromSql x3) (fromSql x4) (fromSql x5) (fromSql x6) (fromSql x7) (fromSql x8) (fromSql x9) (fromSql x10) (fromSql x11) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any way to write these functions so that they work with lists of exactly N elements? Does HDBC have functions which return fixed sized tuples instead of lists?
_ -> Nothing | ||
|
||
createTenant :: Connection -> Tenant -> IO (Maybe Int) | ||
createTenant conn (Tenant _ created updated name first last email phone status owner backoffice) = do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't using the record constructor a much safer way of pattern matching this? It protects against change in position of fields.
I'm interested in DomainAPI and Types
I think maybe each primitive type in Tenant and User should become a type alias, and the "create" versions should take typed arguments rather than a tennant or a user. I don't think ignoring arguments is bad but it's not great.