aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data/collection/sequence.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/data/collection/sequence.lux13
1 files changed, 4 insertions, 9 deletions
diff --git a/stdlib/source/lux/data/collection/sequence.lux b/stdlib/source/lux/data/collection/sequence.lux
index 06209f4d6..30b2bf46e 100644
--- a/stdlib/source/lux/data/collection/sequence.lux
+++ b/stdlib/source/lux/data/collection/sequence.lux
@@ -12,14 +12,12 @@
[data
bit
[collection
- [list ("list/." Monad<List>)]]]])
+ [list ("list/." monad)]]]])
-## [Types]
(type: #export (Sequence a)
{#.doc "An infinite sequence of values."}
(Cont [a (Sequence a)]))
-## [Utils]
(def: (cycle' x xs init full)
(All [a]
(-> a (List a) a (List a) (Sequence a)))
@@ -27,7 +25,6 @@
#.Nil (pending [x (cycle' init full init full)])
(#.Cons x' xs') (pending [x (cycle' x' xs' init full)])))
-## [Functions]
(def: #export (iterate f x)
{#.doc "Create a sequence by applying a function to a value, and to its result, on and on..."}
(All [a]
@@ -116,20 +113,18 @@
(All [a] (-> (-> a Bit) (Sequence a) [(Sequence a) (Sequence a)]))
[(filter p xs) (filter (complement p) xs)])
-## [Structures]
-(structure: #export _ (Functor Sequence)
+(structure: #export functor (Functor Sequence)
(def: (map f fa)
(let [[h t] (continuation.run fa)]
(pending [(f h) (map f t)]))))
-(structure: #export _ (CoMonad Sequence)
- (def: functor Functor<Sequence>)
+(structure: #export comonad (CoMonad Sequence)
+ (def: &functor ..functor)
(def: unwrap head)
(def: (split wa)
(let [[head tail] (continuation.run wa)]
(pending [wa (split tail)]))))
-## [Pattern-matching]
(syntax: #export (^sequence& {patterns (s.form (p.many s.any))}
body
{branches (p.some s.any)})