You can search for identifiers within the package.
in-package search v0.2.0
Source file olmiInterfaces.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214(*
* Olmi
*
* Copyright (C) 2015 Xavier Van de Woestyne <xaviervdw@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*)(** This module provides all interfaces using for the functors. *)(**
Monadics operation could be generated with two ways : using
an interface with a parametrized type, return and bind. Or
using an interface with a parametrized type, return, join
and fmap.
A lot of those function's description come from the Haskell documentation
*)(** The common API for creating a Monad *)moduletypeCOMMON=sigtype'at(** Place a value in a minimal monadic context *)valreturn:'a->'atend(** Describe the minimal interface for making a monad with bind
function. This module could be used by OmlMonad.Make.WithBind
to generate a BASIC_INTERFACE Module, for example.
*)moduletypeBIND=sigincludeCOMMON(** Sequentially compose two actions, passing any value produced by the
first as an argument to the second.*)valbind:'at->('a->'bt)->'btend(** Describe the minimal interface for making a monad with
join function. This module could be used by OmlMonad.Make.WithJoin
to generate a BASIC_INTERFACE Module, for example.
*)moduletypeJOIN=sigincludeCOMMON(** The join function is the conventional monad join operator.
It is used to remove one level of monadic structure, projecting its
bound argument into the outer level.*)valjoin:('at)t->'at(** Sequential application *)valfmap:('a->'b)->'at->'btend(** Describe a conjunction between join and bin.
This module could be used by OmlMonad.Make.Base
to generate a BASIC_INTERFACE Module, for example.
*)moduletypeBASIC_INTERFACE=sigincludeCOMMON(** The join function is the conventional monad join operator.
It is used to remove one level of monadic structure, projecting its
bound argument into the outer level.*)valjoin:('at)t->'at(** Sequentially compose two actions, passing any value produced by the
first as an argument to the second.*)valbind:'at->('a->'bt)->'bt(** Sequential application *)valfmap:('a->'b)->'at->'btend(** Provide the signatures of all infix operators (linked to a Monad) *)moduletypeINFIX=sigtype'at(* Functor's operators *)(** Sequential application. *)val(<*>):('a->'b)t->'at->'bt(** infix alias of fmap *)val(<$>):('a->'b)->'at->'bt(** Replace all locations in the input with the same value. *)val(<$):'a->'bt->'at(** Sequence actions, discarding the value of the first argument. *)val(*>):'at->'bt->'bt(** Sequence actions, discarding the value of the second argument. *)val(<*):'at->'bt->'at(** A variant of <*> with the arguments reversed. *)val(<**>):'at->('a->'b)t->'bt(* Monadic opetaros *)(** Sequentially compose two actions, passing any value produced by the
first as an argument to the second.*)val(>>=):'at->('a->'bt)->'bt(** infix alias of fmap *)val(>|=):'at->('a->'b)->'bt(** Right-to-left Kleisli composition of monads. (>=>), with the arguments
flipped *)val(<=<):('b->'ct)->('a->'bt)->'a->'ct(** Left-to-right Kleisli composition of monads. *)val(>=>):('a->'bt)->('b->'ct)->'a->'ct(** Flipped version of >>= *)val(=<<):('a->'bt)->'at->'bt(* >> *)(** Sequentially compose two actions, discarding any value produced by the
first, like sequencing operators (such as the semicolon) in imperative
languages. *)val(>>):'at->'bt->'btend(** Provide interface for the lift operations *)moduletypeLIFT=sigtype'at(** Promote a function to a monad. *)valliftM:('a->'b)->'at->'bt(** Promote a function to a monad, scanning the monadic arguments from left to right *)valliftM2:('a->'b->'c)->'at->'bt->'ct(** Promote a function to a monad, scanning the monadic arguments from left to right *)valliftM3:('a->'b->'c->'d)->'at->'bt->'ct->'dt(** Promote a function to a monad, scanning the monadic arguments from left to right *)valliftM4:('a->'b->'c->'d->'e)->'at->'bt->'ct->'dt->'et(** Promote a function to a monad, scanning the monadic arguments from left to right *)valliftM5:('a->'b->'c->'d->'e->'f)->'at->'bt->'ct->'dt->'et->'ftend(** Provide the complete interface of monadic operations *)moduletypeINTERFACE=sigincludeBASIC_INTERFACEincludeINFIXwithtype'at:='atincludeLIFTwithtype'at:='at(** void value discards or ignores the result of evaluation, such as the
return value of an IO action. *)valvoid:'at->unittend(** Provide the minimal interface for a Monad Plus *)moduletypePLUS=sigtype'at(** Represent the neutral element *)valmempty:'at(** Monoïd combination *)valmplus:'at->'at->'atend(** Provide a complete interface for Monad plus *)moduletypePLUS_INTERFACE=sigincludeINTERFACEincludePLUSwithtype'at:='at(** Infix operator for mplus *)val(<+>):'at->'at->'at(** [ list >>= keep_if predicat ] returns a list containing all values
who's respecting the gived predicat. *)valkeep_if:('a->bool)->'a->'atend