return is:exact

Inject a value into the monadic type. This function should not be different from its default implementation as pure. The justification for the existence of this function is merely historic.
Inject a value into the monadic type.
This is monomorphic in the category Hask, thus exactly the same as return from the standard prelude. This allows writing expressions like return $ case x of ..., which would always be ambiguous with the more general signature Monad m k => k a (m a). Use pure when you want to "return" in categories other than (->); this always works since Applicative is a superclass of Monad.
Redefinition of return
Like return, but pick a name of the single frequency.
Lift r to the answer type, similar to return. This return function aims to be used as the last statement of a do block. When return is present in a nested do block for when or unless, if the r' is not (), it will create a Cont that performs early return, skipping the rest statements of the outer do notation.

Examples

>>> :set -XTypeOperators

>>> :set -XRebindableSyntax

>>> import Prelude hiding ((>>), (>>=), return, fail)

>>> import Control.Dsl

>>> import Control.Dsl.Return

>>> import Control.Dsl.Yield

>>> import Control.Dsl.Cont

>>> import Control.Dsl.Empty
>>> :{
earlyGenerator :: Bool -> Cont [String] Integer
earlyGenerator earlyReturn = do
Yield "inside earlyGenerator"
when earlyReturn $ do
Yield "early return"
return 1
Yield "normal return"
return 0
:}
>>> :{
earlyGeneratorTest :: [String]
earlyGeneratorTest = do
Yield "before earlyGenerator"
i <- earlyGenerator True
Yield "after earlyGenerator"
Yield $ "the return value of earlyGenerator is " ++ show i
empty
:}
>>> earlyGeneratorTest
["before earlyGenerator","inside earlyGenerator","early return","after earlyGenerator","the return value of earlyGenerator is 1"]