packages feed

HaTeX-meta 1.1.1 → 1.2.1

raw patch · 3 files changed

+44/−30 lines, 3 filesdep ~Cabaldep ~ghcdep ~haddock

Dependency ranges changed: Cabal, ghc, haddock

Files

HaTeX-meta.cabal view
@@ -1,19 +1,19 @@ Name: HaTeX-meta-Version: 1.1.1+Version: 1.2.1 Cabal-Version: >= 1.6 Build-Type: Simple License: BSD3 License-file: license-Maintainer: Daniel Díaz (danieldiaz <at> dhelta <dot> net)-Stability: Experimental-Homepage: http://dhelta.net/hprojects/HaTeX-meta-Bug-reports: danieldiaz <at> dhelta <dot> net-Synopsis: HaTeX monad modules builder.-Description: This packages belongs to the HaTeX project.+Stability: Deprecated+Synopsis: This package is deprecated. From version 3, HaTeX does not need this anymore.+Description: Please, note that this package is /deprecated/.+             .+             This packages belongs to the HaTeX project.              It builds the @.Monad@ modules.+             .+             /Please, note that this version only works with GHC 7.4./ Category: Text Author: Daniel Díaz-Tested-with: GHC == 7.0.3 Extra-source-files: ReleaseNotes                   , ReadMe @@ -21,11 +21,11 @@   Build-depends: base == 4.*                , mtl  == 2.*                , haskell-src-exts == 1.11.*-               , haddock >= 2.9.0 && < 2.9.3-               , ghc  == 7.*+               , haddock == 2.10.*+               , ghc  == 7.4.*                , parsec == 3.*                , containers == 0.4.*                , directory == 1.*                , filepath == 1.*-               , Cabal == 1.10.*+               , Cabal == 1.14.*   Main-is: MetaHaTeX.hs
MetaHaTeX.hs view
@@ -1,22 +1,24 @@ -import Prelude hiding (lookup)+import Prelude hiding (lookup,catch) import Language.Haskell.Exts hiding (ModuleName) import qualified Language.Haskell.Exts as LH-import Documentation.Haddock hiding (Decl)+import Documentation.Haddock import Control.Monad.State+import Control.Exception (catch,IOException) import Data.Maybe import Data.List (find,intercalate)-import qualified Name as GHC-import qualified Outputable as GHC-import qualified Module as GHC import Text.Parsec import Text.Parsec.String-import Data.Map hiding (filter)+import Data.Map hiding (filter,foldl) import System.FilePath (dropFileName) import System.Directory (createDirectoryIfMissing,doesFileExist) import Data.Char (isAlpha) import System.IO (hFlush,stdout) import Control.Monad (filterM)+-- GHC+import qualified Name as GHC+import qualified Outputable as GHC+import qualified Module as GHC -- Cabal import Distribution.PackageDescription         (exposedModules,condTreeData,condLibrary)@@ -69,7 +71,7 @@      -- When a exception is raised...      putStrLn $ "HaTeX-meta: There was an exception reading " ++ name ++ " module."      putStrLn "The exception was:"-     print e+     print (e :: IOException)      return defaultModule    where     name = filePathToMName fp@@ -119,7 +121,7 @@ data FunDoc = FD  { funName    :: String  , funDoc     :: Maybe (Doc GHC.Name)- , funArgsDoc :: FnArgsDoc GHC.Name+ , funArgsDoc :: Maybe (Map Int (Doc GHC.Name))    }  data HSInfo = HSI@@ -164,10 +166,17 @@  let getFunInfo :: Decl -> [(FunDoc,Type)]      getFunInfo (TypeSig _ ns_ t) =       let ns = filter (`elem` exportedNames) $ fmap nameString ns_-          funmap = ifaceDeclMap i-          strfunmap = mapKeys ghcName funmap-      in  fmap (\n -> let dinfo = lookup n strfunmap-                          (fd,fad) = maybe (Nothing,Data.Map.empty) snd3 dinfo+          -- docmap :: DocMap GHC.Name+          docmap = ifaceDocMap i+          -- argmap :: ArgMap GHC.Name+          argmap = ifaceArgMap i+          strdocmap :: Map String (Doc GHC.Name)+          strdocmap = mapKeys (symbolParens . ghcName) docmap+          strargmap :: Map String (Map Int (Doc GHC.Name))+          strargmap = mapKeys (symbolParens . ghcName) argmap+      in  fmap (\n -> let fd :: Maybe (Doc GHC.Name)+                          fd  = lookup n strdocmap+                          fad = lookup n strargmap                       in ( FD n fd fad , t )) ns      getFunInfo _ = []  -- Final result@@ -188,7 +197,7 @@ renderDoc (DocAppend d1 d2) = renderDoc d1 ++ renderDoc d2 renderDoc (DocString str) = str renderDoc (DocParagraph d) = renderDoc d-renderDoc (DocIdentifier xs) = "'" ++ ghcName (last xs) ++ "'"+renderDoc (DocIdentifier n) = "'" ++ ghcName n ++ "'" renderDoc (DocModule str) = "\"" ++ str ++ "\"" renderDoc (DocEmphasis d) = "/" ++ renderDoc d ++ "/" renderDoc (DocMonospaced d) = "@" ++ renderDoc d ++ "@"@@ -261,12 +270,10 @@  Generator loc0 v $ foldl1 App    [ Var $ UnQual $ Ident "maybe"    , App (Var $ UnQual $ Ident "return") (Con $ UnQual $ Ident "Nothing")-   , InfixApp (RightSection (QVarOp $ UnQual $ Symbol ">>=")-                            (InfixApp (Var $ UnQual $ Ident "return")-                                      (QVarOp $ UnQual $ Symbol ".")-                                      (Con $ UnQual $ Ident "Just") ) )+   , InfixApp (App (Var $ UnQual $ Ident "liftM")+                   (Con $ UnQual $ Ident "Just") )               (QVarOp $ UnQual $ Symbol ".")-              (Var $ UnQual $ Ident "extractLaTeX_")+              (Var    $ UnQual $ Ident  "extractLaTeX_")    , Var $ UnQual n      ] doStatement _ _ = Nothing@@ -319,6 +326,7 @@  in      unlines [    "import Text.LaTeX.Base.Writer"+ , "import Control.Monad (liftM)"  , "import Text.LaTeX.Base.Render"  , "import Text.LaTeX.Base.Types"  , "import qualified " ++ mn ++ " as App"
ReadMe view
@@ -2,4 +2,10 @@ 
 If you want to use HaTeX-meta to generate HaTeX .Monad modules:
 1) Compile HaTeX-meta.
-2) Run it in a directory that contains the source of HaTeX, being the Text folder a subdirectory.+2) Run it in a directory that contains the source of HaTeX, being the Text folder a subdirectory.
+
+** TODO
+
+- Documentation written in types is skipped.
+  We collect it in 'funArgsDoc' of FunDoc, but it is not used later.
+  Currently, the type is just pretty printed (see 'monadicFunction').