Skip to content

Commit

Permalink
Add NFData derivations on the generated code (awakesecurity#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndmitchell authored and Gabriella439 committed Apr 17, 2019
1 parent df9cb44 commit ce01f40
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Proto3/Suite/DotProto/Generate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ renderHsModuleForDotProto extraInstanceFiles dotProto importCtxt = do
where
header = [Neat.text|
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeApplications #-}
Expand Down Expand Up @@ -2011,6 +2012,7 @@ defaultImports usesGrpc =
)
)
, importDecl_ controlApplicativeM True (Just haskellNS) Nothing
, importDecl_ controlDeepSeqM True (Just haskellNS) Nothing
, importDecl_ controlMonadM True (Just haskellNS) Nothing
, importDecl_ dataTextM True
(Just haskellNS) (Just (False, [ importSym "Text" ]))
Expand Down Expand Up @@ -2049,6 +2051,7 @@ defaultImports usesGrpc =
proto3SuiteJSONPBM = Module "Proto3.Suite.JSONPB"
proto3WireM = Module "Proto3.Wire"
controlApplicativeM = Module "Control.Applicative"
controlDeepSeqM = Module "Control.DeepSeq"
controlMonadM = Module "Control.Monad"
dataCoerceM = Module "Data.Coerce"
dataTextM = Module "Data.Text.Lazy"
Expand Down Expand Up @@ -2082,10 +2085,10 @@ haskellNS :: Module
haskellNS = Module "Hs"

defaultMessageDeriving :: [HsQName]
defaultMessageDeriving = map haskellName [ "Show", "Eq", "Ord", "Generic" ]
defaultMessageDeriving = map haskellName [ "Show", "Eq", "Ord", "Generic", "NFData" ]

defaultEnumDeriving :: [HsQName]
defaultEnumDeriving = map haskellName [ "Show", "Bounded", "Eq", "Ord", "Generic" ]
defaultEnumDeriving = map haskellName [ "Show", "Bounded", "Eq", "Ord", "Generic", "NFData" ]

defaultServiceDeriving :: [HsQName]
defaultServiceDeriving = map haskellName [ "Generic" ]
Expand Down

0 comments on commit ce01f40

Please sign in to comment.