packages feed

proto-lens-protoc 0.2.0.0 → 0.2.0.1

raw patch · 3 files changed

+21/−36 lines, 3 filesdep ~proto-lensdep ~proto-lens-descriptorsPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: proto-lens, proto-lens-descriptors

API changes (from Hackage documentation)

Files

proto-lens-protoc.cabal view
@@ -1,5 +1,5 @@ name:                proto-lens-protoc-version:             0.2.0.0+version:             0.2.0.1 synopsis:            Protocol buffer compiler for the proto-lens library. description:   Turn protocol buffer files (.proto) into Haskell files (.hs) which@@ -47,8 +47,8 @@         , lens-family == 1.2.*         , lens-labels == 0.1.*         , process >= 1.2 && < 1.5-        , proto-lens == 0.2.0.0-        , proto-lens-descriptors == 0.2.0.0+        , proto-lens == 0.2.0.1+        , proto-lens-descriptors == 0.2.0.1         , text == 1.2.*     reexported-modules:         -- Modules that are needed by the generated Haskell files.@@ -79,8 +79,8 @@       , lens-family == 1.2.*       -- Specify an exact version of `proto-lens`, since it's tied closely       -- to the generated code.-      , proto-lens == 0.2.0.0-      , proto-lens-descriptors == 0.2.0.0+      , proto-lens == 0.2.0.1+      , proto-lens-descriptors == 0.2.0.1       , text == 1.2.*   hs-source-dirs:      src   other-modules:
src/Data/ProtoLens/Compiler/Generate.hs view
@@ -15,7 +15,6 @@     ) where  -import Control.Applicative ((<$>)) import Control.Arrow (second) import qualified Data.Foldable as F import qualified Data.List as List@@ -34,7 +33,6 @@     , FieldDescriptorProto'Label(..)     , FieldDescriptorProto'Type(..)     , FileDescriptorProto-    , FieldOptions     , defaultValue     , label     , mapEntry@@ -321,14 +319,12 @@ generateFieldDecls :: String -> [Decl] generateFieldDecls xStr =     -- foo :: forall x f s t a b-    --        . (Functor f, HasLens x f s t a b)-    --        => LensLike f s t a b+    --        . HasLens x f s t a b => LensLike f s t a b+    -- -- Note: `Lens.Family2.LensLike f` implies Functor f.     -- foo = lensOf (Proxy# :: Proxy# x)     [ typeSig [x]-          $ tyForAll ["x", "f", "s", "t", "a", "b"]-                  [ classA "Prelude.Functor" ["f"]-                  , classA "Lens.Labels.HasLens" [xSym, "f", "s", "t", "a", "b"]-                  ]+          $ tyForAll ["f", "s", "t", "a", "b"]+                  [classA "Lens.Labels.HasLens" [xSym, "f", "s", "t", "a", "b"]]                     $ "Lens.Family2.LensLike" @@ "f" @@ "s" @@ "t" @@ "a" @@ "b"     , funBind [match x []                   $ "Lens.Labels.lensOf"
src/protoc-gen-haskell.hs view
@@ -9,10 +9,7 @@ module Main where  import qualified Data.ByteString as B-import Data.Char (toUpper)-import Data.List (foldl', intercalate)-import qualified Data.Map.Strict as Map-import Data.Map.Strict (Map, unions, (!))+import Data.Map.Strict ((!)) import Data.Monoid ((<>)) import qualified Data.Set as Set import qualified Data.Text as T@@ -29,27 +26,19 @@     , protoFile     ) import Proto.Google.Protobuf.Descriptor-    (FileDescriptorProto, name, dependency, publicDependency)+    (FileDescriptorProto, name, dependency) import System.Environment (getProgName) import System.Exit (exitWith, ExitCode(..)) import System.IO as IO-import System.FilePath (dropExtension, replaceExtension, splitDirectories)-import Text.Read (readEither) -import Data.ProtoLens.Compiler.Combinators-    ( ModuleName-    , Name-    , QName-    , prettyPrint)-import Data.ProtoLens.Compiler.Definitions+import Data.ProtoLens.Compiler.Combinators (prettyPrint) import Data.ProtoLens.Compiler.Generate import Data.ProtoLens.Compiler.Plugin-import System.Environment (getArgs) +main :: IO () main = do     contents <- B.getContents     progName <- getProgName-    args <- getArgs     case decodeMessage contents of         Left e -> IO.hPutStrLn stderr e >> exitWith (ExitFailure 1)         Right x -> B.putStr $ encodeMessage $ makeResponse progName x@@ -79,22 +68,22 @@   modulePrefix = "Proto"   filesByName = analyzeProtoFiles modulePrefix files   -- The contents of the generated Haskell file for a given .proto file.-  buildFile file = let-      deps = descriptor file ^. dependency+  buildFile f = let+      deps = descriptor f ^. dependency       imports = Set.toAscList $ Set.fromList                   [ haskellModule (filesByName ! exportName)                   | dep <- deps                   , exportName <- exports (filesByName ! dep)                   ]-      in generateModule (haskellModule file) imports-             (fileSyntaxType (descriptor file))+      in generateModule (haskellModule f) imports+             (fileSyntaxType (descriptor f))              modifyImports-             (definitions file)+             (definitions f)              (collectEnvFromDeps deps filesByName)-  in [ ( outputFilePath . prettyPrint . haskellModule $ file-       , header (descriptor file) <> pack (prettyPrint $ buildFile file)+  in [ ( outputFilePath . prettyPrint . haskellModule $ f+       , header (descriptor f) <> pack (prettyPrint $ buildFile f)        )      | fileName <- toGenerate-     , let file = filesByName ! fileName+     , let f = filesByName ! fileName      ]