lean4-htt/library/init/util.lean
2019-05-08 14:17:17 -07:00

25 lines
801 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/-
Copyright (c) 2019 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
prelude
import init.data.string.basic
universes u v
/- debugging helper functions -/
@[extern cpp inline "lean::dbg_trace(#2, #3)"]
def dbgTrace {α : Type u} (s : String) (f : Unit → α) : α :=
f ()
/- Display the given message if `a` is shared, that is, RC(a) > 1 -/
@[extern cpp inline "lean::dbg_trace_if_shared(#2, #3)"]
def dbgTraceIfShared {α : Type u} (s : String) (a : α) : α :=
a
@[extern cpp inline "lean::dbg_sleep(#2, #3)"]
def dbgSleep {α : Type u} (ms : UInt32) (f : Unit → α) : α :=
f ()
@[extern cpp inline "#4"]
unsafe def unsafeCast {α : Type u} {β : Type v} [Inhabited β] (a : α) : β := default _