Commit adc5c176 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add some more debugging functions

These are just variations of the standard debug, but are provided for
simpler code, since lazyness is something causing non-computation of
debug statements.
parent 74e89a14
......@@ -2,7 +2,7 @@
{-
Copyright (C) 2009 Google Inc.
Copyright (C) 2009, 2010 Google Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -24,6 +24,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
module Ganeti.HTools.Utils
(
debug
, debugFn
, debugXy
, sepSplit
, varianceCoeff
, commaJoin
......@@ -56,6 +58,14 @@ import Ganeti.HTools.Types
debug :: Show a => a -> a
debug x = trace (show x) x
-- | Displays a modified form of the second parameter before returning it
debugFn :: Show b => (a -> b) -> a -> a
debugFn fn x = debug (fn x) `seq` x
-- | Show the first parameter before returning the second one
debugXy :: Show a => a -> b -> b
debugXy a b = debug a `seq` b
-- * Miscelaneous
-- | Comma-join a string list.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment