Skip to content

Fully qualified symbol access without import

From a Discourse thread started by @k-bx: fully qualified symbol access without import — in a similar fashion to what Rust does.

Motivation

  • eliminating “gigantic import sections”;
  • easing some programmer pain while writing functions.

Proposal

Allow fully qualified symbol access without imports. This would then become valid Haskell code:

import Control.Monad
-- I am not importing anything else

foo f = Data.List.sortBy f [1, 2, 3]
    -- we are calling `sortBy` without adding `Data.List` to the
    -- import list, by fully qualifying it (`Data.List.sortBy`).

Drawbacks

As noted by @artem in the thread, and @phadej on IRC, depedency analysis becomes slower, as you would need to parse the whole file to build the dependency graph.

Edited by f-a
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information