import qualified as nothing - not an error
haskell
Solution
`qualified` and `as` are independent features of imports.
`qualified` says that the names become available only under qualified names (i.e. names that include the module name).
`as` simply changes the module name which is used to qualify the names.
So, there are 4 different ways to import a module:
`import Database.Postgresql.Simple` — both qualified and unqualified names are visible; the qualified ones should be qualified with `Database.Postgresql.Simple`
`import Database.Postgresql.Simple as P` — both qualified and unqualified names are visible; the qualified ones should be qualified with `P`
`import qualified Database.Postgresql.Simple` — only qualified names are visible and they should be qualified with `Database.Postgresql.Simple`
`import qualified Database.Postgresql.Simple as P` — only qualified names are visible and they should be qualified with `P`
Problem
This is as much to add something searchable for the next poor sap, but I'd be interested in knowing why it's not an error. I needed the FromRow typeclass from postgresql-simple but forgot it was in its own package. ``` import qualified Database.Postgresql.Simple as P ``` oops - just want the .FromRow sub-module ``` import qualified Database.Postgresql.Simple.FromRow ``` Of course, didn't need it qualified, so stripped the name off the end. However, I forgot to remove the "qualified" keyword. Generates an error, and much headscratching from me, as I fail to spot the typo: ``` Not in scope: type constructor or class `FromRow' Perhaps you meant `Database.PostgreSQL.Simple.FromRow.FromRow' (imported from Database.PostgreSQL.Simple.FromRow) ``` So - just so this is a question, why is an unnamed qualified import not an error? Is it useful for something, or am I the first person stupid enough to make this mistake?