mirror of
https://github.com/edwinb/Idris2-boot.git
synced 2024-12-02 22:43:14 +03:00
0a15c2cda1
Name lookup and search should ignore names which aren't visible (that is, private names in another namespace)
27 lines
632 B
Plaintext
27 lines
632 B
Plaintext
data Nat : Type where
|
|
Z : Nat
|
|
S : Nat -> Nat
|
|
|
|
namespace Stream
|
|
public export
|
|
data Stream : Type -> Type where
|
|
Cons : $a -> Inf (Stream $a) -> Stream $a
|
|
|
|
ones : Stream Integer
|
|
ones = Cons 1 ones
|
|
|
|
countFrom : Integer -> Stream Integer
|
|
countFrom $x = Cons x (countFrom (prim__add_Integer 1 x))
|
|
|
|
data List : Type -> Type where
|
|
Nil : List $a
|
|
Cons : $a -> List $a -> List $ a
|
|
|
|
take : Nat -> Stream $a -> List $a
|
|
take Z $xs = Nil
|
|
take (S $k) (Cons $x $xs) = Cons x (take k xs)
|
|
|
|
every2nd : Nat -> Stream $a -> List $a
|
|
every2nd Z $xs = Nil
|
|
every2nd (S $k) (Cons _ (Cons $x $xs)) = Cons x (every2nd k xs)
|