Working prototype of unused-reference remover

This commit is contained in:
Patrick Stevens
2020-01-04 21:33:26 +00:00
committed by GitHub
parent d4d8bc2d0b
commit 5228096621
10 changed files with 379 additions and 62 deletions

View File

@@ -7,6 +7,7 @@ open AgdaUnusedOpens.Types
[<RequireQualifiedAccess>]
module Path =
let fold<'s> (f : 's -> string -> 's) (initial : 's) (p : Path) : 's =
p.Tail
|> List.fold f (f initial p.Head)
@@ -68,6 +69,12 @@ module AgdaFile =
ModuleLine = moduleLineNo
}
let makeFromFile (f : FileInfo) : AgdaFile =
f.FullName
|> File.ReadAllLines
|> List.ofArray
|> make
let flush (agdaRoot : DirectoryInfo) (f : AgdaFile) : unit =
let location = Path.combine agdaRoot f.Path
File.WriteAllLines (location.FullName, f.Contents)