packages feed

NoTrace (empty) → 0.1.0.0

raw patch · 5 files changed

+110/−0 lines, 5 filesdep +basesetup-changed

Dependencies added: base

Files

+ LICENSE view
@@ -0,0 +1,20 @@+The MIT License (MIT)++Copyright (c) 2013 Cindy Wang++Permission is hereby granted, free of charge, to any person obtaining a copy of+this software and associated documentation files (the "Software"), to deal in+the Software without restriction, including without limitation the rights to+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of+the Software, and to permit persons to whom the Software is furnished to do so,+subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ NoTrace.cabal view
@@ -0,0 +1,35 @@+-- Initial NoTrace.cabal generated by cabal init.  For further +-- documentation, see http://haskell.org/cabal/users-guide/++name:                NoTrace+version:             0.1.0.0+synopsis:            Remove all the functions come from Debug.Trace after debugging+description:         This module introduce functions with identical types with functions in the Debug.Trace.+                     When completing the debug process,+                     use this module to overwrite and silently remove all the tracing functions.+homepage:            https://github.com/CindyLinz/Haskell-NoTrace+license:             MIT+license-file:        LICENSE+author:              Cindy Wang (CindyLinz)+maintainer:          cindylinz@gmail.com+-- copyright:           +category:            Development+build-type:          Simple+cabal-version:       >=1.8++source-repository head+  type: git+  location: git@github.com:CindyLinz/Haskell-NoTrace.git++library+  exposed-modules:     Debug.NoTrace+  -- other-modules:       +  hs-source-dirs:      src+  build-depends:       base >=4.3 && <4.7++Test-Suite main+  type:                exitcode-stdio-1.0+  main-is:             Main.hs+  hs-source-dirs:      test+                     , src+  build-depends:       base >=4.3 && <4.7
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ src/Debug/NoTrace.hs view
@@ -0,0 +1,40 @@+-----------------------------------------------------------------------------+-- |+-- Module      :  Debug.NoTrace+-- Copyright   :  (c) Cindy Wang (CindyLinz) 2013+-- License     :  MIT+-- +-- Maintainer  :  Cindy Wang (CindyLinz)+-- Stability   :  provisional+-- Portability :  portable+--+-- This module introduce functions that have identical types with functions in the 'Debug.Trace' module.+--+-- You might write some programs like this:+--+-- > import Debug.Trace+-- >+-- > fib 0 = 1+-- > fib 1 = 1+-- > fib n = ("fib " ++ show n) `trace` fib (n - 1) + fib (n - 2)+--+-- And after you finish the debugging process, just change the line+--+-- > import Debug.Trace+--+-- into+--+-- > import Debug.NoTrace+--+-- Then all the tracing functions are silently removed.+-------------------------------------------------------------------------------+module Debug.NoTrace where++putTraceMsg :: String -> IO ()+putTraceMsg _ = return ()++trace :: String -> a -> a+trace _ = id++traceShow :: Show a => a -> b -> b+traceShow _ = id
+ test/Main.hs view
@@ -0,0 +1,13 @@+module Main where++import Debug.NoTrace++fib :: Int -> Int+fib 0 = 1+fib 1 = 1+fib n = "fib " `trace` n `traceShow` fib (n - 1) + fib (n - 2)++main = do+  putTraceMsg "begin"+  putStrLn $ show (fib 5)+  putTraceMsg "end"