Skip to content

Commit 4e2e060

Browse files
committed
+HasCallStack
1 parent 8a62993 commit 4e2e060

File tree

8 files changed

+41
-31
lines changed

8 files changed

+41
-31
lines changed

Cabal-syntax/src/Distribution/Compat/Graph.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ import qualified Data.Set as Set
105105
import qualified Data.Tree as Tree
106106
import qualified Distribution.Compat.Prelude as Prelude
107107

108+
import GHC.Stack (HasCallStack)
109+
108110
-- | A graph of nodes @a@. The nodes are expected to have instance
109111
-- of class 'IsNode'.
110112
data Graph a = Graph
@@ -377,7 +379,7 @@ fromMap m =
377379
bounds = (0, Map.size m - 1)
378380

379381
-- | /O(V log V)/. Convert a list of nodes (with distinct keys) into a graph.
380-
fromDistinctList :: (IsNode a, Show (Key a)) => [a] -> Graph a
382+
fromDistinctList :: (HasCallStack, IsNode a, Show (Key a)) => [a] -> Graph a
381383
fromDistinctList =
382384
fromMap
383385
. Map.fromListWith (\_ -> duplicateError)

Cabal-syntax/src/Distribution/FieldGrammar/Class.hs

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import Distribution.FieldGrammar.Newtypes
2323
import Distribution.Fields.Field
2424
import Distribution.Utils.ShortText
2525

26+
import GHC.Stack (HasCallStack)
27+
2628
-- | 'FieldGrammar' is parametrised by
2729
--
2830
-- * @s@ which is a structure we are parsing. We need this to provide prettyprinter
@@ -43,11 +45,11 @@ class
4345
| g -> c
4446
where
4547
-- | Unfocus, zoom out, /blur/ 'FieldGrammar'.
46-
blurFieldGrammar :: ALens' a b -> g b d -> g a d
48+
blurFieldGrammar :: HasCallStack => ALens' a b -> g b d -> g a d
4749

4850
-- | Field which should be defined, exactly once.
4951
uniqueFieldAla
50-
:: (c b, Newtype a b)
52+
:: (c b, Newtype a b, HasCallStack)
5153
=> FieldName
5254
-- ^ field name
5355
-> (a -> b)
@@ -58,7 +60,7 @@ class
5860

5961
-- | Boolean field with a default value.
6062
booleanFieldDef
61-
:: FieldName
63+
:: HasCallStack => FieldName
6264
-- ^ field name
6365
-> ALens' s Bool
6466
-- ^ lens into the field
@@ -68,7 +70,7 @@ class
6870

6971
-- | Optional field.
7072
optionalFieldAla
71-
:: (c b, Newtype a b)
73+
:: (c b, Newtype a b, HasCallStack)
7274
=> FieldName
7375
-- ^ field name
7476
-> (a -> b)
@@ -79,7 +81,7 @@ class
7981

8082
-- | Optional field with default value.
8183
optionalFieldDefAla
82-
:: (c b, Newtype a b, Eq a)
84+
:: (c b, Newtype a b, Eq a, HasCallStack)
8385
=> FieldName
8486
-- ^ field name
8587
-> (a -> b)
@@ -95,7 +97,7 @@ class
9597
--
9698
-- @since 3.0.0.0
9799
freeTextField
98-
:: FieldName
100+
:: HasCallStack => FieldName
99101
-> ALens' s (Maybe String)
100102
-- ^ lens into the field
101103
-> g s (Maybe String)
@@ -105,14 +107,14 @@ class
105107
--
106108
-- @since 3.0.0.0
107109
freeTextFieldDef
108-
:: FieldName
110+
:: HasCallStack => FieldName
109111
-> ALens' s String
110112
-- ^ lens into the field
111113
-> g s String
112114

113115
-- | @since 3.2.0.0
114116
freeTextFieldDefST
115-
:: FieldName
117+
:: HasCallStack => FieldName
116118
-> ALens' s ShortText
117119
-- ^ lens into the field
118120
-> g s ShortText
@@ -123,7 +125,7 @@ class
123125
--
124126
-- /Note:/ 'optionalFieldAla' is a @monoidalField@ with 'Last' monoid.
125127
monoidalFieldAla
126-
:: (c b, Monoid a, Newtype a b)
128+
:: (c b, Monoid a, Newtype a b, HasCallStack)
127129
=> FieldName
128130
-- ^ field name
129131
-> (a -> b)
@@ -134,21 +136,21 @@ class
134136

135137
-- | Parser matching all fields with a name starting with a prefix.
136138
prefixedFields
137-
:: FieldName
139+
:: HasCallStack => FieldName
138140
-- ^ field name prefix
139141
-> ALens' s [(String, String)]
140142
-- ^ lens into the field
141143
-> g s [(String, String)]
142144

143145
-- | Known field, which we don't parse, nor pretty print.
144-
knownField :: FieldName -> g s ()
146+
knownField :: HasCallStack => FieldName -> g s ()
145147

146148
-- | Field which is parsed but not pretty printed.
147-
hiddenField :: g s a -> g s a
149+
hiddenField :: HasCallStack => g s a -> g s a
148150

149151
-- | Deprecated since
150152
deprecatedSince
151-
:: CabalSpecVersion
153+
:: HasCallStack => CabalSpecVersion
152154
-- ^ version
153155
-> String
154156
-- ^ deprecation message
@@ -157,7 +159,7 @@ class
157159

158160
-- | Removed in. If we encounter removed field, parsing fails.
159161
removedIn
160-
:: CabalSpecVersion
162+
:: HasCallStack => CabalSpecVersion
161163
-- ^ version
162164
-> String
163165
-- ^ removal message
@@ -166,7 +168,7 @@ class
166168

167169
-- | Annotate field with since spec-version.
168170
availableSince
169-
:: CabalSpecVersion
171+
:: HasCallStack => CabalSpecVersion
170172
-- ^ spec version
171173
-> a
172174
-- ^ default value
@@ -181,15 +183,15 @@ class
181183
--
182184
-- @since 3.4.0.0
183185
availableSinceWarn
184-
:: CabalSpecVersion
186+
:: HasCallStack => CabalSpecVersion
185187
-- ^ spec version
186188
-> g s a
187189
-> g s a
188190
availableSinceWarn _ = id
189191

190192
-- | Field which can be defined at most once.
191193
uniqueField
192-
:: (FieldGrammar c g, c (Identity a))
194+
:: (FieldGrammar c g, c (Identity a), HasCallStack)
193195
=> FieldName
194196
-- ^ field name
195197
-> ALens' s a
@@ -199,7 +201,7 @@ uniqueField fn l = uniqueFieldAla fn Identity l
199201

200202
-- | Field which can be defined at most once.
201203
optionalField
202-
:: (FieldGrammar c g, c (Identity a))
204+
:: (FieldGrammar c g, c (Identity a), HasCallStack)
203205
=> FieldName
204206
-- ^ field name
205207
-> ALens' s (Maybe a)
@@ -209,7 +211,7 @@ optionalField fn l = optionalFieldAla fn Identity l
209211

210212
-- | Optional field with default value.
211213
optionalFieldDef
212-
:: (FieldGrammar c g, Functor (g s), c (Identity a), Eq a)
214+
:: (FieldGrammar c g, Functor (g s), c (Identity a), Eq a, HasCallStack)
213215
=> FieldName
214216
-- ^ field name
215217
-> ALens' s a
@@ -221,7 +223,7 @@ optionalFieldDef fn l x = optionalFieldDefAla fn Identity l x
221223

222224
-- | Field which can be define multiple times, and the results are @mappend@ed.
223225
monoidalField
224-
:: (FieldGrammar c g, c (Identity a), Monoid a)
226+
:: (FieldGrammar c g, c (Identity a), Monoid a, HasCallStack)
225227
=> FieldName
226228
-- ^ field name
227229
-> ALens' s a
@@ -231,7 +233,7 @@ monoidalField fn l = monoidalFieldAla fn Identity l
231233

232234
-- | Default implementation for 'freeTextFieldDefST'.
233235
defaultFreeTextFieldDefST
234-
:: (Functor (g s), FieldGrammar c g)
236+
:: (Functor (g s), FieldGrammar c g, HasCallStack)
235237
=> FieldName
236238
-> ALens' s ShortText
237239
-- ^ lens into the field

Cabal-syntax/src/Distribution/InstalledPackageInfo.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ sourceComponentName = CLibName . sourceLibName
9797

9898
-- | Return either errors, or IPI with list of warnings
9999
parseInstalledPackageInfo
100-
:: ByteString
100+
:: HasCallStack => ByteString
101101
-> Either (NonEmpty String) ([String], InstalledPackageInfo)
102102
parseInstalledPackageInfo s = case P.readFields s of
103103
Left err -> Left (show err :| [])

Cabal-syntax/src/Distribution/Parsec.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ import qualified Distribution.Compat.DList as DList
7070
import qualified Distribution.Compat.MonadFail as Fail
7171
import qualified Text.Parsec as Parsec
7272

73+
import GHC.Stack (HasCallStack)
74+
7375
-------------------------------------------------------------------------------
7476
-- Class
7577
-------------------------------------------------------------------------------
@@ -78,7 +80,7 @@ import qualified Text.Parsec as Parsec
7880
--
7981
-- For parsing @.cabal@ like file structure, see "Distribution.Fields".
8082
class Parsec a where
81-
parsec :: CabalParsing m => m a
83+
parsec :: (HasCallStack, CabalParsing m) => m a
8284

8385
-- | Parsing class which
8486
--

Cabal/src/Distribution/Simple/Configure.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,7 +2065,7 @@ reportFailedDependencies verbosity failed =
20652065
-- with a warning and treated as empty ones, since technically they do not
20662066
-- contain any package.
20672067
getInstalledPackages
2068-
:: Verbosity
2068+
:: HasCallStack => Verbosity
20692069
-> Compiler
20702070
-> Maybe (SymbolicPath CWD (Dir from))
20712071
-> PackageDBStackX (SymbolicPath from (Dir PkgDB))
@@ -2108,7 +2108,7 @@ getInstalledPackages verbosity comp mbWorkDir packageDBs progdb = do
21082108
-- on the package database stack in question. However, when sandboxes
21092109
-- are involved these sanity checks are not desirable.
21102110
getPackageDBContents
2111-
:: Verbosity
2111+
:: HasCallStack => Verbosity
21122112
-> Compiler
21132113
-> Maybe (SymbolicPath CWD (Dir Pkg))
21142114
-> PackageDB

Cabal/src/Distribution/Simple/GHC.hs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ import System.Directory
150150
import Distribution.Simple.Setup (BuildingWhat (..))
151151
import Distribution.Simple.Setup.Build
152152

153+
import GHC.Stack (HasCallStack)
154+
153155
-- -----------------------------------------------------------------------------
154156
-- Configuring
155157

@@ -400,7 +402,7 @@ getGhcInfo verbosity ghcProg = Internal.getGhcInfo verbosity implInfo ghcProg
400402

401403
-- | Given a single package DB, return all installed packages.
402404
getPackageDBContents
403-
:: Verbosity
405+
:: HasCallStack => Verbosity
404406
-> Maybe (SymbolicPath CWD (Dir from))
405407
-> PackageDBX (SymbolicPath from (Dir PkgDB))
406408
-> ProgramDb
@@ -411,7 +413,7 @@ getPackageDBContents verbosity mbWorkDir packagedb progdb = do
411413

412414
-- | Given a package DB stack, return all installed packages.
413415
getInstalledPackages
414-
:: Verbosity
416+
:: HasCallStack => Verbosity
415417
-> Compiler
416418
-> Maybe (SymbolicPath CWD (Dir from))
417419
-> PackageDBStackX (SymbolicPath from (Dir PkgDB))
@@ -548,7 +550,7 @@ removeMingwIncludeDir pkg =
548550

549551
-- | Get the packages from specific PackageDBs, not cumulative.
550552
getInstalledPackages'
551-
:: Verbosity
553+
:: HasCallStack => Verbosity
552554
-> Maybe (SymbolicPath CWD (Dir from))
553555
-> [PackageDBX (SymbolicPath from (Dir PkgDB))]
554556
-> ProgramDb

Cabal/src/Distribution/Simple/Program/HcPkg.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ hide hpi verbosity mbWorkDir packagedb pkgid =
278278
-- | Call @hc-pkg@ to get all the details of all the packages in the given
279279
-- package database.
280280
dump
281-
:: HcPkgInfo
281+
:: HasCallStack => HcPkgInfo
282282
-> Verbosity
283283
-> Maybe (SymbolicPath CWD (Dir from))
284284
-> PackageDBX (SymbolicPath from (Dir PkgDB))

cabal-install/src/Distribution/Client/IndexUtils.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,11 @@ import Distribution.Client.Errors
156156
import qualified Hackage.Security.Client as Sec
157157
import qualified Hackage.Security.Util.Some as Sec
158158

159+
import GHC.Stack (HasCallStack)
160+
159161
-- | Reduced-verbosity version of 'Configure.getInstalledPackages'
160162
getInstalledPackages
161-
:: Verbosity
163+
:: HasCallStack => Verbosity
162164
-> Compiler
163165
-> PackageDBStackCWD
164166
-> ProgramDb

0 commit comments

Comments
 (0)