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

Implement RecordField #907

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions hindent.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ library
HIndent.Ast.Declaration.Data.Haskell98.Constructor.Body
HIndent.Ast.Declaration.Data.Header
HIndent.Ast.Declaration.Data.NewOrData
HIndent.Ast.Declaration.Data.Record.Field
HIndent.Ast.Declaration.Default
HIndent.Ast.Declaration.Family.Data
HIndent.Ast.Declaration.Family.Type
Expand Down
11 changes: 8 additions & 3 deletions src/HIndent/Ast/Declaration/Data/GADT/Constructor/Signature.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module HIndent.Ast.Declaration.Data.GADT.Constructor.Signature
, prettyVertically
) where

import HIndent.Ast.Declaration.Data.Record.Field
import HIndent.Ast.NodeComments
import HIndent.Ast.Type
import HIndent.Ast.WithComments
Expand All @@ -23,7 +24,7 @@ data ConstructorSignature
, result :: WithComments Type
}
| Record
{ fields :: WithComments [GHC.LConDeclField GHC.GhcPs]
{ fields :: WithComments [WithComments RecordField]
, result :: WithComments Type
}

Expand Down Expand Up @@ -59,14 +60,18 @@ mkConstructorSignature GHC.ConDeclGADT {con_g_args = GHC.PrefixConGADT xs, ..} =
mkConstructorSignature GHC.ConDeclGADT {con_g_args = GHC.RecConGADT xs _, ..} =
Just
$ Record
{ fields = fromGenLocated xs
{ fields =
fromGenLocated
$ fmap (fmap (fmap mkRecordField . fromGenLocated)) xs
, result = mkType <$> fromGenLocated con_res_ty
}
#else
mkConstructorSignature GHC.ConDeclGADT {con_g_args = GHC.RecConGADT xs, ..} =
Just
$ Record
{ fields = fromGenLocated xs
{ fields =
fromGenLocated
$ fmap (fmap (fmap mkRecordField . fromGenLocated)) xs
, result = mkType <$> fromGenLocated con_res_ty
}
#endif
Expand Down
18 changes: 13 additions & 5 deletions src/HIndent/Ast/Declaration/Data/Haskell98/Constructor/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ module HIndent.Ast.Declaration.Data.Haskell98.Constructor.Body
, isRecord
) where

import HIndent.Ast.Declaration.Data.Record.Field
import HIndent.Ast.NodeComments
import HIndent.Ast.WithComments
import qualified HIndent.GhcLibParserWrapper.GHC.Hs as GHC
import {-# SOURCE #-} HIndent.Pretty
import HIndent.Pretty.Combinators
Expand All @@ -25,7 +27,7 @@ data Haskell98ConstructorBody
}
| Record
{ name :: GHC.LIdP GHC.GhcPs
, record :: GHC.XRec GHC.GhcPs [GHC.LConDeclField GHC.GhcPs]
, records :: WithComments [WithComments RecordField]
}

instance CommentExtraction Haskell98ConstructorBody where
Expand All @@ -42,7 +44,7 @@ instance Pretty Haskell98ConstructorBody where
ver = indentedBlock $ newlinePrefixed $ fmap pretty types
pretty' Record {..} = do
pretty name
printCommentsAnd record $ \r ->
prettyWith records $ \r ->
newline >> indentedBlock (vFields $ fmap pretty r)

mkHaskell98ConstructorBody ::
Expand All @@ -51,9 +53,15 @@ mkHaskell98ConstructorBody GHC.ConDeclH98 { con_args = GHC.InfixCon left right
, ..
} = Just Infix {name = con_name, ..}
mkHaskell98ConstructorBody GHC.ConDeclH98 {con_args = GHC.PrefixCon _ types, ..} =
Just Prefix {name = con_name, ..}
mkHaskell98ConstructorBody GHC.ConDeclH98 {con_args = GHC.RecCon record, ..} =
Just Record {name = con_name, ..}
Just Prefix {..}
where
name = con_name
mkHaskell98ConstructorBody GHC.ConDeclH98 {con_args = GHC.RecCon rs, ..} =
Just Record {..}
where
name = con_name
records =
fromGenLocated $ fmap (fmap (fmap mkRecordField . fromGenLocated)) rs
mkHaskell98ConstructorBody GHC.ConDeclGADT {} = Nothing

isRecord :: Haskell98ConstructorBody -> Bool
Expand Down
30 changes: 30 additions & 0 deletions src/HIndent/Ast/Declaration/Data/Record/Field.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{-# LANGUAGE RecordWildCards #-}

module HIndent.Ast.Declaration.Data.Record.Field
( RecordField
, mkRecordField
) where

import HIndent.Ast.NodeComments
import qualified HIndent.GhcLibParserWrapper.GHC.Hs as GHC
import {-# SOURCE #-} HIndent.Pretty
import HIndent.Pretty.Combinators
import HIndent.Pretty.NodeComments

data RecordField = RecordField
{ names :: [GHC.LFieldOcc GHC.GhcPs]
, ty :: GHC.LBangType GHC.GhcPs
}

instance CommentExtraction RecordField where
nodeComments RecordField {} = NodeComments [] [] []

instance Pretty RecordField where
pretty' RecordField {..} =
spaced [hCommaSep $ fmap pretty names, string "::", pretty ty]

mkRecordField :: GHC.ConDeclField GHC.GhcPs -> RecordField
mkRecordField GHC.ConDeclField {..} = RecordField {..}
where
names = cd_fld_names
ty = cd_fld_type
14 changes: 3 additions & 11 deletions src/HIndent/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import HIndent.Ast.Declaration
import HIndent.Ast.Declaration.Bind
import HIndent.Ast.Declaration.Data.Body
import HIndent.Ast.Declaration.Data.Record.Field
import HIndent.Ast.Declaration.Family.Type
import HIndent.Ast.Declaration.Signature
import HIndent.Ast.NodeComments
Expand All @@ -54,7 +55,7 @@
import qualified Language.Haskell.GhclibParserEx.GHC.Hs.Expr as GHC
import Text.Show.Unicode
#if MIN_VERSION_ghc_lib_parser(9,6,1)
import qualified Data.Foldable as NonEmpty

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.2.8)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.2.8)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.4.8)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.4.8)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.6.4)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.6.4)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.8.1)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.8.1)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.2.8)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.2.8)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.4.8)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.4.8)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.2.8)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.2.8)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.8.1)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.8.1)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.6.4)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.6.4)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

The qualified import of `Data.Foldable' is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

The qualified import of `Data.Foldable' is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

The qualified import of `Data.Foldable' is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

The qualified import of `Data.Foldable' is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.6.4)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.6.4)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.4.8)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.4.8)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.8.1)

The qualified import of ‘Data.Foldable’ is redundant

Check warning on line 58 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.8.1)

The qualified import of ‘Data.Foldable’ is redundant
import qualified GHC.Core.DataCon as GHC
#endif
#if !MIN_VERSION_ghc_lib_parser(9,6,1)
Expand Down Expand Up @@ -544,7 +545,7 @@
prettyMatchExpr GHC.Match {m_ctxt = GHC.LambdaExpr, ..} = do
string "\\"
unless (null m_pats)
$ case GHC.unLoc $ head m_pats of

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.8.1)

In the use of ‘head’

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.8.1)

In the use of ‘head’

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

In the use of ‘head’

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

In the use of ‘head’

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

In the use of ‘head’

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

In the use of ‘head’

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.8.1)

In the use of ‘head’

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.8.1)

In the use of ‘head’

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

In the use of ‘head’

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

In the use of ‘head’

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

In the use of ‘head’

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

In the use of ‘head’

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

In the use of `head'

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

In the use of `head'

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

In the use of `head'

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

In the use of `head'

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.8.1)

In the use of ‘head’

Check warning on line 548 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.8.1)

In the use of ‘head’
GHC.LazyPat {} -> space
GHC.BangPat {} -> space
_ -> return ()
Expand Down Expand Up @@ -583,7 +584,7 @@
prettyMatchProc GHC.Match {m_ctxt = GHC.LambdaExpr, ..} = do
string "\\"
unless (null m_pats)
$ case GHC.unLoc $ head m_pats of

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.8.1)

In the use of ‘head’

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.8.1)

In the use of ‘head’

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

In the use of ‘head’

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

In the use of ‘head’

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

In the use of ‘head’

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

In the use of ‘head’

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.8.1)

In the use of ‘head’

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.8.1)

In the use of ‘head’

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

In the use of ‘head’

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

In the use of ‘head’

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

In the use of ‘head’

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

In the use of ‘head’

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

In the use of `head'

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

In the use of `head'

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

In the use of `head'

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

In the use of `head'

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.8.1)

In the use of ‘head’

Check warning on line 587 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.8.1)

In the use of ‘head’
GHC.LazyPat {} -> space
GHC.BangPat {} -> space
_ -> return ()
Expand Down Expand Up @@ -773,7 +774,8 @@
prettyHsType (GHC.HsSpliceTy _ sp) = pretty sp
prettyHsType GHC.HsDocTy {} = docNode
prettyHsType (GHC.HsBangTy _ pack x) = pretty pack >> pretty x
prettyHsType (GHC.HsRecTy _ xs) = hvFields $ fmap pretty xs
prettyHsType (GHC.HsRecTy _ xs) =
hvFields $ fmap (pretty . fmap mkRecordField . fromGenLocated) xs
prettyHsType (GHC.HsExplicitListTy _ _ xs) =
case xs of
[] -> string "'[]"
Expand Down Expand Up @@ -1140,16 +1142,6 @@
instance Pretty a => Pretty (GHC.HsScaled GHC.GhcPs a) where
pretty' (GHC.HsScaled _ x) = pretty x

instance Pretty (GHC.ConDeclField GHC.GhcPs) where
pretty' GHC.ConDeclField {..}
-- Here, we *ignore* the 'cd_fld_doc' field because doc strings are
-- also stored as comments, and printing both results in duplicated
-- comments.
= do
hCommaSep $ fmap pretty cd_fld_names
string " :: "
pretty cd_fld_type

instance Pretty InfixExpr where
pretty' (InfixExpr (GHC.L _ (GHC.HsVar _ bind))) = pretty $ fmap InfixOp bind
pretty' (InfixExpr x) = pretty' x
Expand Down Expand Up @@ -1224,7 +1216,7 @@
pretty' (GHC.DctMulti _ ts) = hvTuple $ fmap pretty ts

instance Pretty GHC.OverlapMode where
pretty' GHC.NoOverlap {} = notUsedInParsedStage

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.4.8)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.6.4)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.8.1)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.4.8)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.8.1)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.6.4)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.6.4)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.4.8)

Pattern match(es) are non-exhaustive

Check warning on line 1219 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.8.1)

Pattern match(es) are non-exhaustive
pretty' GHC.Overlappable {} = string "{-# OVERLAPPABLE #-}"
pretty' GHC.Overlapping {} = string "{-# OVERLAPPING #-}"
pretty' GHC.Overlaps {} = string "{-# OVERLAPS #-}"
Expand Down Expand Up @@ -1341,8 +1333,8 @@
[] -> pure ()
[x'] -> string x'
xs -> do
string $ head xs

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.8.1)

In the use of ‘head’

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.8.1)

In the use of ‘head’

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

In the use of ‘head’

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

In the use of ‘head’

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

In the use of ‘head’

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, nightly)

In the use of ‘head’

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.8.1)

In the use of ‘head’

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.8.1)

In the use of ‘head’

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

In the use of ‘head’

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

In the use of ‘head’

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

In the use of ‘head’

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-latest, nightly)

In the use of ‘head’

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

In the use of `head'

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

In the use of `head'

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

In the use of `head'

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, nightly)

In the use of `head'

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.8.1)

In the use of ‘head’

Check warning on line 1336 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.8.1)

In the use of ‘head’
indentedWithFixedLevel 0 $ newlinePrefixed $ string <$> tail xs

Check warning on line 1337 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.8.1)

In the use of ‘tail’

Check warning on line 1337 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.8.1)

In the use of ‘tail’

Check warning on line 1337 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.8.1)

In the use of ‘tail’

Check warning on line 1337 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.8.1)

In the use of ‘tail’

Check warning on line 1337 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.8.1)

In the use of ‘tail’

Check warning on line 1337 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.8.1)

In the use of ‘tail’
pretty' (GHC.IEModuleContents _ name) =
pretty $ fmap ModuleNameWithPrefix name
pretty' GHC.IEGroup {} = docNode
Expand Down Expand Up @@ -1523,7 +1515,7 @@
pretty' (GHC.HsFloatPrim _ x) = pretty x >> string "#"
pretty' GHC.HsDoublePrim {} = notUsedInParsedStage
pretty' x =
case x of

Check warning on line 1518 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 8.10.7)

Pattern match(es) are non-exhaustive

Check warning on line 1518 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.4.8)

Pattern match(es) are non-exhaustive

Check warning on line 1518 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.6.4)

Pattern match(es) are non-exhaustive

Check warning on line 1518 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.8.1)

Pattern match(es) are non-exhaustive

Check warning on line 1518 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 8.10.7)

Pattern match(es) are non-exhaustive

Check warning on line 1518 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.4.8)

Pattern match(es) are non-exhaustive

Check warning on line 1518 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.8.1)

Pattern match(es) are non-exhaustive

Check warning on line 1518 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.6.4)

Pattern match(es) are non-exhaustive

Check warning on line 1518 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 8.10.7)

Pattern match(es) are non-exhaustive

Check warning on line 1518 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.6.4)

Pattern match(es) are non-exhaustive

Check warning on line 1518 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.4.8)

Pattern match(es) are non-exhaustive

Check warning on line 1518 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.8.1)

Pattern match(es) are non-exhaustive
GHC.HsString {} -> prettyString
GHC.HsStringPrim {} -> prettyString
where
Expand Down Expand Up @@ -1655,7 +1647,7 @@
string p |=> pretty (fmap StmtLRInsideVerticalList x)
newline
string "]"
stmtsAndPrefixes l = ("| ", head l) : fmap (", ", ) (tail l)

Check warning on line 1650 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.8.1)

In the use of ‘head’

Check warning on line 1650 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.8.1)

In the use of ‘tail’

Check warning on line 1650 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.8.1)

In the use of ‘head’

Check warning on line 1650 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest, 9.8.1)

In the use of ‘tail’

Check warning on line 1650 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.8.1)

In the use of ‘head’

Check warning on line 1650 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.8.1)

In the use of ‘tail’

Check warning on line 1650 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.8.1)

In the use of ‘head’

Check warning on line 1650 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (windows-latest, 9.8.1)

In the use of ‘tail’

Check warning on line 1650 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.8.1)

In the use of ‘head’

Check warning on line 1650 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.8.1)

In the use of ‘tail’

Check warning on line 1650 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.8.1)

In the use of ‘head’

Check warning on line 1650 in src/HIndent/Pretty.hs

View workflow job for this annotation

GitHub Actions / CI (macos-13, 9.8.1)

In the use of ‘tail’

instance Pretty DoExpression where
pretty' DoExpression {..} = do
Expand Down
5 changes: 1 addition & 4 deletions src/HIndent/Pretty.hs-boot
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ instance Pretty

instance Pretty GHC.RdrName

instance Pretty (GHC.ConDeclField GHC.GhcPs)

instance Pretty (GHC.HsOuterTyVarBndrs GHC.Specificity GHc.GhcPs)

instance Pretty SigBindFamily
Expand Down Expand Up @@ -80,7 +78,6 @@ instance Pretty PatInsidePatDecl

instance Pretty GHC.StringLiteral


instance Pretty (GHC.HsSigType GHC.GhcPs)

instance Pretty Context
Expand All @@ -106,4 +103,4 @@ instance Pretty (GHC.HsUntypedSplice GHC.GhcPs)
#else
instance Pretty (GHC.HsSplice GHC.GhcPs)
#endif

instance Pretty (GHC.FieldOcc GHC.GhcPs)
Loading