return

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"]
Return a result. * result: The variable or constant to return
Return result(s) to continuation found on the stack.
Transfers accumulation buffer values to the color buffer or buffers currently selected for writing. Each R, G, B, and A component is multiplied by the value given to accum, then multiplied by 2^n-1, clamped to the range [0, 2^n-1], and stored in the corresponding display buffer cell. The only fragment operations that are applied to this transfer are pixel ownership, scissor, dithering, and color writemasks.
A method response returning a value
A return or pure action was executed.