src/Pure/Isar/proof_data.ML
changeset 13379 a21e132c3304
parent 8807 0046be1769f9
child 14981 e73f8140af78
equal deleted inserted replaced
13378:b261d9cdd6b2 13379:a21e132c3304
     9 signature PROOF_DATA_ARGS =
     9 signature PROOF_DATA_ARGS =
    10 sig
    10 sig
    11   val name: string
    11   val name: string
    12   type T
    12   type T
    13   val init: theory -> T
    13   val init: theory -> T
    14   val print: Proof.context -> T -> unit
    14   val print: ProofContext.context -> T -> unit
    15 end;
    15 end;
    16 
    16 
    17 signature PROOF_DATA =
    17 signature PROOF_DATA =
    18 sig
    18 sig
    19   type T
    19   type T
    20   val init: theory -> theory
    20   val init: theory -> theory
    21   val print: Proof.context -> unit
    21   val print: ProofContext.context -> unit
    22   val get: Proof.context -> T
    22   val get: ProofContext.context -> T
    23   val put: T -> Proof.context -> Proof.context
    23   val put: T -> ProofContext.context -> ProofContext.context
    24   val map: (T -> T) -> Proof.context -> Proof.context
    24   val map: (T -> T) -> ProofContext.context -> ProofContext.context
    25   val get_st: Proof.state -> T
       
    26   val put_st: T -> Proof.state -> Proof.state
       
    27   val map_st: (T -> T) -> Proof.state -> Proof.state
       
    28 end;
    25 end;
    29 
    26 
    30 functor ProofDataFun(Args: PROOF_DATA_ARGS): PROOF_DATA =
    27 functor ProofDataFun(Args: PROOF_DATA_ARGS): PROOF_DATA =
    31 struct
    28 struct
    32 
    29 
    43 val print = ProofContext.print_data kind;
    40 val print = ProofContext.print_data kind;
    44 val get = ProofContext.get_data kind (fn Data x => x);
    41 val get = ProofContext.get_data kind (fn Data x => x);
    45 val put = ProofContext.put_data kind Data;
    42 val put = ProofContext.put_data kind Data;
    46 fun map f ctxt = put (f (get ctxt)) ctxt;
    43 fun map f ctxt = put (f (get ctxt)) ctxt;
    47 
    44 
    48 val get_st = get o Proof.context_of;
       
    49 val put_st = Proof.put_data kind Data;
       
    50 fun map_st f st = put_st (f (get_st st)) st;
       
    51 
       
    52 end;
    45 end;
    53 
    46 
    54 
    47 
    55 (*hide private data access functions*)
    48 (*hide private data access functions*)
    56 structure ProofContext: PROOF_CONTEXT = ProofContext;
    49 structure ProofContext: PROOF_CONTEXT = ProofContext;
    57 structure Proof: PROOF = Proof;