debug-dump (empty) → 0.1.0.0
raw patch · 5 files changed
+90/−0 lines, 5 filesdep +basedep +bytestringdep +text
Dependencies added: base, bytestring, text
Files
- CHANGELOG.md +5/−0
- LICENSE +11/−0
- README.md +4/−0
- debug-dump.cabal +47/−0
- src/Debug/Trace/Dump.hs +23/−0
+ CHANGELOG.md view
@@ -0,0 +1,5 @@+# debug-dump++## 0.1.0.0++Initial release
+ LICENSE view
@@ -0,0 +1,11 @@+Copyright Vanessa McHale (c) 2019++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.++3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.++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 HOLDER 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.
+ README.md view
@@ -0,0 +1,4 @@+# debug-dump++This is a library providing simple functionality like that found in+`Debug.Trace`, but it dumps output to a file rather than the terminal.
+ debug-dump.cabal view
@@ -0,0 +1,47 @@+cabal-version: 1.18+name: debug-dump+version: 0.1.0.0+license: BSD3+license-file: LICENSE+copyright: Copyright: (c) 2019 Vanessa McHale+maintainer: vanessa.mchale@iohk.io+author: Vanessa McHale+synopsis: File-based debug output+description:+ A package emulating the functionality of Debug.Trace, but capable of writing to files+category: Debug+build-type: Simple+extra-doc-files: README.md+ CHANGELOG.md++source-repository head+ type: git+ location: https://github.com/vmchale/debug-dump+ subdir: debug-dump++flag development+ description:+ Enable `-Werror`+ default: False+ manual: True++library+ exposed-modules:+ Debug.Trace.Dump+ hs-source-dirs: src+ default-language: Haskell2010+ ghc-options: -Wall+ build-depends:+ base >=4.7 && <5,+ text -any,+ bytestring -any++ if flag(development)+ ghc-options: -Werror++ if impl(ghc >=8.0)+ ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates+ -Wredundant-constraints -Widentities++ if impl(ghc >=8.4)+ ghc-options: -Wmissing-export-lists
+ src/Debug/Trace/Dump.hs view
@@ -0,0 +1,23 @@+module Debug.Trace.Dump+ ( traceFile+ , traceFileBSL+ , traceFileText+ ) where++import qualified Data.ByteString.Lazy as BSL+import Data.Functor (($>))+import qualified Data.Text as T+import qualified Data.Text.IO as TIO+import System.IO.Unsafe (unsafePerformIO)++traceFileBSL :: FilePath -> BSL.ByteString -> a -> a+traceFileBSL fp bytes x = unsafePerformIO $+ BSL.writeFile fp bytes $> x++traceFileText :: FilePath -> T.Text -> a -> a+traceFileText fp txt x = unsafePerformIO $+ TIO.writeFile fp txt $> x++traceFile :: FilePath -> String -> a -> a+traceFile fp str x = unsafePerformIO $+ writeFile fp str $> x