Skip to content

Conversation

@aaronlevin
Copy link

Just playing around. I don't quite understand how the for comprehension gets unwrapped so I created a trivial example that combines various ConfigReader functions and used only map and flatMap.

Mostly just an exercise.

An example of composing functions relying on various ConfigReader instances without using for comprehension.

An example of composing functions relying on various `ConfigReader` instances without using for comprehension.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not unless a DBConnection implements map.

You can use plain "=" in a for comprehension though. e.g.

for {
  hello2String <- sayHello2
  dbHost <- dbHostReader
  dbConnection = new DBConnection(dbHost)
} yield (hello2String + getFromDb(dbConnection)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants