diff options
Diffstat (limited to 'source/lux/data/maybe.lux')
-rw-r--r-- | source/lux/data/maybe.lux | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/source/lux/data/maybe.lux b/source/lux/data/maybe.lux deleted file mode 100644 index 1303270a7..000000000 --- a/source/lux/data/maybe.lux +++ /dev/null @@ -1,46 +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 (monoid #as m #refer #all) - (functor #as F #refer #all) - (monad #as M #refer #all)))) - -## [Types] -## (deftype (Maybe a) -## (| #;None -## (#;Some a))) - -## [Structures] -(defstruct #export Maybe/Monoid (All [a] (Monoid (Maybe a))) - (def unit #;None) - (def (++ xs ys) - (case xs - #;None ys - (#;Some x) (#;Some x)))) - -(defstruct #export Maybe/Functor (Functor Maybe) - (def (map f ma) - (case ma - #;None #;None - (#;Some a) (#;Some (f a))))) - -(defstruct #export Maybe/Monad (Monad Maybe) - (def _functor Maybe/Functor) - - (def (wrap x) - (#;Some x)) - - (def (join mma) - (case mma - #;None #;None - (#;Some xs) xs))) - -## [Functions] -(def #export (? else maybe) - (All [a] (-> a (Maybe a) a)) - (case maybe - (#;Some x) x - _ else)) |