packages feed

file-location 0.2.3 → 0.2.4

raw patch · 3 files changed

+35/−4 lines, 3 filesdep +monad-control

Dependencies added: monad-control

Files

+ Control/Exception/Control/FileLocation.hs view
@@ -0,0 +1,21 @@+{-# LANGUAGE TemplateHaskell #-}+module Control.Exception.Control.FileLocation (thrwIO, thrwsIO) where++import Language.Haskell.TH.Syntax++import FileLocation.LocationString (locationToString)++import Control.Exception.Base hiding (throwIO)+import Control.Exception.Control (throwIO)++thrwIO :: Q Exp+thrwIO = do+  loc <- qLocation+  let locStr = locationToString loc+  [|(\mkEx -> throwIO (mkEx locStr))|]++thrwsIO :: String -> Q Exp+thrwsIO errMsg = do+  loc <- qLocation+  let locStr = locationToString loc+  [|(\mkEx -> throwIO (mkEx (locStr ++ " " ++ errMsg)))|]
FileLocation.hs view
@@ -4,11 +4,13 @@   ( err, undef   , debug, debugM, debugMsg, dbg, dbgMsg, trc, ltrace, ltraceM, strace   , locationToString+  , thrwIO, thrwsIO   )   where  import FileLocation.LocationString (locationToString) import Debug.FileLocation (debug, debugM, debugMsg, dbg, dbgMsg, trc, ltrace, ltraceM, strace)+import Control.Exception.Control.FileLocation (thrwIO, thrwsIO) import Debug.Trace (trace) -- future plans -- import Control.Exception.FileLocation (thrw, thrwIO)
file-location.cabal view
@@ -1,5 +1,5 @@ Name:                file-location-Version:             0.2.3+Version:             0.2.4 Synopsis:            common functions that show file location information Homepage:            https://github.com/gregwebs/ErrorLocation.hs License:             BSD3@@ -19,7 +19,7 @@     Notice how it displays package:module file:line:character     It exposes the functions err (error), undef (undefined), and trc (Debug.Trace.trace). All of these behave the same as their normal counterpart but also spit out a location.     .-    I also included my favorite helper, debug, which is like trace but just show the value.+    Here is my favorite helper, debug, which is like trace but just show the value.     .     > debug [1,2,3]     >@@ -33,6 +33,11 @@     > DEBUG main:Main main.hs:1:3 [1,2,3]     > [1,2,3]     .+    Also there is a version of thrwIO that gives location information+    > ($(thrwIO) $ AException) `catch` \e -> putStrLn ("Caught " ++ show (e :: AException))+    >+    > Caught AException "main:Main test/main.hs:25:6"+    .     See module for a listing of all the functions with short descriptions, and the homepage for some more examples https://github.com/gregwebs/ErrorLocation.hs  Source-Repository head@@ -42,9 +47,12 @@ Library   Exposed-modules: FileLocation,                    Debug.FileLocation,+                   Control.Exception.Control.FileLocation,                    Debug.Util,                    FileLocation.LocationString      -- Packages needed in order to build this package.-  Build-depends: base >= 4 && < 5,-                 template-haskell+  Build-depends:  base >= 4 && < 5+                , template-haskell+                , monad-control    >= 0.2 && < 0.3+