@@ -23,6 +23,8 @@ import Distribution.FieldGrammar.Newtypes
2323import Distribution.Fields.Field
2424import 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 )
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
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 )
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 )
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.
191193uniqueField
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.
201203optionalField
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.
211213optionalFieldDef
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.
223225monoidalField
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'.
233235defaultFreeTextFieldDefST
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
0 commit comments