From fb906f2d28ea77b985c8cd1abbd37d6ab7dee346 Mon Sep 17 00:00:00 2001 From: Jan Mas Rovira Date: Fri, 2 Aug 2024 18:54:45 +0200 Subject: [PATCH] add Monad --- Stdlib/Trait.juvix | 1 + Stdlib/Trait/Monad.juvix | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 Stdlib/Trait/Monad.juvix diff --git a/Stdlib/Trait.juvix b/Stdlib/Trait.juvix index 8e3a99aa..c255fc1f 100644 --- a/Stdlib/Trait.juvix +++ b/Stdlib/Trait.juvix @@ -5,6 +5,7 @@ import Stdlib.Trait.Show as Show open using {Show; module Show} public; import Stdlib.Trait.Ord as Ord open using {Ord; module Ord} public; import Stdlib.Trait.Functor open public; import Stdlib.Trait.Applicative open public; +import Stdlib.Trait.Monad open public; import Stdlib.Trait.Foldable open public; import Stdlib.Trait.Partial open public; import Stdlib.Trait.Natural open public; diff --git a/Stdlib/Trait/Monad.juvix b/Stdlib/Trait/Monad.juvix new file mode 100644 index 00000000..a1dff9e8 --- /dev/null +++ b/Stdlib/Trait/Monad.juvix @@ -0,0 +1,21 @@ +module Stdlib.Trait.Monad; + +import Stdlib.Data.Fixity open; +import Stdlib.Function open; +import Stdlib.Data.Bool.Base open; +import Stdlib.Data.Nat.Base open; +import Stdlib.Data.List.Base open; +import Stdlib.Data.Unit.Base open; +import Stdlib.Trait.Functor open; +import Stdlib.Trait.Applicative open; +import Stdlib.Trait.Foldable.Polymorphic open; +import Stdlib.Data.Unit.Base open; + +trait +type Monad (m : Type -> Type) := + mkMonad { + {{applicative}} : Applicative m; + >>= : {A B : Type} -> m A -> (A -> m B) -> m B + }; + +open Monad public;