@@ -59,7 +59,7 @@ unsafeModules = map modToFile
59
59
, " System.Exit.Primitive"
60
60
, " Text.Pretty.Core"
61
61
, " Text.Pretty"
62
- ]
62
+ ] ++ sizedTypesModules
63
63
64
64
isUnsafeModule :: FilePath -> Bool
65
65
isUnsafeModule fp =
@@ -98,6 +98,55 @@ isWithKModule =
98
98
\ fp -> unqualifiedModuleName fp == " WithK"
99
99
|| fp `elem` withKModules
100
100
101
+ sizedTypesModules :: [FilePath ]
102
+ sizedTypesModules = map modToFile
103
+ [ " Codata.Cofin"
104
+ , " Codata.Cofin.Literals"
105
+ , " Codata.Colist"
106
+ , " Codata.Colist.Bisimilarity"
107
+ , " Codata.Colist.Categorical"
108
+ , " Codata.Colist.Properties"
109
+ , " Codata.Conat"
110
+ , " Codata.Conat.Bisimilarity"
111
+ , " Codata.Conat.Literals"
112
+ , " Codata.Conat.Properties"
113
+ , " Codata.Covec"
114
+ , " Codata.Covec.Bisimilarity"
115
+ , " Codata.Covec.Categorical"
116
+ , " Codata.Covec.Instances"
117
+ , " Codata.Covec.Properties"
118
+ , " Codata.Cowriter"
119
+ , " Codata.Cowriter.Bisimilarity"
120
+ , " Codata.Delay"
121
+ , " Codata.Delay.Bisimilarity"
122
+ , " Codata.Delay.Categorical"
123
+ , " Codata.Delay.Properties"
124
+ , " Codata.M"
125
+ , " Codata.M.Bisimilarity"
126
+ , " Codata.M.Properties"
127
+ , " Codata.Stream"
128
+ , " Codata.Stream.Bisimilarity"
129
+ , " Codata.Stream.Categorical"
130
+ , " Codata.Stream.Instances"
131
+ , " Codata.Stream.Properties"
132
+ , " Codata.Thunk"
133
+ , " Data.Container"
134
+ , " Data.Container.Any"
135
+ , " Data.Container.FreeMonad"
136
+ , " Data.Nat.PseudoRandom.LCG.Unsafe"
137
+ , " Data.Tree.Rose"
138
+ , " Data.Tree.Rose.Properties"
139
+ , " Data.Trie"
140
+ , " Data.Trie.NonEmpty"
141
+ , " Relation.Unary.Sized"
142
+ , " Size"
143
+ , " Text.Tree.Linear"
144
+ ]
145
+
146
+ isSizedTypesModule :: FilePath -> Bool
147
+ isSizedTypesModule =
148
+ \ fp -> fp `elem` sizedTypesModules
149
+
101
150
unqualifiedModuleName :: FilePath -> String
102
151
unqualifiedModuleName = dropExtension . takeFileName
103
152
@@ -139,10 +188,9 @@ extractHeader mod = extract
139
188
, " Please see other existing files or consult HACKING.md."
140
189
]
141
190
142
- -- | A crude classifier looking for lines containing options & trying to guess
143
- -- whether the safe file is using either @--guardedness@ or @--sized-types@
191
+ -- | A crude classifier looking for lines containing options
144
192
145
- data Status = Deprecated | Unsafe | Safe | SafeGuardedness | SafeSizedTypes
193
+ data Status = Deprecated | Unsafe | Safe
146
194
deriving (Eq )
147
195
148
196
classify :: FilePath -> [String ] -> [String ] -> Status
@@ -156,8 +204,6 @@ classify fp hd ls
156
204
-- And then perform the actual classification
157
205
| deprecated = Deprecated
158
206
| isUnsafe = Unsafe
159
- | guardedness = SafeGuardedness
160
- | sizedtypes = SafeSizedTypes
161
207
| safe = Safe
162
208
-- We know that @not (isUnsafe || safe)@, all cases are covered
163
209
| otherwise = error " IMPOSSIBLE"
@@ -169,8 +215,6 @@ classify fp hd ls
169
215
isUnsafe = isUnsafeModule fp
170
216
171
217
-- based on detected OPTIONS
172
- guardedness = option " --guardedness"
173
- sizedtypes = option " --sized-types"
174
218
safe = option " --safe"
175
219
withK = option " --with-K"
176
220
withoutK = option " --without-K"
@@ -223,9 +267,7 @@ checkFilePaths cat fps = forM_ fps $ \ fp -> do
223
267
-- Collecting all non-Core library files, analysing them and generating
224
268
-- 4 files:
225
269
-- Everything.agda all the modules
226
- -- EverythingSafe.agda all the safe modules (may be incompatible)
227
- -- EverythingSafeGuardedness.agda all the safe modules using --guardedness
228
- -- EverythingSafeSizedTypes.agda all the safe modules using --sized-types
270
+ -- EverythingSafe.agda all the safe modules
229
271
230
272
main = do
231
273
args <- getArgs
@@ -254,27 +296,11 @@ main = do
254
296
255
297
writeFileUTF8 (safeOutputFile ++ " .agda" ) $
256
298
unlines [ header
257
- , " {-# OPTIONS --guardedness --sized-types #-}\n "
299
+ , " {-# OPTIONS --safe --guardedness #-}\n "
258
300
, mkModule safeOutputFile
259
301
, format $ filter ((Unsafe /= ) . status) libraryfiles
260
302
]
261
303
262
- let safeGuardednessOutputFile = safeOutputFile ++ " Guardedness"
263
- writeFileUTF8 (safeGuardednessOutputFile ++ " .agda" ) $
264
- unlines [ header
265
- , " {-# OPTIONS --safe --guardedness #-}\n "
266
- , mkModule safeGuardednessOutputFile
267
- , format $ filter ((SafeGuardedness == ) . status) libraryfiles
268
- ]
269
-
270
- let safeSizedTypesOutputFile = safeOutputFile ++ " SizedTypes"
271
- writeFileUTF8 (safeSizedTypesOutputFile ++ " .agda" ) $
272
- unlines [ header
273
- , " {-# OPTIONS --safe --sized-types #-}\n "
274
- , mkModule safeSizedTypesOutputFile
275
- , format $ filter ((SafeSizedTypes == ) . status) libraryfiles
276
- ]
277
-
278
304
-- | Usage info.
279
305
280
306
usage :: String
0 commit comments