-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
33 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import HIndent.Ast.Declaration.Instance.Class | |
import HIndent.Ast.Declaration.Instance.Family.Data | ||
import HIndent.Ast.Declaration.Instance.Family.Type | ||
import HIndent.Ast.Declaration.Signature | ||
import HIndent.Ast.Declaration.Signature.StandaloneKind | ||
import HIndent.Ast.Declaration.StandAloneDeriving | ||
import HIndent.Ast.Declaration.TypeSynonym | ||
import HIndent.Ast.NodeComments | ||
|
@@ -36,7 +37,7 @@ data Declaration | |
| StandAloneDeriving StandAloneDeriving | ||
| Bind Bind | ||
| Signature Signature | ||
| KindSigDecl (GHC.StandaloneKindSig GHC.GhcPs) | ||
| StandaloneKindSignature StandaloneKind | ||
| DefDecl (GHC.DefaultDecl GHC.GhcPs) | ||
| ForDecl (GHC.ForeignDecl GHC.GhcPs) | ||
| WarningDecl (GHC.WarnDecls GHC.GhcPs) | ||
|
@@ -57,7 +58,7 @@ instance CommentExtraction Declaration where | |
nodeComments StandAloneDeriving {} = NodeComments [] [] [] | ||
nodeComments Bind {} = NodeComments [] [] [] | ||
nodeComments Signature {} = NodeComments [] [] [] | ||
nodeComments KindSigDecl {} = NodeComments [] [] [] | ||
nodeComments StandaloneKindSignature {} = NodeComments [] [] [] | ||
nodeComments DefDecl {} = NodeComments [] [] [] | ||
nodeComments ForDecl {} = NodeComments [] [] [] | ||
nodeComments WarningDecl {} = NodeComments [] [] [] | ||
|
@@ -78,7 +79,7 @@ instance Pretty Declaration where | |
pretty' (StandAloneDeriving x) = pretty x | ||
pretty' (Bind x) = pretty x | ||
pretty' (Signature x) = pretty x | ||
pretty' (KindSigDecl x) = pretty x | ||
pretty' (StandaloneKindSignature x) = pretty x | ||
pretty' (DefDecl x) = pretty x | ||
pretty' (ForDecl x) = pretty x | ||
pretty' (WarningDecl x) = pretty x | ||
|
@@ -105,7 +106,7 @@ mkDeclaration (GHC.InstD _ [email protected] {}) = | |
mkDeclaration (GHC.DerivD _ x) = StandAloneDeriving $ mkStandAloneDeriving x | ||
mkDeclaration (GHC.ValD _ x) = Bind $ mkBind x | ||
mkDeclaration (GHC.SigD _ x) = Signature $ mkSignature x | ||
mkDeclaration (GHC.KindSigD _ x) = KindSigDecl x | ||
mkDeclaration (GHC.KindSigD _ x) = StandaloneKindSignature $ mkStandaloneKind x | ||
mkDeclaration (GHC.DefD _ x) = DefDecl x | ||
mkDeclaration (GHC.ForD _ x) = ForDecl x | ||
mkDeclaration (GHC.WarningD _ x) = WarningDecl x | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{-# LANGUAGE RecordWildCards #-} | ||
|
||
module HIndent.Ast.Declaration.Signature.StandaloneKind | ||
( StandaloneKind | ||
, mkStandaloneKind | ||
) where | ||
|
||
import qualified GHC.Hs as GHC | ||
import HIndent.Ast.NodeComments | ||
import {-# SOURCE #-} HIndent.Pretty | ||
import HIndent.Pretty.Combinators | ||
import HIndent.Pretty.NodeComments | ||
|
||
data StandaloneKind = StandaloneKind | ||
{ name :: GHC.LIdP GHC.GhcPs | ||
, kind :: GHC.LHsSigType GHC.GhcPs | ||
} | ||
|
||
instance CommentExtraction StandaloneKind where | ||
nodeComments StandaloneKind {} = NodeComments [] [] [] | ||
|
||
instance Pretty StandaloneKind where | ||
pretty' StandaloneKind {..} = | ||
spaced [string "type", pretty name, string "::", pretty kind] | ||
|
||
mkStandaloneKind :: GHC.StandaloneKindSig GHC.GhcPs -> StandaloneKind | ||
mkStandaloneKind (GHC.StandaloneKindSig _ name kind) = StandaloneKind {..} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters