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 (..))
  )
Mason Mackaman

https://discourse.purescript.org/t/purescript-nix-packager/1940

I wanted to be able to make nix packages with purescript so I made this tool. It’s a simple CLI that generates a nix expression that can easily be imported into a flake.nix/default.nix to create your nix package. It’s written in purescript and packaged using itself. Enjoy 🙂 (I was not aware of spago2nix before I made this. I assume it can be used to accomplish the same thing, but I have no experience with it.)