diff options
Diffstat (limited to 'stdlib/source/lux/data/store.lux')
-rw-r--r-- | stdlib/source/lux/data/store.lux | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/stdlib/source/lux/data/store.lux b/stdlib/source/lux/data/store.lux deleted file mode 100644 index 52842eac9..000000000 --- a/stdlib/source/lux/data/store.lux +++ /dev/null @@ -1,49 +0,0 @@ -(.module: - [lux #* - [abstract - [functor (#+ Functor)] - comonad] - [type - implicit]]) - -(type: #export (Store s a) - {#cursor s - #peek (-> s a)}) - -(def: (extend f wa) - (All [s a b] (-> (-> (Store s a) b) (Store s a) (Store s b))) - {#cursor (get@ #cursor wa) - #peek (function (_ s) (f (set@ #cursor s wa)))}) - -(implementation: #export functor - (All [s] (Functor (Store s))) - - (def: (map f fa) - (extend (function (_ store) - (f (\ store peek (\ store cursor)))) - fa))) - -(implementation: #export comonad - (All [s] (CoMonad (Store s))) - - (def: &functor ..functor) - - (def: (unwrap wa) (\\ peek (\\ cursor))) - - (def: split (extend id))) - -(def: #export (peeks trans store) - (All [s a] (-> (-> s s) (Store s a) a)) - (|> (\\ cursor) trans (\\ peek))) - -(def: #export (seek cursor store) - (All [s a] (-> s (Store s a) (Store s a))) - (\ (\\ split store) peek cursor)) - -(def: #export (seeks change store) - (All [s a] (-> (-> s s) (Store s a) (Store s a))) - (|> store (\\ split) (peeks change))) - -(def: #export (experiment Functor<f> change store) - (All [f s a] (-> (Functor f) (-> s (f s)) (Store s a) (f a))) - (\ Functor<f> map (\\ peek) (change (\\ cursor)))) |