In Haskell, I use the Data.Map module, and its principal type of the same name, Data.Map.Map, like this:
import Data.Map (Map)
import qualified Data.Map as M
In F#, I want to do something similar with my Item module, which contains a type of the same name:
module Item
type Item = { Description: string }
let empty = { Description = "" }
I can’t find a way to use this module qualified and the type unqualified. Can I use this module and type like this, from another module?
let getItem (): Item = Item.empty
Edit:
Adding a type alias from a client module lets me use the Item module with qualification and the Item type without qualification, but is there a better way still?
type Item = Item.Item
I think the only way to import only a single type from a module is to use type alias (as you already noted). To get a qualified access to members of the module (under a different name), you can use module alias:
I don’t think there is any way for importing members from module selectively (as in Haskell), so this is probably the best option.