Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a "type" prefix when printing type operator import specs with import lists #475

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/Language/Haskell/Exts/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,18 @@ instance Pretty (ImportSpecList l) where
(if b then text "hiding" else empty)
<+> parenList (map pretty ispecs)

instance Pretty (ImportSpec l) where
instance Pretty (ImportSpec l) where
pretty (IVar _ name ) = pretty name
pretty (IAbs _ ns name) = pretty ns <+> pretty name
pretty (IThingAll _ name) = pretty name <> text "(..)"
pretty (IThingWith _ name nameList) =
pretty name <> (parenList . map pretty $ nameList)
pretty (IThingAll _ name) = let rest = pretty name <> text "(..)" in
case name of
-- if it's a symbol, append a "type" prefix to the beginning
(Symbol _ _) -> pretty (TypeNamespace {}) <+> rest
(Ident _ _) -> rest
pretty (IThingWith _ name nameList) = let rest = pretty name <> (parenList . map pretty $ nameList) in
case name of
(Symbol _ _) -> pretty (TypeNamespace {}) <+> rest
(Ident _ _) -> rest

instance Pretty (TypeEqn l) where
pretty (TypeEqn _ pat eqn) = mySep [pretty pat, equals, pretty eqn]
Expand Down