mirror of
https://github.com/ilyakooo0/Idris-dev.git
synced 2024-11-15 01:25:05 +03:00
5ea6aa0520
The changes are as follows: + `print` is for putting showable things to STDOUT. + `printLn` is for putting showable things to STDOUT with a new line + `putCharLn` for putting a single character to STDOUT, with a new line. Effects has been updated accordingly.
18 lines
307 B
Idris
18 lines
307 B
Idris
module Main
|
|
|
|
%default total
|
|
|
|
codata Stream' a = Nil | (::) a (Stream' a)
|
|
|
|
countFrom : Int -> Stream' Int
|
|
countFrom x = x :: countFrom (x + 1)
|
|
|
|
take : Nat -> Stream' a -> List a
|
|
take Z _ = []
|
|
take (S n) (x :: xs) = x :: take n xs
|
|
take n [] = []
|
|
|
|
main : IO ()
|
|
main = do printLn (take 10 (Main.countFrom 10))
|
|
|