[@@ FStar.Tactics.Typeclasses.tcinstance]
val printable_uint64:printable FStar.UInt64.t
instance printable_uint64 : printable FStar.UInt64.t =
{
  to_string = FStar.UInt64.to_string
}
[@@ FStar.Tactics.Typeclasses.tcinstance]
val printable_uint64:printable FStar.UInt64.t
[@@ FStar.Tactics.Typeclasses.tcinstance]
let printable_uint64:printable FStar.UInt64.t =
{ to_string = FStar.UInt64.to_string }
FStar.Class.Printable.fst.checked
prims.fst.checked FStar.UInt8.fsti.checked FStar.UInt64.fsti.checked FStar.UInt32.fsti.checked FStar.UInt16.fsti.checked FStar.Tactics.Typeclasses.fsti.checked FStar.String.fsti.checked FStar.Seq.Properties.fsti.checked FStar.Seq.fst.checked FStar.Pervasives.fsti.checked FStar.List.Tot.fst.checked FStar.Int8.fsti.checked FStar.Int64.fsti.checked FStar.Int32.fsti.checked FStar.Int16.fsti.checked FStar.Char.fsti.checked
FStar.Class.Printable.fst
FStar.Class.Printable.Mkprintable FStar.UInt64.t FStar.UInt64.to_string
(*
   Copyright 2020 Microsoft Research

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

   Authors: Brian G. Milnes
*)

module FStar.Class.Printable

open FStar.String
open FStar.Seq.Properties

class printable (a:Type) =
{
  to_string : a -> string
}

(* First the prim types. *)

instance printable_unit : printable unit =
{
  to_string = (fun _ -> "()")
}

instance printable_bool : printable bool =
{
  to_string = Prims.string_of_bool
}

instance printable_nat : printable nat =
{
  to_string = Prims.string_of_int
}

instance printable_int : printable int =
{
  to_string = Prims.string_of_int
}

(* An instance for refinements, they can be printed as long
as the base type is printable. This allows to print [nat],
for instance. *)
instance printable_ref #a #p (d : printable a) : printable (x:a{p x}) =
{
  to_string = d.to_string
}

instance printable_list (#a:Type) (x:printable a) : printable (list a) =
{
  to_string = (fun l -> "[" ^ FStar.String.concat "; " (List.Tot.map to_string l) ^ "]")
}

instance printable_string : printable string =
{
  to_string = fun x -> "\"" ^ x ^ "\""
}

instance printable_option #a {| printable a |} : printable (option a) =
{
  to_string = (function None -> "None" | Some x -> "(Some " ^ to_string x ^ ")")
}

instance printable_either #a #b {| printable a |} {| printable b |} : printable (either a b) =
{
  to_string =
    (function Inl x -> "(Inl " ^ to_string x ^ ")" |
              Inr x -> "(Inr " ^ to_string x ^ ")")
}

(* Then the base types. *)

instance printable_char : printable FStar.Char.char =
{
  to_string = string_of_char
}

(* Floats are not yet well implemented, so these are placeholders.*)
(*
instance printable_float : printable FStar.Float.float =
{
  to_string = FStar.Float.to_string
}

instance printable_double : printable FStar.Float.double =
{
  to_string = FStar.Float.to_string
}
*)

instance printable_byte : printable FStar.UInt8.byte =
{
  to_string = FStar.UInt8.to_string
}

instance printable_int8 : printable FStar.Int8.t =
{
  to_string = FStar.Int8.to_string
}

instance printable_uint8 : printable FStar.UInt8.t =
{
  to_string = FStar.UInt8.to_string
}

instance printable_int16 : printable FStar.Int16.t =
{
  to_string = FStar.Int16.to_string
}

instance printable_uint16 : printable FStar.UInt16.t =
{
  to_string = FStar.UInt16.to_string
}

instance printable_int32 : printable FStar.Int32.t =
{
  to_string = FStar.Int32.to_string
}

instance printable_uint32 : printable FStar.UInt32.t =
{
  to_string = FStar.UInt32.to_string
}

instance printable_int64 : printable FStar.Int64.t =
{
  to_string = FStar.Int64.to_string
}

instance printable_uint64 : printable FStar.UInt64.t =
[@@ FStar.Tactics.Typeclasses.tcinstance]
val printable_uint64:printable FStar.UInt64.t
FStar.Class.Printable.printable FStar.UInt64.t