package phylogenetics

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

Source file ID_monad.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
type 'a t = int -> 'a * int

let return x = fun s -> x, s

let (let*) (m : 'a t) (f : 'a -> 'b t) : 'b t  =
  fun state ->
  let y, state' = m state in
  f y state'

let (let+) (m : 'a t) (f : 'a -> 'b) : 'b t  =
  fun state ->
  let y, state' = m state in
  f y, state'

let new_id id = (id, id + 1)

let run m = fst (m 0)
OCaml

Innovation. Community. Security.