src/Pure/General/lazy.ML
changeset 32738 15bb09ca0378
parent 29422 fdf396a24a9f
equal deleted inserted replaced
32737:76fa673eee8b 32738:15bb09ca0378
    24 
    24 
    25 datatype 'a T =
    25 datatype 'a T =
    26   Lazy of unit -> 'a |
    26   Lazy of unit -> 'a |
    27   Result of 'a Exn.result;
    27   Result of 'a Exn.result;
    28 
    28 
    29 type 'a lazy = 'a T ref;
    29 type 'a lazy = 'a T Unsynchronized.ref;
    30 
    30 
    31 fun same (r1: 'a lazy, r2) = r1 = r2;
    31 fun same (r1: 'a lazy, r2) = r1 = r2;
    32 
    32 
    33 fun lazy e = ref (Lazy e);
    33 fun lazy e = Unsynchronized.ref (Lazy e);
    34 fun value x = ref (Result (Exn.Result x));
    34 fun value x = Unsynchronized.ref (Result (Exn.Result x));
    35 
    35 
    36 fun peek r =
    36 fun peek r =
    37   (case ! r of
    37   (case ! r of
    38     Lazy _ => NONE
    38     Lazy _ => NONE
    39   | Result res => SOME res);
    39   | Result res => SOME res);