# Polysemy: Final vs Embed

Gautier DI FOLCO February 01, 2023 [Haskell] #haskell #polysemy #design #effects systemsIn a previous log, we introduce `Final`

as an alternative to `Embed`

.

If we look at the intents:

`Embed`

aims to lift any`Monad`

to`Sem`

`Final`

aims to embed higher-order actions in the effects stack

Each of them come with an interpreter allowing to interpret an effect into other effects of the same type.

Let's start with `Embed`

.

This is pretty straightforward: for two embedded `Monad`

, we have to provide a function to convert the first one into the second one.

Now, we can have a look at `Final`

' equivalent:

A bit more complex: we have to provide two functions to go back and forth between the two Monads.

It's actually due to a property highlight in `Final`

's documentation:

Beware: Final actions are interpreted as actions of the final monad, [..] This means that any interpreter built using Final will not respect local/global state semantics based on the order of interpreters run.