Extend the GHC API with breakpoints and breakpoint handlers
[ghc-hetmet.git] / compiler / main / Breakpoints.hs
diff --git a/compiler/main/Breakpoints.hs b/compiler/main/Breakpoints.hs
new file mode 100644 (file)
index 0000000..8bb1716
--- /dev/null
@@ -0,0 +1,25 @@
+-----------------------------------------------------------------------------\r
+--\r
+-- GHC API breakpoints. This module includes the main API (BkptHandler) and\r
+-- utility code for implementing a client to this API used in GHCi \r
+--\r
+-- Pepe Iborra (supported by Google SoC) 2006\r
+--\r
+-----------------------------------------------------------------------------\r
+\r
+module Breakpoints where\r
+\r
+import {-#SOURCE#-} HscTypes     ( Session )\r
+\r
+data BkptHandler a = BkptHandler {\r
+     handleBreakpoint  :: forall b. Session -> [(Id,HValue)] -> BkptLocation a ->  String -> b -> IO b\r
+   , isAutoBkptEnabled :: Session -> BkptLocation a -> IO Bool\r
+   }\r
+\r
+nullBkptHandler = BkptHandler {\r
+    isAutoBkptEnabled = \ _ _     -> return False,\r
+    handleBreakpoint  = \_ _ _ _ b -> putStrLn "null Bkpt Handler" >> return b\r
+                              }\r
+\r
+type BkptLocation a = (a, SiteNumber)\r
+type SiteNumber   = Int\r