aboutsummaryrefslogtreecommitdiff
path: root/source/lux/codata/state.lux
diff options
context:
space:
mode:
Diffstat (limited to 'source/lux/codata/state.lux')
-rw-r--r--source/lux/codata/state.lux39
1 files changed, 0 insertions, 39 deletions
diff --git a/source/lux/codata/state.lux b/source/lux/codata/state.lux
deleted file mode 100644
index 311fce320..000000000
--- a/source/lux/codata/state.lux
+++ /dev/null
@@ -1,39 +0,0 @@
-## Copyright (c) Eduardo Julian. All rights reserved.
-## This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
-## If a copy of the MPL was not distributed with this file,
-## You can obtain one at http://mozilla.org/MPL/2.0/.
-
-(;import lux
- (lux/control (functor #as F #refer #all)
- (monad #as M #refer #all)))
-
-## [Types]
-(deftype #export (State s a)
- (-> s (, s a)))
-
-## [Structures]
-(defstruct #export State/Functor (All [s]
- (Functor (State s)))
- (def (map f ma)
- (lambda [state]
- (let [[state' a] (ma state)]
- [state' (f a)]))))
-
-(defstruct #export State/Monad (All [s]
- (Monad (State s)))
- (def _functor State/Functor)
-
- (def (wrap a)
- (lambda [state]
- [state a]))
-
- (def (join mma)
- (lambda [state]
- (let [[state' ma] (mma state)]
- (ma state')))))
-
-## [Functions]
-(def #export (run-state state action)
- (All [s a] (-> s (State s a) a))
- (let [[state' output] (action state)]
- output))