diff --git a/Debug/HTrace.hs b/Debug/HTrace.hs
new file mode 100644
--- /dev/null
+++ b/Debug/HTrace.hs
@@ -0,0 +1,94 @@
+{-# LANGUAGE BangPatterns #-}
+-- | Like Debug.Trace.trace, but with indentation corresponding to the
+-- level of nesting in the evaluation tree of expressions under htrace.
+-- WARNING: Currently only works in single-threaded programs.
+-- 
+-- Example:
+-- 
+-- 
+-- > xs = map (\x -> htrace (show x) x) [1..10]
+-- >
+-- > s = foldl (\a b -> htrace "+" (a+b)) 0 xs
+-- > s2 = foldl' (\a b -> htrace "+" (a+b)) 0 xs
+-- >
+-- > b = htrace "b" 2
+-- > c = htrace "c" 3
+-- > a = htrace "a" $ b + c
+-- > x = htrace "x" $ b + c
+-- 
+--
+-- >>> a
+-- a
+--     b
+--     c
+-- 5
+-- 
+-- >>> x
+-- x
+-- 5
+-- 
+-- >>> s
+-- +
+--     +
+--         +
+--             +
+--                 +
+--                     +
+--                         +
+--                             +
+--                                 +
+--                                     +
+--                                         1
+--                                     2
+--                                 3
+--                             4
+--                         5
+--                     6
+--                 7
+--             8
+--         9
+--     10
+-- 55
+-- 
+-- (reload)
+-- 
+-- >>> s2
+-- +
+--     1
+-- +
+--     2
+-- +
+--     3
+-- +
+--     4
+-- +
+--     5
+-- +
+--     6
+-- +
+--     7
+-- +
+--     8
+-- +
+--     9
+-- +
+--     10
+-- 55
+-- 
+module Debug.HTrace (htrace) where
+
+import Data.List (foldl')
+import Data.IORef
+import System.IO.Unsafe
+
+level = unsafePerformIO $ newIORef 0
+
+-- | Trace "str" on a separate line, and increase indentation of subsequent
+--   traces while x is being evaluated. 
+htrace str x = unsafePerformIO $ do
+  lvl <- readIORef level
+  putStrLn (replicate (2*lvl) ' ' ++ str)
+  writeIORef level (lvl+1)
+  let !vx = x
+  writeIORef level lvl
+  return vx
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,23 @@
+Copyright (c) 2012, Eugene Kirpichov
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/htrace.cabal b/htrace.cabal
new file mode 100644
--- /dev/null
+++ b/htrace.cabal
@@ -0,0 +1,29 @@
+Name: htrace
+Category: Debug
+Version: 0.1
+Cabal-version: >= 1.2
+Build-type: Simple
+Copyright: Eugene Kirpichov
+Maintainer: ekirpichov@gmail.com    
+Author: Eugene Kirpichov
+License: BSD3
+License-File: LICENSE
+Synopsis: Hierarchical tracing for debugging of lazy evaluation
+Description:
+  Hierarchical tracing (like Debug.Trace.trace but with indentation)
+  for debugging of lazy evaluation
+Cabal-Version: >= 1.6
+
+Flag split-base
+
+Source-repository head
+  type: git
+  location: git://github.com/jkff/htrace.git
+
+Library
+  if flag(split-base)
+    Build-depends: base >= 3.0 && < 5.0
+  else
+    Build-depends: base < 3.0
+  Exposed-modules: Debug.HTrace
+
