Skip to content

Commit

Permalink
minor style adjustment, mostly removing extra newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ authored and Anviking committed Jun 21, 2019
1 parent 7bb0aa0 commit eb58f1f
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions lib/jormungandr/src/Cardano/Wallet/Jormungandr/Binary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ import qualified Codec.CBOR.Read as CBOR
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BL

-- Do-notation is favoured over applicative syntax for readability:
{-# ANN module ("HLint: ignore Use <$>" :: String) #-}

data BlockHeader = BlockHeader
{ version :: Word16
, contentSize :: Word32
Expand All @@ -128,9 +131,6 @@ data SignedUpdateProposal = SignedUpdateProposal
data SignedVote = SignedVote
deriving (Eq, Show)

-- Do-notation is favoured over applicative syntax for readability:
{-# ANN module ("HLint: ignore Use <$>" :: String) #-}

getBlockHeader :: Get BlockHeader
getBlockHeader = label "getBlockHeader" $
(fromIntegral <$> getWord16be) >>= \size -> isolate size $ do
Expand All @@ -142,7 +142,6 @@ getBlockHeader = label "getBlockHeader" $
chainLength <- getWord32be
contentHash <- Hash <$> getByteString 32 -- or 256 bits
parentHeaderHash <- Hash <$> getByteString 32

-- Proof.
-- There are three different types of proofs:
-- 1. no proof (used for the genesis blockheader)
Expand Down Expand Up @@ -228,10 +227,8 @@ getInitial = label "getInitial" $ do
getTransaction :: Get (Tx, [TxWitness])
getTransaction = label "getTransaction" $ do
(ins, outs) <- getTokenTransfer

let witnessCount = length ins
wits <- replicateM witnessCount getWitness

return $ (Tx ins outs, wits)
where
getWitness = do
Expand Down Expand Up @@ -274,7 +271,6 @@ putWitness witness =
ScriptWitness _ -> error "unimplemented: serialize script witness"
RedeemWitness _ -> error "unimplemented: serialize redeem witness"


{-------------------------------------------------------------------------------
Common Structure
-------------------------------------------------------------------------------}
Expand Down Expand Up @@ -320,9 +316,6 @@ getTokenTransfer = label "getTokenTransfer" $ do
value <- Coin <$> getWord64be
return $ TxOut addr value




{-------------------------------------------------------------------------------
Config Parameters
-------------------------------------------------------------------------------}
Expand Down Expand Up @@ -373,7 +366,6 @@ getConfigParam = label "getConfigParam" $ do
taglen <- getWord16be
let tag = taglen `shift` (-6)
let len = fromIntegral $ taglen .&. (63) -- 0b111111

isolate len $ case tag of
1 -> Discrimination <$> getNetwork
2 -> Block0Date <$> getWord64be
Expand Down Expand Up @@ -441,7 +433,6 @@ getBool = getWord8 >>= \case
other -> fail $ "Unexpected integer: " ++ show other
++ ". Expected a boolean 0 or 1."


{-------------------------------------------------------------------------------
Addresses
-------------------------------------------------------------------------------}
Expand Down

0 comments on commit eb58f1f

Please sign in to comment.