packages feed

staticanalysis 0.0.0.1 → 0.0.0.2

raw patch · 6 files changed

+90/−37 lines, 6 files

Files

StaticAnalysis/All.hs view
@@ -1,8 +1,9 @@ ----------------------------------------------------------------
 --
--- StaticAnalysis
+-- | StaticAnalysis
 --
--- StaticAnalysis/All.hs
+-- @StaticAnalysis\/All.hs@
+--
 --   Wrapper module for all StaticAnalysis modules.
 --
 
@@ -11,13 +12,15 @@ 
 module StaticAnalysis.All (
     module StaticAnalysis.Analysis,
-    module StaticAnalysis.Annotated
+    module StaticAnalysis.Annotate,
+    module StaticAnalysis.Analyze
     
   )
   where
 
 import StaticAnalysis.Analysis
-import StaticAnalysis.Annotated
+import StaticAnalysis.Annotate
+import StaticAnalysis.Analyze
 
 
 
StaticAnalysis/Analysis.hs view
@@ -1,8 +1,9 @@ ----------------------------------------------------------------
 --
--- StaticAnalysis
+-- | StaticAnalysis
 --
--- StaticAnalysis/Analysis.hs
+-- @StaticAnalysis\/Analysis.hs@
+--
 --   Interface for data structure that represents static
 --   analysis results.
 --
@@ -10,14 +11,25 @@ ----------------------------------------------------------------
 -- 
 
+{-# LANGUAGE MultiParamTypeClasses #-}
+
 module StaticAnalysis.Analysis
   where
 
 ----------------------------------------------------------------
--- Interface for analysis result data structures.
+-- | Interface for analysis result data structures.
 
 class Analysis a where
   unanalyzed :: a
+
+----------------------------------------------------------------
+-- | Interface for analysis result data structures with multiple
+--   analysis components.
+
+class (Analysis a, Analysis b) => Component b a where
+  project :: a -> b
+  inject :: b -> a -> a
+
 
 
 --eof
+ StaticAnalysis/Analyze.hs view
@@ -0,0 +1,35 @@+----------------------------------------------------------------
+--
+-- | StaticAnalysis
+--
+-- @StaticAnalysis\/Annotated.hs@
+--
+--   Interface for abstract syntax data structures in which
+--   every node can be annotated with a data structure that
+--   represents static analysis results.
+--
+
+----------------------------------------------------------------
+-- 
+
+{-# LANGUAGE MultiParamTypeClasses #-}
+
+module StaticAnalysis.Analyze
+  where
+
+import StaticAnalysis.Analysis (Analysis(..))
+import StaticAnalysis.Annotate (Annotate(..))
+
+----------------------------------------------------------------
+-- | Interface for abstract syntax data structures that can be
+--   analyzed.
+
+class (Annotate d, Analysis a) => Analyze d a where
+
+  -- The function for applying the algorithm to a data structure
+  -- of type d a.
+  analyze :: d a -> d a
+
+
+
+--eof
+ StaticAnalysis/Annotate.hs view
@@ -0,0 +1,30 @@+----------------------------------------------------------------
+--
+-- | StaticAnalysis
+--
+-- @StaticAnalysis\/Annotate.hs@
+--
+--   Interface for abstract syntax data structures in which
+--   every node can be annotated with a data structure that
+--   represents static analysis results.
+--
+
+----------------------------------------------------------------
+-- 
+
+module StaticAnalysis.Annotate
+  where
+
+import StaticAnalysis.Analysis
+
+----------------------------------------------------------------
+-- | Interface for abstract syntax data structures that can be
+--   annotated.
+
+class Annotate d where
+  annotate :: Analysis a => a -> d a -> d a
+  annotation :: Analysis a => d a -> a
+
+
+
+--eof
− StaticAnalysis/Annotated.hs
@@ -1,28 +0,0 @@-----------------------------------------------------------------
---
--- StaticAnalysis
---
--- StaticAnalysis/Annotated.hs
---   Interface for abstract syntax data structures in which
---   every node can be annotated with a data structure that
---   represents static analysis results.
---
-
-----------------------------------------------------------------
--- 
-
-module StaticAnalysis.Annotated
-  where
-
-import StaticAnalysis.Analysis
-
-----------------------------------------------------------------
--- Interface for abstract syntax data structures.
-
-class Annotated d where
-  annotate :: Analysis a => d a -> a -> d a
-  annotation :: Analysis a => d a -> a
-
-
-
---eof
staticanalysis.cabal view
@@ -1,5 +1,5 @@ Name:              staticanalysis
-Version:           0.0.0.1
+Version:           0.0.0.2
 Cabal-Version:     >= 1.6
 License:           GPL-3
 License-File:      LICENSE
@@ -13,7 +13,8 @@ Library
   Exposed-Modules: StaticAnalysis.All,
                    StaticAnalysis.Analysis,
-                   StaticAnalysis.Annotated
+                   StaticAnalysis.Annotate,
+                   StaticAnalysis.Analyze
   Build-Depends:   base >= 3 && < 5,
                    MissingH