# Thoughts on Structuring F# Code - Put all public types in namespace (maybe in a file called `Types.fs`). This allows the namespace to be easily opened by users of a library. - Any functions should go to a separate module with `[<RequireQualifiedAccess>]` to maintain code readability of depending code. This works hand-in-hand with the previous point: I want to be able to open the namespace to access the types but not have access to any functions without qualified access. - Types with a validation should go inside their own modules and have `private` constructors. It's important that these go to a module for type access modifiers to work as expected (see [[FSharp Access Modifiers|F# Access Modifiers]]). Give validated types public active patterns to make them easier to use. To simulate these types being in a namespace (and not a module), make the module `[<AutoOpen>]`. - Don't bother making constructors of public records private to avoid breaking compatibility if a record field is added later. The idea here is to use lenses or similar to create derived instances from a default (zero) instance. Unfortunately this won't work due to `[FS1113] The value was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible`. See https://github.com/dotnet/fsharp/issues/11677 for more info