on master help sign in
Updated remaining use of deprecated `return` in Docs to `pure`.
commit43e7ec9c6b7466fd401bef0b36c094e64ef26945 authorJan de Muijnck-Hughes <jfdm@st-andrews.ac.uk> dateFri 30 Sep 2016, 09:37 (10 years ago) parent508f4a6
6 files changed+11−11
docs/effects/simpleeff.rst+4−4 docs/guides/type-providers-ffi.rst+2−2 docs/reference/ffi.rst+1−1 docs/reference/uniqueness-types.rst+1−1 docs/tutorial/interfaces.rst+1−1 docs/tutorial/typesfuns.rst+2−2
docs/effects/simpleeff.rst+4−4
@@ -495,8 +495,8 @@ values:
495495 Env = List (String, Integer)
496496
497497 eval : Expr -> Eff Integer [EXCEPTION String, STATE Env]
498− eval (Val x) = return x
499− eval (Add l r) = return $ !(eval l) + !(eval r)
498+ eval (Val x) = pure x
499+ eval (Add l r) = pure $ !(eval l) + !(eval r)
500500
501501Note that we are using ``!``-notation to avoid having to bind
502502subexpressions in a ``do`` block. Next, we add a case for evaluating
@@ -506,7 +506,7 @@ subexpressions in a ``do`` block. Next, we add a case for evaluating
506506
507507 eval (Var x) = case lookup x !get of
508508 Nothing => raise $ "No such variable " ++ x
509− Just val => return val
509+ Just val => pure val
510510
511511This retrieves the state (with ``get``, supported by the ``STATE Env``
512512effect) and raises an exception if the variable is not in the
@@ -559,7 +559,7 @@ has been generated:
559559
560560 eval (Random upper) = do val <- rndInt 0 upper
561561 putStrLn (show val)
562− return val
562+ pure val
563563
564564If we try this without extending the effects list, we would see an
565565error something like the following:
docs/guides/type-providers-ffi.rst+2−2
@@ -53,8 +53,8 @@ actions. Let's write a simple one now:
5353 putStrLn "I'm sorry, I don't know how big size_t is. Can you tell me, in bytes?"
5454 resp <- getLine
5555 case readInt resp of
56− Just sizeTSize => return (Provide sizeTSize)
57− Nothing => return (Error "I'm sorry, I don't understand.")
56+ Just sizeTSize => pure (Provide sizeTSize)
57+ Nothing => pure (Error "I'm sorry, I don't understand.")
5858 -- the readInt function is left as an exercise
5959
6060We assume that whoever's compiling the library knows the size of
docs/reference/ffi.rst+1−1
@@ -361,4 +361,4 @@ timeouts:
361361 timeout <- jscall "setTimeout(%0, %1)"
362362 (JsFn (() -> JS_IO ()) -> Int -> JS_IO Ptr)
363363 (MkJsFn f) millis
364− return $ MkTimeout timeout
364+ pure $ MkTimeout timeout
docs/reference/uniqueness-types.rst+1−1
@@ -212,7 +212,7 @@ the following sort of bad program being implemented:
212212 foo xs = do let f = \x : Int => showU xs
213213 putStrLn $ free xs
214214 putStrLn $ f 42
215− return ()
215+ pure ()
216216
217217Since ``lend`` is implicit, in practice for functions to lend and borrow
218218values merely requires the argument to be marked as ``Borrowed``. We can
docs/tutorial/interfaces.rst+1−1
@@ -388,7 +388,7 @@ Then the comprehension is converted to ``do`` notation:
388388
389389.. code-block:: idris
390390
391− do { qual1; qual2; ...; qualn; return exp; }
391+ do { qual1; qual2; ...; qualn; pure exp; }
392392
393393Using monad comprehensions, an alternative definition for ``m_add``
394394would be:
docs/tutorial/typesfuns.rst+2−2
@@ -635,12 +635,12 @@ The syntax ``x <- iovalue`` executes the I/O operation ``iovalue``, of
635635type ``IO a``, and puts the result, of type ``a`` into the variable
636636``x``. In this case, ``getLine`` returns an ``IO String``, so ``name``
637637has type ``String``. Indentation is significant — each statement in
638−the do block must begin in the same column. The ``return`` operation
638+the do block must begin in the same column. The ``pure`` operation
639639allows us to inject a value directly into an IO operation:
640640
641641.. code-block:: idris
642642
643− return : a -> IO a
643+ pure : a -> IO a
644644
645645As we will see later, ``do`` notation is more general than this, and
646646can be overloaded.