diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/data/store.lux | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/stdlib/source/library/lux/data/store.lux b/stdlib/source/library/lux/data/store.lux index c5b82a4c5..8e4c0746d 100644 --- a/stdlib/source/library/lux/data/store.lux +++ b/stdlib/source/library/lux/data/store.lux @@ -12,43 +12,43 @@ [#cursor s #peek (-> s a)])) -(def: (extend f wa) +(def (extend f wa) (All (_ s a b) (-> (-> (Store s a) b) (Store s a) (Store s b))) [#cursor (the #cursor wa) #peek (function (_ s) (f (has #cursor s wa)))]) -(def: .public functor +(def .public functor (All (_ s) (Functor (Store s))) (implementation - (def: (each f fa) + (def (each f fa) (extend (function (_ store) (f (at store peek (at store cursor)))) fa)))) -(def: .public comonad +(def .public comonad (All (_ s) (CoMonad (Store s))) (implementation - (def: functor + (def functor ..functor) - (def: (out wa) + (def (out wa) (a/an peek (a/an cursor))) - (def: disjoint + (def disjoint (extend id)))) -(def: .public (peeks trans store) +(def .public (peeks trans store) (All (_ s a) (-> (-> s s) (Store s a) a)) (|> (a/an cursor) trans (a/an peek))) -(def: .public (seek cursor store) +(def .public (seek cursor store) (All (_ s a) (-> s (Store s a) (Store s a))) (at (a/an disjoint store) peek cursor)) -(def: .public (seeks change store) +(def .public (seeks change store) (All (_ s a) (-> (-> s s) (Store s a) (Store s a))) (|> store (a/an disjoint) (peeks change))) -(def: .public (experiment Functor<f> change store) +(def .public (experiment Functor<f> change store) (All (_ f s a) (-> (Functor f) (-> s (f s)) (Store s a) (f a))) (at Functor<f> each (a/an peek) (change (a/an cursor)))) |