showTerm (BinaryTerm b)
  | all (isAscii . chr . fromIntegral) (B.unpack b) =
      wrap $ "\"" ++ C.unpack b ++ "\""
  | otherwise =
      wrap $ intercalate ", " $ map show $ B.unpack b
  where
    wrap x = "<<" ++ x ++ ">>"
showTerm (BinaryTerm b)
  | all (isAscii . chr . fromIntegral) (B.unpack b) =
      wrap $ "\"" ++ C.unpack b ++ "\""
  | otherwise =
      wrap $ intercalate ", " $ map show $ B.unpack b
  where
    wrap x = "<<" ++ x ++ ">>"
showTerm (BinaryTerm b)
  | all (isAscii . chr . fromIntegral) (B.unpack b) =
      wrap $ "\"" ++ C.unpack b ++ "\""
  | otherwise =
      wrap $ intercalate ", " $ map show $ B.unpack b
  where
    wrap x = "<<" ++ x ++ ">>"