package devkit

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Devkit_core.PreludeSource

Useful shortcuts

Sourcemodule Enum = ExtEnum
Sourceval ($) : ('a -> 'b) -> ('c -> 'a) -> 'c -> 'b

function composition : f $ g is equivalent to (fun x -> f (g x))

Sourceval ($$) : ('a -> 'a -> 'b) -> ('c -> 'a) -> 'c -> 'c -> 'b

2-function composition : f $$ g is equivalent to (fun x y -> f (g x) (g y))

Sourceval id : 'a -> 'a

identity

Sourceval identity : 'a -> 'a

idem

Sourceval flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c

reverse arguments, flip f x y is equivalent to f y x

Sourceval apply2 : ('a -> 'b) -> ('a * 'a) -> 'b * 'b

map over 2-tuple

Sourceval some : 'a -> 'a option

some x is equivalent to Some x

Sourceval const : 'a -> unit -> 'a
  • returns

    function returning given value

Sourceval curry : (('a * 'b) -> 'c) -> 'a -> 'b -> 'c
  • returns

    curried version from function of tuple

Sourceval uncurry : ('a -> 'b -> 'c) -> ('a * 'b) -> 'c
  • returns

    function of tuple from curried function

Sourceval (!!) : 'a Lazy.t -> 'a

Lazy.force

Sourceval printfn : ('a, unit, string, unit) format4 -> 'a

printf to stdout with newline

Sourceval eprintfn : ('a, unit, string, unit) format4 -> 'a

printf to stderr with newline

Sourcemodule Fresh (T : sig ... end) () : sig ... end

abstract type generator

Sourceval tuck : 'a list ref -> 'a -> unit
Sourceval cons : 'a list -> 'a -> 'a list
Sourceval (+=) : int ref -> int -> unit
Sourceval (-=) : int ref -> int -> unit
Sourceval round : float -> float
Sourceval atoi : string -> string -> int

atoi name value

  • returns

    integer of string value

  • raises Failure

    if value is not an integer (with name and value in exception message)

Sourceval call_me_maybe : ('a -> unit) option -> 'a -> unit
OCaml

Innovation. Community. Security.