Some Fun - Sickness of using Java Builder in Functional Programming — Solved

Problem — Well, not exactly, but anyways!

Assume you have 2 optional parameters: Maybe(firstName), Maybe(lastName) You want to instantiate (or build an instance of) Name class which is possibly written in Java with these parameters, if they exist (ie; Maybe.Just, or Option.Some).

A Solution - State Monad

If you don’t know State..

You can see some of my code scribblings on State data-type (without scalaz) in the following links. You may read them in its order. The comments in code may give you some idea on what is state data type. That will make you feel comfortable with some notes in scalaz tutorial (Google).

--

--

A software engineer and a functional programming enthusiast at Simple-machines, Sydney, and a hardcore hiking fan. https://twitter.com/afsalt2

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Afsal Thaj

Afsal Thaj

A software engineer and a functional programming enthusiast at Simple-machines, Sydney, and a hardcore hiking fan. https://twitter.com/afsalt2