Skip to content

Commit 4cd9be6

Browse files
kMutageneclaude
andcommitted
refactor(IO): drop redundant type aliases from entity modules
The post-rename C# types (BioFSharp.FileFormats.INSDC.BioProject etc.) already carry the right names, so the F# `type BioProject = ...BioProject` aliases inside each IO module were a leftover from before the cleanup pass. Remove them: each module now opens BioFSharp.FileFormats.INSDC at the namespace top and references the C# class directly. Callers continue to use BioFSharp.IO.INSDC.BioProject.read etc., and BioFSharp.FileFormats.INSDC.BioProject for the type. Tests.fs simplified the same way — opens both namespaces and constructs each entity by its bare type name. The first smoke test (which asserted typeof<alias> == typeof<C# class>) is dropped since it's now tautological. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 65a876c commit 4cd9be6

9 files changed

Lines changed: 23 additions & 49 deletions

File tree

src/BioFSharp.IO.INSDC/Analysis.fs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
namespace BioFSharp.IO.INSDC
22

3+
open BioFSharp.FileFormats.INSDC
34
open BioFSharp.IO.INSDC.Internal
45

56
/// Read and write INSDC Analysis records.
67
module Analysis =
78

8-
/// An INSDC Analysis record. Alias for `BioFSharp.FileFormats.INSDC.Analysis`.
9-
type Analysis = BioFSharp.FileFormats.INSDC.Analysis
10-
119
/// Read an INSDC Analysis XML record from the file at `filePath`.
1210
let read (filePath: string) : Analysis =
1311
XmlSerializer.read<Analysis> filePath

src/BioFSharp.IO.INSDC/BioProject.fs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
namespace BioFSharp.IO.INSDC
22

3+
open BioFSharp.FileFormats.INSDC
34
open BioFSharp.IO.INSDC.Internal
45

56
/// Read and write INSDC BioProject records (called `Project` in the SRA/ENA
67
/// XML schema; `BioProject` is the cross-archive INSDC name used throughout
78
/// this library).
89
module BioProject =
910

10-
/// An INSDC BioProject record. Alias for `BioFSharp.FileFormats.INSDC.BioProject`.
11-
type BioProject = BioFSharp.FileFormats.INSDC.BioProject
12-
1311
/// Read an INSDC BioProject XML record from the file at `filePath`.
1412
let read (filePath: string) : BioProject =
1513
XmlSerializer.read<BioProject> filePath

src/BioFSharp.IO.INSDC/BioSample.fs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
namespace BioFSharp.IO.INSDC
22

3+
open BioFSharp.FileFormats.INSDC
34
open BioFSharp.IO.INSDC.Internal
45

56
/// Read and write INSDC BioSample records (called `Sample` in the SRA/ENA
67
/// XML schema; `BioSample` is the cross-archive INSDC name used throughout
78
/// this library).
89
module BioSample =
910

10-
/// An INSDC BioSample record. Alias for `BioFSharp.FileFormats.INSDC.BioSample`.
11-
type BioSample = BioFSharp.FileFormats.INSDC.BioSample
12-
1311
/// Read an INSDC BioSample XML record from the file at `filePath`.
1412
let read (filePath: string) : BioSample =
1513
XmlSerializer.read<BioSample> filePath

src/BioFSharp.IO.INSDC/Experiment.fs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
namespace BioFSharp.IO.INSDC
22

3+
open BioFSharp.FileFormats.INSDC
34
open BioFSharp.IO.INSDC.Internal
45

56
/// Read and write INSDC Experiment records.
67
module Experiment =
78

8-
/// An INSDC Experiment record. Alias for `BioFSharp.FileFormats.INSDC.Experiment`.
9-
type Experiment = BioFSharp.FileFormats.INSDC.Experiment
10-
119
/// Read an INSDC Experiment XML record from the file at `filePath`.
1210
let read (filePath: string) : Experiment =
1311
XmlSerializer.read<Experiment> filePath

src/BioFSharp.IO.INSDC/Receipt.fs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
namespace BioFSharp.IO.INSDC
22

3+
open BioFSharp.FileFormats.INSDC
34
open BioFSharp.IO.INSDC.Internal
45

56
/// Read and write INSDC Receipt records (the response document returned by the
67
/// ENA submission API).
78
module Receipt =
89

9-
/// An INSDC Receipt record. Alias for `BioFSharp.FileFormats.INSDC.Receipt`.
10-
type Receipt = BioFSharp.FileFormats.INSDC.Receipt
11-
1210
/// Read an INSDC Receipt XML record from the file at `filePath`.
1311
let read (filePath: string) : Receipt =
1412
XmlSerializer.read<Receipt> filePath

src/BioFSharp.IO.INSDC/Run.fs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
namespace BioFSharp.IO.INSDC
22

3+
open BioFSharp.FileFormats.INSDC
34
open BioFSharp.IO.INSDC.Internal
45

56
/// Read and write INSDC Run records.
67
module Run =
78

8-
/// An INSDC Run record. Alias for `BioFSharp.FileFormats.INSDC.Run`.
9-
type Run = BioFSharp.FileFormats.INSDC.Run
10-
119
/// Read an INSDC Run XML record from the file at `filePath`.
1210
let read (filePath: string) : Run =
1311
XmlSerializer.read<Run> filePath

src/BioFSharp.IO.INSDC/Study.fs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
namespace BioFSharp.IO.INSDC
22

3+
open BioFSharp.FileFormats.INSDC
34
open BioFSharp.IO.INSDC.Internal
45

56
/// Read and write INSDC Study records.
67
module Study =
78

8-
/// An INSDC Study record. Alias for `BioFSharp.FileFormats.INSDC.Study`.
9-
type Study = BioFSharp.FileFormats.INSDC.Study
10-
119
/// Read an INSDC Study XML record from the file at `filePath`.
1210
let read (filePath: string) : Study =
1311
XmlSerializer.read<Study> filePath

src/BioFSharp.IO.INSDC/Submission.fs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
namespace BioFSharp.IO.INSDC
22

3+
open BioFSharp.FileFormats.INSDC
34
open BioFSharp.IO.INSDC.Internal
45

56
/// Read and write INSDC Submission records.
67
module Submission =
78

8-
/// An INSDC Submission record. Alias for `BioFSharp.FileFormats.INSDC.Submission`.
9-
type Submission = BioFSharp.FileFormats.INSDC.Submission
10-
119
/// Read an INSDC Submission XML record from the file at `filePath`.
1210
let read (filePath: string) : Submission =
1311
XmlSerializer.read<Submission> filePath

tests/BioFSharp.INSDC.Tests/Tests.fs

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,24 @@ namespace BioFSharp.INSDC.Tests
22

33
open Xunit
44

5+
open BioFSharp.FileFormats.INSDC
56
open BioFSharp.IO.INSDC
67

7-
/// Smoke tests that the IO surface compiles and the type aliases line up.
8-
/// Real fixture-based read/roundtrip tests land in step 4 of plans/implementation.md.
8+
/// Smoke tests that the IO surface compiles and `writeString` runs for every
9+
/// entity. Real fixture-based read/roundtrip tests land in step 4 of
10+
/// plans/implementation.md.
911
type IoSurfaceSmokeTests() =
1012

1113
[<Fact>]
12-
let ``BioProject.BioProject aliases the generated INSDC BioProject type`` () =
13-
Assert.Equal(typeof<BioProject.BioProject>, typeof<BioFSharp.FileFormats.INSDC.BioProject>)
14-
15-
[<Fact>]
16-
let ``Every entity module exposes a writeString function over its type alias`` () =
14+
let ``Every entity module's writeString runs on a default-initialised value`` () =
1715
// Constructing a default-initialised record and round-tripping it through
18-
// writeString is the cheapest sanity check that XmlSerializer can handle each entity.
19-
let project = BioProject.BioProject()
20-
let study = Study.Study()
21-
let sample = BioSample.BioSample()
22-
let experiment = Experiment.Experiment()
23-
let run = Run.Run()
24-
let analysis = Analysis.Analysis()
25-
let submission = Submission.Submission()
26-
let receipt = Receipt.Receipt()
27-
// None of these should throw; we don't assert on the XML body shape here.
28-
BioProject.writeString project |> ignore
29-
Study.writeString study |> ignore
30-
BioSample.writeString sample |> ignore
31-
Experiment.writeString experiment |> ignore
32-
Run.writeString run |> ignore
33-
Analysis.writeString analysis |> ignore
34-
Submission.writeString submission |> ignore
35-
Receipt.writeString receipt |> ignore
16+
// writeString is the cheapest sanity check that XmlSerializer can handle
17+
// each entity. We don't assert on the XML body shape here.
18+
BioProject.writeString (BioProject()) |> ignore
19+
Study.writeString (Study()) |> ignore
20+
BioSample.writeString (BioSample()) |> ignore
21+
Experiment.writeString (Experiment()) |> ignore
22+
Run.writeString (Run()) |> ignore
23+
Analysis.writeString (Analysis()) |> ignore
24+
Submission.writeString (Submission()) |> ignore
25+
Receipt.writeString (Receipt()) |> ignore

0 commit comments

Comments
 (0)