prettyArray :: ArrayTypeBase (DimDecl VName) () -> Html
prettyArray arr = case arr of
  PrimArray et (ShapeDecl ds) u _ ->
    prettyU u <> foldMap (brackets . prettyD) ds <> primTypeHtml et
  PolyArray et targs shape u _ ->
    prettyU u <> prettyShapeDecl shape <> prettyTypeName et <>
    foldMap (<> " ") (map prettyTypeArg targs)
  RecordArray fs shape u
    | Just ts <- areTupleFields fs ->
        prefix <> parens (commas $ map prettyElem ts)
    | otherwise ->
        prefix <> braces (commas $ map ppField $ M.toList fs)
    where prefix = prettyU u <> prettyShapeDecl shape
          ppField (name, tp) = toHtml (nameToString name) <>
                               ":" <> prettyElem tp
prettyArray :: ArrayTypeBase (DimDecl VName) () -> Html
prettyArray arr = case arr of
  PrimArray et (ShapeDecl ds) u _ ->
    prettyU u <> foldMap (brackets . prettyD) ds <> primTypeHtml et
  PolyArray et targs shape u _ ->
    prettyU u <> prettyShapeDecl shape <> prettyTypeName et <>
    foldMap (<> " ") (map prettyTypeArg targs)
  RecordArray fs shape u
    | Just ts <- areTupleFields fs ->
        prefix <> parens (commas $ map prettyElem ts)
    | otherwise ->
        prefix <> braces (commas $ map ppField $ M.toList fs)
    where prefix = prettyU u <> prettyShapeDecl shape
          ppField (name, tp) = toHtml (nameToString name) <>
                               ":" <> prettyElem tp
prettyArray arr = case arr of
  PrimArray et (ShapeDecl ds) u _ ->
    prettyU u <> foldMap (brackets . prettyD) ds <> primTypeHtml et
  PolyArray et targs shape u _ ->
    prettyU u <> prettyShapeDecl shape <> prettyTypeName et <>
    foldMap (<> " ") (map prettyTypeArg targs)
  RecordArray fs shape u
    | Just ts <- areTupleFields fs ->
        prefix <> parens (commas $ map prettyElem ts)
    | otherwise ->
        prefix <> braces (commas $ map ppField $ M.toList fs)
    where prefix = prettyU u <> prettyShapeDecl shape
          ppField (name, tp) = toHtml (nameToString name) <>
                               ":" <> prettyElem tp