mirror of
https://github.com/Smaug123/agda-utils
synced 2025-10-10 22:18:41 +00:00
Initial commit of the bones of an unused-open-removing Agda tool
This commit is contained in:
25
AgdaUnusedOpens.Test/Utils.fs
Normal file
25
AgdaUnusedOpens.Test/Utils.fs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace AgdaUnusedOpens.Test
|
||||
|
||||
open System.IO
|
||||
open System.Text.RegularExpressions
|
||||
|
||||
type Dummy = Dummy
|
||||
|
||||
[<RequireQualifiedAccess>]
|
||||
module Utils =
|
||||
|
||||
/// E.g. getResource "Example.dot" for the .dot embedded resource
|
||||
let getResource (filename : string) : string =
|
||||
let assembly = typeof<Dummy>.Assembly
|
||||
let resource = assembly.GetManifestResourceStream(sprintf "AgdaUnusedOpens.Test.%s" filename)
|
||||
use tr = new StreamReader(resource)
|
||||
tr.ReadToEnd ()
|
||||
|
||||
let getResource' (filename : string) : string list =
|
||||
let assembly = typeof<Dummy>.Assembly
|
||||
let resource = assembly.GetManifestResourceStream(sprintf "AgdaUnusedOpens.Test.%s" filename)
|
||||
use tr = new StreamReader(resource)
|
||||
tr.ReadToEnd ()
|
||||
|> fun i -> Regex.Split(i, "\r\n|\r|\n")
|
||||
|> Array.toList
|
||||
|
Reference in New Issue
Block a user