Effect CommunityEC
Effect Community3y ago
26 replies
Joshua

Modeling a Usecase: Retrieving Users and Additional Information

How do I implement the following usecase, I want to get a list of users which will never fail. Then get a single user from the fetched users if a user ID is provided and then go get some other information for the found user.

I have Effect<never, never, User[]>, Option<userId> then find user in User[] if Some<userId> which means Option<User>. If Some<User> get additional user information.

So I end up with a list of users, maybe the user also and maybe the additional user info.

{users: User[], user: User | null, userInfo: Info | null}
Was this page helpful?