Hexagonal architecture like monads in FP

Jan Filipowski
Jan Filipowski blog
1 min readMay 24, 2017

Do you know what the monad in functional programming is? Yeah, me neither. But I know it’s being used to hide out side effects from purely functional code. So — if you want to do IO — you use monad. I wanted to add other example, but what other kinds of side effects can you talk about which are not IO?

Monads are pure functions applied in other pure functions. Whole program defines new language without providing implementation details — unless you fill in monads with real behaviour with side effect. Functions have their signatures / interfaces.

Ok, so let’s jump to OOP world. With hexagonal architecture you focus on domain model — everything else is defined by the interface and implementation of that interface. But implementation is fluid — you should be able to inject it (with DI container or by changing few lines of code). So here domain logic also defines new language, with entry points for side-effect details.

--

--