formatInstructions dex addr off ws (i:is) =
  M.mconcat [ word24HexFixed addr
          , ": "
          , unitDoc
          , "|"
          , word16HexFixed (fromIntegral off)
          , ": "
          , idoc
          ] $+$ formatInstructions dex (addr + (l' * 2)) (off + l') ws' is
  where
    (iws, ws') = L.splitAt l ws
    istrs = [ word8HexFixed (fromIntegral (w .&. 0x00FF)) <>
              word8HexFixed (fromIntegral ((w .&. 0xFF00) `shiftR` 8))
            | w <- iws
            ]
    istrs' | length istrs < 8 = take 8 (istrs ++ repeat "    ")
           | otherwise = take 7 istrs ++ ["... "]
    l = insnUnitCount i
    l' = fromIntegral l
    unitDoc = M.mconcat (PP.punctuate " " istrs')
    idoc = prettyInstruction dex off i
formatInstructions dex addr off ws (i:is) =
  M.mconcat [ word24HexFixed addr
          , ": "
          , unitDoc
          , "|"
          , word16HexFixed (fromIntegral off)
          , ": "
          , idoc
          ] $+$ formatInstructions dex (addr + (l' * 2)) (off + l') ws' is
  where
    (iws, ws') = L.splitAt l ws
    istrs = [ word8HexFixed (fromIntegral (w .&. 0x00FF)) <>
              word8HexFixed (fromIntegral ((w .&. 0xFF00) `shiftR` 8))
            | w <- iws
            ]
    istrs' | length istrs < 8 = take 8 (istrs ++ repeat "    ")
           | otherwise = take 7 istrs ++ ["... "]
    l = insnUnitCount i
    l' = fromIntegral l
    unitDoc = M.mconcat (PP.punctuate " " istrs')
    idoc = prettyInstruction dex off i
formatInstructions dex addr off ws (i:is) =
  M.mconcat [ word24HexFixed addr
          , ": "
          , unitDoc
          , "|"
          , word16HexFixed (fromIntegral off)
          , ": "
          , idoc
          ] $+$ formatInstructions dex (addr + (l' * 2)) (off + l') ws' is
  where
    (iws, ws') = L.splitAt l ws
    istrs = [ word8HexFixed (fromIntegral (w .&. 0x00FF)) <>
              word8HexFixed (fromIntegral ((w .&. 0xFF00) `shiftR` 8))
            | w <- iws
            ]
    istrs' | length istrs < 8 = take 8 (istrs ++ repeat "    ")
           | otherwise = take 7 istrs ++ ["... "]
    l = insnUnitCount i
    l' = fromIntegral l
    unitDoc = M.mconcat (PP.punctuate " " istrs')
    idoc = prettyInstruction dex off i