discourse x-posts - PureScript

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Mason Mackaman

thoughts? https://discourse.purescript.org/t/module-import-syntax-sugar-proposal/1761

This is a proposal for a syntax sugar for module imports that I think would fix most (all?) of the pain points in importing modules as well as potentially enable a decent solution to purescript#2437. Pain Points Module names are very long. Modules are imported as unqualified by default. At the moment it wouldn’t make sense to qualify modules by default because of the point above - module names are too long, they need to be explicitly shortened anyway if you plan on using them in a qualified se...
TheMatten

Someone mentioned Rust below the comment - and taking inspiration from Rust could be one way of doing this:

import Control.Monad.(
    Reader (ReaderT (..), ask, runReaderT)
  , Writer (WriterT (..), runWriterT, tell)
  )
import Data.(
    Array
  , Maybe (Maybe (..), maybe, fromMaybe)
  , String
  , Tuple (Tuple (..))
  )

mind the use of dot - compared to Rust, it may be good idea to differentiate between naming modules and their contents, otherwise we would allow for new, ambiguous situations to arise

TheMatten

Once we have such sugar, it may be tempting to allow using it in nested way - either with nested from or something like

import Data.(
    Array
  , Tuple.((Tuple (..)), Nested)
  )

or possibly

import Data.(
    Array
  , Tuple.(Nested) (Tuple (..))
  )