[Haskell-cafe] Downsides of the Prompt Monad
esz at posteo.de
Thu Apr 6 16:18:41 UTC 2017
> Could someone outline for me the downsides of using the Prompt monad?
For one thing I find its definition to be overcomplicated for what it
does. For another the same can be achieved with free monads in a more
transparent and flexible manner:
data PromptF a b x = PromptF (b -> x) a
prompt :: (MonadFree (PromptF a b) m) => a -> m b
prompt = liftF . PromptF id
Now the kinds of extra effects that you allow depends on which free
monad implementation you use. If you use F, you get the equivalent of
Prompt, if you use FT, you get PromptT. In the F case the iter function
corresponds to runPrompt, iterM corresponds to runPromptM. In the FT
case there are iterT and iterTM.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 487 bytes
Desc: not available
More information about the Haskell-Cafe