summaryrefslogtreecommitdiff
path: root/examples/passing/TCO.purs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/passing/TCO.purs')
-rw-r--r--examples/passing/TCO.purs8
1 files changed, 8 insertions, 0 deletions
diff --git a/examples/passing/TCO.purs b/examples/passing/TCO.purs
index dc55311..fbd9951 100644
--- a/examples/passing/TCO.purs
+++ b/examples/passing/TCO.purs
@@ -2,6 +2,8 @@ module Main where
import Prelude
import Control.Monad.Eff.Console (log, logShow)
+import Control.Monad.Rec.Class
+import Data.Array ((..), span, length)
main = do
let f x = x + 1
@@ -11,6 +13,12 @@ main = do
logShow (applyN 2 f v)
logShow (applyN 3 f v)
logShow (applyN 4 f v)
+
+ let largeArray = 1..10000
+ logShow (length (span (\_ -> true) largeArray).init)
+
+ logShow (tailRec (\n -> if n < 10000 then Loop (n + 1) else Done 42) 0)
+
log "Done"
applyN :: forall a. Int -> (a -> a) -> a -> a