package spotlib

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

Source file xlazy.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
include Lazy

include (Monad.Make(struct
  type nonrec 'a t = 'a t
  let return : 'a -> 'a t = from_val
  let bind z f = f (force z)
end) : Monad.T with type 'a t := 'a Lazy.t)

let (!!) = force
let eager = Lazy.from_val

let peek v = if is_val v then Some (!!v) else None
      
let map f v = 
  if is_val v then eager (f !!v)
  else lazy (f !!v)

let detuple xy = 
  map fst xy,
  map snd xy