logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Stdlib.Fun - no description

Documentation

       Module Fun
        : (moduleStdlib__Fun)Combinatorsvalid : 'a->'aid is the identity function. For any argument x , idx is x .

       valconst : 'a->'b->'aconstc is a function that always returns the value c . For any argument x , (constc)x is c .

       valcompose : ('b->'c)->('a->'b)->'a->'ccomposefg is a function composition of applying g then f .  For any arguments f , g , and x , composefgx is f(gx) .

       Since 5.2

       valflip : ('a->'b->'c)->'b->'a->'cflipf reverses the argument order of the binary function f . For any arguments x and y , (flipf)xy is
       fyx .

       valnegate : ('a->bool)->'a->boolnegatep is the negation of the predicate function p . For any argument x , (negatep)x is not(px) .

   Exceptionhandlingvalprotect : finally:(unit->unit)->(unit->'a)->'aprotect~finallywork  invokes  work() and then finally() before work() returns with its value or an
       exception. In the latter case the exception is re-raised after finally()  .  If  finally()  raises  an
       exception, then the exception Fun.Finally_raised is raised instead.

       protect  can be used to enforce local invariants whether work() returns normally or raises an exception.
       However, it does not protect against unexpected exceptions raised inside finally() such as Out_of_memory
       , Stack_overflow , or asynchronous exceptions raised by signal handlers (e.g.  Sys.Break ).

       Note: It is a programming error if other kinds of exceptions are raised by finally  ,  as  any  exception
       raised in work() will be lost in the event of a Fun.Finally_raised exception. Therefore, one should make
       sure to handle those inside the finally.

       exceptionFinally_raisedofexnFinally_raisedexn  is  raised  by  protect~finallywork  when finally raises an exception exn . This
       exception denotes either an unexpected exception or a programming error. As a general  rule,  one  should
       not catch a Finally_raised exception except as part of a catch-all handler.

OCamldoc                                           2025-06-12                                     Stdlib.Fun(3o)

Module

       Module   Stdlib.Fun

Name

       Stdlib.Fun - no description

See Also