aboutsummaryrefslogtreecommitdiff
path: root/source/lux/data/id.lux
diff options
context:
space:
mode:
Diffstat (limited to 'source/lux/data/id.lux')
-rw-r--r--source/lux/data/id.lux33
1 files changed, 16 insertions, 17 deletions
diff --git a/source/lux/data/id.lux b/source/lux/data/id.lux
index 0e3bdbee6..e4f2a775f 100644
--- a/source/lux/data/id.lux
+++ b/source/lux/data/id.lux
@@ -1,28 +1,27 @@
-## Copyright (c) Eduardo Julian. All rights reserved.
-## The use and distribution terms for this software are covered by the
-## Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-## which can be found in the file epl-v10.html at the root of this distribution.
-## By using this software in any fashion, you are agreeing to be bound by
-## the terms of this license.
-## You must not remove this notice, or any other, from this software.
+## 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)))
+ (monad #as M #refer #all)
+ (comonad #as CM #refer #all)))
## [Types]
(deftype #export (Id a)
- (| (#Id a)))
+ a)
## [Structures]
(defstruct #export Id/Functor (Functor Id)
- (def (F;map f fa)
- (let [(#Id a) fa]
- (#Id (f a)))))
+ (def map id))
(defstruct #export Id/Monad (Monad Id)
- (def M;_functor Id/Functor)
- (def (M;wrap a) (#Id a))
- (def (M;join mma)
- (let [(#Id ma) mma]
- ma)))
+ (def _functor Id/Functor)
+ (def wrap id)
+ (def join id))
+
+(defstruct #export Id/CoMonad (CoMonad Id)
+ (def _functor Id/Functor)
+ (def unwrap id)
+ (def split id))