Showing 16 of 16 total issues
Use <$> Open
Open
bondGetBonded = do
v <- ask
return $ BondedStream $ BL.append (protoSig JsonProto) (A.encode v)
- Read upRead up
- Exclude checks
Found
do v <- ask
return $ BondedStream $ BL.append (protoSig JsonProto) (A.encode v)
Perhaps
do BondedStream . BL.append (protoSig JsonProto) . A.encode <$> ask
Reduce duplication Open
Open
typeName = mkType $ makeDeclName decl
- Read upRead up
- Exclude checks
Found
typeName = mkType $ makeDeclName decl
typeParams
= map (\ TypeParam{paramName} -> UnkindedVar $ mkVar paramName)
declParams
fieldModules
= unique $
filter (/= moduleName) $
filter (/= internalModuleAlias) $
concatMap (getTypeModules . snd) fields
mkField f
= ([mkVar $ makeFieldName f],
hsType (setType opts) ctx (fieldType f))
ownFields = map mkField structFields
fields
| Just base <- structBase =
([baseStructField], hsType (setType opts) ctx base) : ownFields
| otherwise = ownFields
Perhaps
Combine with compiler/src/Language/Bond/Codegen/Haskell/StructDecl.hs:193:5
Reduce duplication Open
Open
stream <- either throwError return $ bondMarshal CompactBinaryProto v
- Read upRead up
- Exclude checks
Found
stream <- either throwError return $
bondMarshal CompactBinaryProto v
putWord32le $ fromIntegral $ BL.length stream
putLazyByteString stream
Perhaps
Combine with runtime/src/Data/Bond/Internal/SimpleBinaryProto.hs:262:9
Use tuple-section Open
Open
makeHsBootModule opts ctx decl = fmap (\ c -> (hsBootName, Nothing, c)) code
- Read upRead up
- Exclude checks
Found
\ c -> (hsBootName, Nothing, c)
Perhaps
(hsBootName, Nothing,)
Applying this change:
- may require
{-# LANGUAGE TupleSections #-}
adding to the top of the file
Reduce duplication Open
Open
v <- bondUnmarshalWithSchema schema stream
- Read upRead up
- Exclude checks
Found
v <- bondUnmarshalWithSchema schema stream
s <- bondMarshalWithSchema t schema v
return (BondedStream s)
Perhaps
Combine with runtime/src/Data/Bond/Internal/BondedUtils.hs:45:9
Use hierarchical imports Open
Open
import IO
- Read upRead up
- Exclude checks
Found
import IO
Perhaps
import System.IO
import System.IO.Error
import Control.Exception ( bracket, bracket_ )
Redundant bracket Open
Open
| V.length a == 1 -> (Just . head) <$> bondGetList
- Read upRead up
- Exclude checks
Found
(Just . head) <$> bondGetList
Perhaps
Just . head <$> bondGetList
Reduce duplication Open
Open
let et = getWireType (Proxy :: Proxy a)
- Read upRead up
- Exclude checks
Found
let et = getWireType (Proxy :: Proxy a)
(t, n) <- getListHeader
unless (t == et) $
fail $
"invalid element tag " ++
bondTypeName t ++
" in list field, " ++ bondTypeName et ++ " expected"
Perhaps
Combine with runtime/src/Data/Bond/Internal/CompactBinaryProto.hs:337:5
Use tuple-section Open
Open
makeModule opts ctx decl = fmap (\ c -> (sourceName, Just printName, c)) code
- Read upRead up
- Exclude checks
Found
\ c -> (sourceName, Just printName, c)
Perhaps
(sourceName, Just printName,)
Applying this change:
- may require
{-# LANGUAGE TupleSections #-}
adding to the top of the file
Reduce duplication Open
Open
v <- bondUnmarshalTagged stream
- Read upRead up
- Exclude checks
Found
v <- bondUnmarshalTagged stream
s <- bondMarshalWithSchema t schema v
return (BondedStream s)
Perhaps
Combine with runtime/src/Data/Bond/Internal/BondedUtils.hs:59:9
Reduce duplication Open
Open
let et = getWireType (Proxy :: Proxy a)
- Read upRead up
- Exclude checks
Found
let et = getWireType (Proxy :: Proxy a)
(t, n) <- getListHeader
unless (t == et) $
fail $
"invalid element tag " ++
bondTypeName t ++
" in list field, " ++ bondTypeName et ++ " expected"
Perhaps
Combine with runtime/src/Data/Bond/Internal/FastBinaryProto.hs:211:5
Reduce duplication Open
Open
size <- getWord32le
- Read upRead up
- Exclude checks
Found
size <- getWord32le
bs <- getLazyByteString (fromIntegral size)
return $ BondedStream bs
Perhaps
Combine with runtime/src/Data/Bond/Internal/SimpleBinaryProto.hs:216:9
Use newtype instead of data Open
Open
data BondedException = BondedException String
deriving (Show, Typeable)
- Read upRead up
- Exclude checks
Found
data BondedException
= BondedException String
deriving (Show, Typeable)
Perhaps
newtype BondedException
= BondedException String
deriving (Show, Typeable)
Applying this change:
- decreases laziness
Reduce duplication Open
Open
sig = BL.take 4 stream
- Read upRead up
- Exclude checks
Found
sig = BL.take 4 stream
schema = getSchema (Proxy :: Proxy a)
taggedSigs
= [protoSig FastBinaryProto, protoSig CompactBinaryProto,
protoSig CompactBinaryV1Proto]
isTaggedSource = sig `elem` taggedSigs
Perhaps
Combine with runtime/src/Data/Bond/Internal/BondedUtils.hs:49:5
Reduce duplication Open
Open
keyTypeDef <- makeElementTypeDef key
- Read upRead up
- Exclude checks
Found
keyTypeDef <- makeElementTypeDef key
valueTypeDef <- makeElementTypeDef value
return
defaultValue{TD.id = bT_MAP, TD.element = Just valueTypeDef,
TD.key = Just keyTypeDef}
Perhaps
Combine with runtime/src/Data/Bond/Internal/SchemaOps.hs:282:9
Reduce duplication Open
Open
v <- bondUnmarshalWithSchema schema stream
- Read upRead up
- Exclude checks
Found
v <- bondUnmarshalWithSchema schema stream
s <- bondMarshalWithSchema t schema v
return (BondedStream s)
Perhaps
Combine with runtime/src/Data/Bond/Internal/BondedUtils.hs:63:9