on master help sign in
Add MinimalSig printer
4955cdcBasile Henry
data/examples/declaration/signature/minimal/minimal-out.hsnew file+12
@@ -0,0 +1,12 @@
1+class Foo a where
2+ {-# MINIMAL (==) | ((/=), foo) #-}
3+ {-# MINIMAL
4+ a
5+ | ( b, c, d
6+ | e
7+ , f
8+ )
9+ | g
10+ #-}
11+ (==) :: a -> a -> Bool
12+ (/=) :: a -> a -> Bool
data/examples/declaration/signature/minimal/minimal.hsnew file+10
@@ -0,0 +1,10 @@
1+class Foo a where
2+
3+ {-# MINIMAL (==) |( (/=) , foo) #-}
4+
5+ {-# MINIMAL a | (b , c , d | e
6+ , f)
7+ | g #-}
8+
9+ (==) :: a -> a -> Bool
10+ (/=) :: a -> a -> Bool
src/Ormolu/Imports.hs+12−12
@@ -14,7 +14,7 @@ import Data.List (sortBy)
14import GHC hiding (GhcPs, IE)
14import GHC hiding (GhcPs, IE)
15import HsExtension
15import HsExtension
16import HsImpExp (IE (..))
16import HsImpExp (IE (..))
17−import Ormolu.Utils (unL, notImplemented)
17+import Ormolu.Utils (notImplemented)
18
18
19-- | Sort imports by module name. This also sorts explicit import lists for
19-- | Sort imports by module name. This also sorts explicit import lists for
20-- each declaration.
20-- each declaration.
@@ -37,21 +37,21 @@ compareIdecl (L _ m0) (L _ m1) =
37 then LT
37 then LT
38 else n0 `compare` n1
38 else n0 `compare` n1
39 where
39 where
40− n0 = unL (ideclName m0)
40+ n0 = unLoc (ideclName m0)
41− n1 = unL (ideclName m1)
41+ n1 = unLoc (ideclName m1)
42 isPrelude = (== "Prelude") . moduleNameString
42 isPrelude = (== "Prelude") . moduleNameString
43
43
44-- | Sort located import or export.
44-- | Sort located import or export.
45
45
46sortLies :: [LIE GhcPs] -> [LIE GhcPs]
46sortLies :: [LIE GhcPs] -> [LIE GhcPs]
47−sortLies = sortBy (compareIE `on` unL) . fmap (fmap sortThings)
47+sortLies = sortBy (compareIE `on` unLoc) . fmap (fmap sortThings)
48
48
49-- | Sort imports\/exports inside of 'IEThingWith'.
49-- | Sort imports\/exports inside of 'IEThingWith'.
50
50
51sortThings :: IE GhcPs -> IE GhcPs
51sortThings :: IE GhcPs -> IE GhcPs
52sortThings = \case
52sortThings = \case
53 IEThingWith NoExt x w xs fl ->
53 IEThingWith NoExt x w xs fl ->
54− IEThingWith NoExt x w (sortBy (compareIewn `on` unL) xs) fl
54+ IEThingWith NoExt x w (sortBy (compareIewn `on` unLoc) xs) fl
55 other -> other
55 other -> other
56
56
57-- | Compare two located imports or exports.
57-- | Compare two located imports or exports.
@@ -63,10 +63,10 @@ compareIE = compareIewn `on` getIewn
63
63
64getIewn :: IE GhcPs -> IEWrappedName RdrName
64getIewn :: IE GhcPs -> IEWrappedName RdrName
65getIewn = \case
65getIewn = \case
66− IEVar NoExt x -> unL x
66+ IEVar NoExt x -> unLoc x
67− IEThingAbs NoExt x -> unL x
67+ IEThingAbs NoExt x -> unLoc x
68− IEThingAll NoExt x -> unL x
68+ IEThingAll NoExt x -> unLoc x
69− IEThingWith NoExt x _ _ _ -> unL x
69+ IEThingWith NoExt x _ _ _ -> unLoc x
70 IEModuleContents NoExt _ -> notImplemented "IEModuleContents"
70 IEModuleContents NoExt _ -> notImplemented "IEModuleContents"
71 IEGroup NoExt _ _ -> notImplemented "IEGroup"
71 IEGroup NoExt _ _ -> notImplemented "IEGroup"
72 IEDoc NoExt _ -> notImplemented "IEDoc"
72 IEDoc NoExt _ -> notImplemented "IEDoc"
@@ -76,12 +76,12 @@ getIewn = \case
76-- | Compare two @'IEWrapppedName' 'RdrName'@ things.
76-- | Compare two @'IEWrapppedName' 'RdrName'@ things.
77
77
78compareIewn :: IEWrappedName RdrName -> IEWrappedName RdrName -> Ordering
78compareIewn :: IEWrappedName RdrName -> IEWrappedName RdrName -> Ordering
79−compareIewn (IEName x) (IEName y) = unL x `compare` unL y
79+compareIewn (IEName x) (IEName y) = unLoc x `compare` unLoc y
80compareIewn (IEName _) (IEPattern _) = LT
80compareIewn (IEName _) (IEPattern _) = LT
81compareIewn (IEName _) (IEType _) = LT
81compareIewn (IEName _) (IEType _) = LT
82compareIewn (IEPattern _) (IEName _) = GT
82compareIewn (IEPattern _) (IEName _) = GT
83−compareIewn (IEPattern x) (IEPattern y) = unL x `compare` unL y
83+compareIewn (IEPattern x) (IEPattern y) = unLoc x `compare` unLoc y
84compareIewn (IEPattern _) (IEType _) = LT
84compareIewn (IEPattern _) (IEType _) = LT
85compareIewn (IEType _) (IEName _) = GT
85compareIewn (IEType _) (IEName _) = GT
86compareIewn (IEType _) (IEPattern _) = GT
86compareIewn (IEType _) (IEPattern _) = GT
87−compareIewn (IEType x) (IEType y) = unL x `compare` unL y
87+compareIewn (IEType x) (IEType y) = unLoc x `compare` unLoc y
src/Ormolu/Printer/Combinators.hs+11−13
@@ -50,7 +50,7 @@ import Data.List (intersperse)
50import Data.Text (Text)
50import Data.Text (Text)
51import Ormolu.Printer.Comments
51import Ormolu.Printer.Comments
52import Ormolu.Printer.Internal
52import Ormolu.Printer.Internal
53−import Ormolu.Utils (unL, getSpan, isModule)
53+import Ormolu.Utils (isModule)
54import Outputable (Outputable (..), showSDocUnsafe)
54import Outputable (Outputable (..), showSDocUnsafe)
55import SrcLoc
55import SrcLoc
56import qualified Data.Text as T
56import qualified Data.Text as T
@@ -101,15 +101,15 @@ locatedVia ml loc f = do
101 RealSrcSpan l' -> g (L l' a)
101 RealSrcSpan l' -> g (L l' a)
102 withRealLocated loc spitPrecedingComments
102 withRealLocated loc spitPrecedingComments
103 let setEnclosingSpan =
103 let setEnclosingSpan =
104− case getSpan loc of
104+ case getLoc loc of
105 UnhelpfulSpan _ -> id
105 UnhelpfulSpan _ -> id
106 RealSrcSpan orf ->
106 RealSrcSpan orf ->
107− if isModule (unL loc)
107+ if isModule (unLoc loc)
108 then id
108 then id
109 else withEnclosingSpan orf
109 else withEnclosingSpan orf
110 setEnclosingSpan $ case ml of
110 setEnclosingSpan $ case ml of
111− Nothing -> f (unL loc)
111+ Nothing -> f (unLoc loc)
112− Just l' -> switchLayout l' (f (unL loc))
112+ Just l' -> switchLayout l' (f (unLoc loc))
113 withRealLocated loc spitFollowingComments
113 withRealLocated loc spitFollowingComments
114
114
115-- | A version of 'located' with arguments flipped.
115-- | A version of 'located' with arguments flipped.
@@ -271,19 +271,17 @@ pragmaBraces m = sitcc $ do
271 vlayout space (newline >> txt " ")
271 vlayout space (newline >> txt " ")
272 txt "#-}"
272 txt "#-}"
273
273
274−-- | This surrounds the body in a pragma, which includes the 'pragmaBraces' and
274+-- | Surround the body with a pragma name and 'pragmaBraces'.
275−--- the keyword for the pragma. It also takes a 'SrcSpan', which should be the
276−--- combined span of the body. This means multiline layouts are only triggered
277−--- when the body spans multiple lines, not just when the braces or pragma
278−--- keyword do.
279
275
280−pragma :: SrcSpan -> Text -> R () -> R ()
276+pragma
277+ :: Text -- ^ Pragma text
278+ -> R () -- ^ Pragma body
279+ -> R ()
281−pragma srcSpan pragmaText body = switchLayout srcSpan . pragmaBraces $ do
280+pragma pragmaText body = pragmaBraces $ do
282 txt pragmaText
281 txt pragmaText
283 breakpoint
282 breakpoint
284 inci body
283 inci body
285
284
286−
287-- | Surround given entity by optional space before and a newline after, iff
285-- | Surround given entity by optional space before and a newline after, iff
288-- current layout is multiline.
286-- current layout is multiline.
289
287
src/Ormolu/Printer/Comments.hs+2−2
@@ -18,7 +18,7 @@ import Data.Data (Data)
18import Data.Maybe (isJust)
18import Data.Maybe (isJust)
19import Ormolu.CommentStream
19import Ormolu.CommentStream
20import Ormolu.Printer.Internal
20import Ormolu.Printer.Internal
21−import Ormolu.Utils (isModule, getSpan)
21+import Ormolu.Utils (isModule)
22import SrcLoc
22import SrcLoc
23import qualified Data.List.NonEmpty as NE
23import qualified Data.List.NonEmpty as NE
24import qualified Data.Text as T
24import qualified Data.Text as T
@@ -41,7 +41,7 @@ spitFollowingComments
41 => RealLocated a -- ^ AST element of attach comments to
41 => RealLocated a -- ^ AST element of attach comments to
42 -> R ()
42 -> R ()
43spitFollowingComments ref = do
43spitFollowingComments ref = do
44− trimSpanStream (getSpan ref)
44+ trimSpanStream (getLoc ref)
45 handleCommentSeries (spitFollowingComment ref)
45 handleCommentSeries (spitFollowingComment ref)
46
46
47-- | Output all remaining comments in the comment stream.
47-- | Output all remaining comments in the comment stream.
src/Ormolu/Printer/Meat/Declaration/Data.hs+3−3
@@ -42,13 +42,13 @@ p_dataDecl style name tpats HsDataDefn {..} = do
42 space
42 space
43 txt ":: "
43 txt ":: "
44 located k p_hsType
44 located k p_hsType
45− let gadt = isJust dd_kindSig || any (isGadt . unL) dd_cons
45+ let gadt = isJust dd_kindSig || any (isGadt . unLoc) dd_cons
46 if gadt
46 if gadt
47 then do
47 then do
48 txt " where"
48 txt " where"
49 newline
49 newline
50 inci $ newlineSep (sitcc . located' p_conDecl) dd_cons
50 inci $ newlineSep (sitcc . located' p_conDecl) dd_cons
51− else switchLayout (combineSrcSpans' (getSpan name :| (getSpan <$> dd_cons))) $ do
51+ else switchLayout (combineSrcSpans' (getLoc name :| (getLoc <$> dd_cons))) $ do
52 breakpoint
52 breakpoint
53 inci $ do
53 inci $ do
54 txt "= "
54 txt "= "
@@ -76,7 +76,7 @@ p_conDecl = \case
76 txt "-> "
76 txt "-> "
77 RecCon l -> do
77 RecCon l -> do
78 located l p_conDeclFields
78 located l p_conDeclFields
79− unless (null $ unL l) $ do
79+ unless (null $ unLoc l) $ do
80 breakpoint
80 breakpoint
81 txt "-> "
81 txt "-> "
82 InfixCon _ _ -> notImplemented "InfixCon"
82 InfixCon _ _ -> notImplemented "InfixCon"
src/Ormolu/Printer/Meat/Declaration/Signature.hs+22
@@ -12,6 +12,7 @@ module Ormolu.Printer.Meat.Declaration.Signature
12where
12where
13
13
14import BasicTypes
14import BasicTypes
15+import BooleanFormula
15import Control.Monad
16import Control.Monad
16import GHC
17import GHC
17import Ormolu.Printer.Combinators
18import Ormolu.Printer.Combinators
@@ -30,6 +31,7 @@ p_sigDecl' = \case
30 FixSig NoExt sig -> p_fixSig sig
31 FixSig NoExt sig -> p_fixSig sig
31 InlineSig NoExt name inlinePragma -> p_inlineSig name inlinePragma
32 InlineSig NoExt name inlinePragma -> p_inlineSig name inlinePragma
32 SpecSig NoExt name ts inlinePragma -> p_specSig name ts inlinePragma
33 SpecSig NoExt name ts inlinePragma -> p_specSig name ts inlinePragma
34+ MinimalSig NoExt _ booleanFormula -> p_minimalSig booleanFormula
33 _ -> notImplemented "certain types of signature declarations"
35 _ -> notImplemented "certain types of signature declarations"
34
36
35p_typeSig
37p_typeSig
@@ -135,3 +137,23 @@ p_activation = \case
135 atom n
137 atom n
136 txt "]"
138 txt "]"
137 space
139 space
140+
141+p_minimalSig
142+ :: LBooleanFormula (Located RdrName) -- ^ Boolean formula
143+ -> R ()
144+p_minimalSig =
145+ located' $ \booleanFormula ->
146+ pragma "MINIMAL" (p_booleanFormula booleanFormula)
147+
148+p_booleanFormula
149+ :: BooleanFormula (Located RdrName) -- ^ Boolean formula
150+ -> R ()
151+p_booleanFormula = \case
152+ Var name -> p_rdrName name
153+ And xs -> velt $
154+ withSep comma (located' p_booleanFormula) xs
155+ Or xs -> velt $
156+ withSep (vlayout space (return ()) >> txt "| ")
157+ (located' p_booleanFormula)
158+ xs
159+ Parens l -> located l (parens . p_booleanFormula)
src/Ormolu/Printer/Meat/Declaration/TypeFamily.hs+2−2
@@ -32,7 +32,7 @@ p_famDecl style FamilyDecl {..} = do
32 Free -> " family"
32 Free -> " family"
33 let HsQTvs {..} = fdTyVars
33 let HsQTvs {..} = fdTyVars
34 combinedSpans = combineSrcSpans' $
34 combinedSpans = combineSrcSpans' $
35− getSpan fdLName :| fmap getSpan hsq_explicit
35+ getLoc fdLName :| fmap getLoc hsq_explicit
36 breakpoint
36 breakpoint
37 inci $ do
37 inci $ do
38 switchLayout combinedSpans $ do
38 switchLayout combinedSpans $ do
@@ -88,7 +88,7 @@ p_tyFamInstEqn :: TyFamInstEqn GhcPs -> R ()
88p_tyFamInstEqn HsIB {..} = do
88p_tyFamInstEqn HsIB {..} = do
89 let FamEqn {..} = hsib_body
89 let FamEqn {..} = hsib_body
90 combinedSpans = combineSrcSpans' $
90 combinedSpans = combineSrcSpans' $
91− getSpan feqn_tycon :| fmap getSpan feqn_pats
91+ getLoc feqn_tycon :| fmap getLoc feqn_pats
92 switchLayout combinedSpans $ p_infixDefHelper
92 switchLayout combinedSpans $ p_infixDefHelper
93 (isInfix feqn_fixity)
93 (isInfix feqn_fixity)
94 inci
94 inci
src/Ormolu/Printer/Meat/Declaration/Value.hs+9−9
@@ -97,7 +97,7 @@ p_match style isInfix m_pats m_grhss = do
97 _ -> return ()
97 _ -> return ()
98 Just ne_pats -> do
98 Just ne_pats -> do
99 let combinedSpans = combineSrcSpans' $
99 let combinedSpans = combineSrcSpans' $
100− getSpan <$> ne_pats
100+ getLoc <$> ne_pats
101 inci' = if isOneLineSpan combinedSpans
101 inci' = if isOneLineSpan combinedSpans
102 then id
102 then id
103 else inci
103 else inci
@@ -127,7 +127,7 @@ p_match style isInfix m_pats m_grhss = do
127 Case -> unless hasGuards (txt " ->")
127 Case -> unless hasGuards (txt " ->")
128 _ -> txt " ->"
128 _ -> txt " ->"
129 let combinedSpans = combineSrcSpans' $
129 let combinedSpans = combineSrcSpans' $
130− getGRHSSpan . unL <$> NE.fromList grhssGRHSs
130+ getGRHSSpan . unLoc <$> NE.fromList grhssGRHSs
131 placement = blockPlacement grhssGRHSs
131 placement = blockPlacement grhssGRHSs
132 inciLocalBinds = case placement of
132 inciLocalBinds = case placement of
133 Normal -> id
133 Normal -> id
@@ -142,7 +142,7 @@ p_match style isInfix m_pats m_grhss = do
142 _ -> EqualSign
142 _ -> EqualSign
143 newlineSep (located' (p_grhs groupStyle)) grhssGRHSs
143 newlineSep (located' (p_grhs groupStyle)) grhssGRHSs
144 unless
144 unless
145− (GHC.isEmptyLocalBindsPR (unL grhssLocalBinds))
145+ (GHC.isEmptyLocalBindsPR (unLoc grhssLocalBinds))
146 (inciLocalBinds $ do
146 (inciLocalBinds $ do
147 newline
147 newline
148 line (txt "where")
148 line (txt "where")
@@ -195,8 +195,8 @@ p_hsLocalBinds :: HsLocalBindsLR GhcPs GhcPs -> R ()
195p_hsLocalBinds = \case
195p_hsLocalBinds = \case
196 HsValBinds NoExt (ValBinds NoExt bag lsigs) -> do
196 HsValBinds NoExt (ValBinds NoExt bag lsigs) -> do
197 let ssStart = either
197 let ssStart = either
198− (srcSpanStart . getSpan)
198+ (srcSpanStart . getLoc)
199− (srcSpanStart . getSpan)
199+ (srcSpanStart . getLoc)
200 items =
200 items =
201 (Left <$> bagToList bag) ++ (Right <$> lsigs)
201 (Left <$> bagToList bag) ++ (Right <$> lsigs)
202 p_item (Left x) = located x p_valDecl'
202 p_item (Left x) = located x p_valDecl'
@@ -261,7 +261,7 @@ p_hsExpr = \case
261 located x p_hsExpr
261 located x p_hsExpr
262 space
262 space
263 located op p_hsExpr
263 located op p_hsExpr
264− placeHanging (exprPlacement (unL y)) $
264+ placeHanging (exprPlacement (unLoc y)) $
265 located y p_hsExpr
265 located y p_hsExpr
266 NegApp NoExt e _ -> do
266 NegApp NoExt e _ -> do
267 txt "-"
267 txt "-"
@@ -276,7 +276,7 @@ p_hsExpr = \case
276 breakpoint
276 breakpoint
277 inci (located x p_hsExpr)
277 inci (located x p_hsExpr)
278 ExplicitTuple NoExt args boxity -> do
278 ExplicitTuple NoExt args boxity -> do
279− let isSection = any (isMissing . unL) args
279+ let isSection = any (isMissing . unLoc) args
280 isMissing = \case
280 isMissing = \case
281 Missing NoExt -> True
281 Missing NoExt -> True
282 _ -> False
282 _ -> False
@@ -566,7 +566,7 @@ p_quasiQuote quoter m = do
566-- Helpers
566-- Helpers
567
567
568getGRHSSpan :: GRHS GhcPs (LHsExpr GhcPs) -> SrcSpan
568getGRHSSpan :: GRHS GhcPs (LHsExpr GhcPs) -> SrcSpan
569−getGRHSSpan (GRHS NoExt _ body) = getSpan body
569+getGRHSSpan (GRHS NoExt _ body) = getLoc body
570getGRHSSpan (XGRHS NoExt) = notImplemented "XGRHS"
570getGRHSSpan (XGRHS NoExt) = notImplemented "XGRHS"
571
571
572-- | Place a thing that may have a hanging form. This function handles how
572-- | Place a thing that may have a hanging form. This function handles how
@@ -602,7 +602,7 @@ exprPlacement = \case
602 _ -> Normal
602 _ -> Normal
603
603
604withGuards :: [LGRHS GhcPs (LHsExpr GhcPs)] -> Bool
604withGuards :: [LGRHS GhcPs (LHsExpr GhcPs)] -> Bool
605−withGuards = any (checkOne . unL)
605+withGuards = any (checkOne . unLoc)
606 where
606 where
607 checkOne :: GRHS GhcPs (LHsExpr GhcPs) -> Bool
607 checkOne :: GRHS GhcPs (LHsExpr GhcPs) -> Bool
608 checkOne (GRHS NoExt [] _) = False
608 checkOne (GRHS NoExt [] _) = False
src/Ormolu/Printer/Meat/Module.hs+6−5
@@ -23,6 +23,7 @@ import Ormolu.Printer.Meat.Declaration
23import Ormolu.Printer.Meat.ImportExport
23import Ormolu.Printer.Meat.ImportExport
24import Ormolu.Utils
24import Ormolu.Utils
25import SrcLoc (combineSrcSpans)
25import SrcLoc (combineSrcSpans)
26+import qualified Data.List.NonEmpty as NE
26
27
27p_hsModule :: ParsedSource -> R ()
28p_hsModule :: ParsedSource -> R ()
28p_hsModule loc@(L moduleSpan hsModule) = do
29p_hsModule loc@(L moduleSpan hsModule) = do
@@ -38,7 +39,7 @@ p_hsModule loc@(L moduleSpan hsModule) = do
38 Nothing -> pure ()
39 Nothing -> pure ()
39 Just hsmodName' -> line $ do
40 Just hsmodName' -> line $ do
40 located hsmodName' p_hsmodName
41 located hsmodName' p_hsmodName
41− maybe (pure ()) (located' p_warningTxt) hsmodDeprecMessage
42+ forM_ hsmodDeprecMessage (located' p_warningTxt)
42 case hsmodExports of
43 case hsmodExports of
43 Nothing -> return ()
44 Nothing -> return ()
44 Just hsmodExports' -> do
45 Just hsmodExports' -> do
@@ -55,7 +56,7 @@ p_hsModule loc@(L moduleSpan hsModule) = do
55 case md of
56 case md of
56 Nothing -> located d p_hsDecl
57 Nothing -> located d p_hsDecl
57 Just d' ->
58 Just d' ->
58− if separatedDecls (unL d) (unL d')
59+ if separatedDecls (unLoc d) (unLoc d')
59 then line (located d p_hsDecl)
60 then line (located d p_hsDecl)
60 else located d p_hsDecl
61 else located d p_hsDecl
61
62
@@ -63,7 +64,7 @@ p_hsModule loc@(L moduleSpan hsModule) = do
63 when (trailingComments && isJust hsmodName) newline
64 when (trailingComments && isJust hsmodName) newline
64 spitRemainingComments
65 spitRemainingComments
65
66
66−-- | Layout the WARNING/DEPRECATED pragmas in the module head
67+-- | Layout the WARNING\/DEPRECATED pragmas in the module head.
67
68
68p_warningTxt :: WarningTxt -> R ()
69p_warningTxt :: WarningTxt -> R ()
69p_warningTxt = \case
70p_warningTxt = \case
@@ -73,10 +74,10 @@ p_warningTxt = \case
73 p_pragma :: Text -> [Located StringLiteral] -> R ()
74 p_pragma :: Text -> [Located StringLiteral] -> R ()
74 p_pragma pragmaText lits = switchLayout (litsSpan lits) $ do
75 p_pragma pragmaText lits = switchLayout (litsSpan lits) $ do
75 breakpoint
76 breakpoint
76− inci $ pragma (litsSpan lits) pragmaText (p_lits lits)
77+ inci $ pragma pragmaText (p_lits lits)
77
78
78 litsSpan :: [Located StringLiteral] -> SrcSpan
79 litsSpan :: [Located StringLiteral] -> SrcSpan
79− litsSpan lits = combineSrcSpans (getLoc $ head lits) (getLoc $ last lits)
80+ litsSpan lits = combineSrcSpans' (getLoc <$> NE.fromList lits)
80
81
81 p_lits :: [Located StringLiteral] -> R ()
82 p_lits :: [Located StringLiteral] -> R ()
82 p_lits = \case
83 p_lits = \case
src/Ormolu/Utils.hs−12
@@ -3,8 +3,6 @@
3module Ormolu.Utils
3module Ormolu.Utils
4 ( combineSrcSpans'
4 ( combineSrcSpans'
5 , isModule
5 , isModule
6− , unL
7− , getSpan
8 , notImplemented
6 , notImplemented
9 )
7 )
10where
8where
@@ -23,16 +21,6 @@ combineSrcSpans' (x:|xs) = foldr combineSrcSpans x xs
23isModule :: Data a => a -> Bool
21isModule :: Data a => a -> Bool
24isModule x = showConstr (toConstr x) == "HsModule"
22isModule x = showConstr (toConstr x) == "HsModule"
25
23
26−-- | Exact inner value from a 'Located' thing.
27−
28−unL :: GenLocated l e -> e
29−unL (L _ e) = e
30−
31−-- | Get source span from a 'Located' thing.
32−
33−getSpan :: GenLocated l e -> l
34−getSpan (L spn _) = spn
35−
36-- | Placeholder for things that are not yet implemented.
24-- | Placeholder for things that are not yet implemented.
37
25
38notImplemented :: String -> a
26notImplemented :: String -> a