Skip to content

Module vs Package vs File names #2415

@ivan-kleshnin

Description

@ivan-kleshnin

Haskell-like module system is a problem.

  1. You never know which package exposes a module.

Node

// WHAT I SEE               // WHAT I THINK

import Math from "math"     // npm install math (or system module)
import Global from "global" // npm install global (or system module)

PureScript / Haskell

-- WHAT I SEE     -- WHAT I THINK

import Math       -- bower install purescript-math (right)
import Global     -- bower install purescript-global (wrong: it's purescript-globals)
import Data.Show  -- ??? (it's a system module)
import Data.List  -- ??? (bower install purescript-lists, -s suffix)
import Control.Plus -- bower install purescript-control (one-to-one again...)   
  1. Now things get even worse when implicit imports are used
import Pumpkins

map foo bar -- where map is located? how to find the file?! and the package?!

I asked about the same problem in Haskell thread:

http://stackoverflow.com/questions/37960849/find-function-source-in-haskell-workflow

and Haskell, at least, provide a workaround for the second problem:

> :i catMaybes
catMaybes :: [Maybe a] -> [a]   -- Defined in ‘Data.Maybe’

Defined in ‘Data.Maybe – fine

In PureScript it does not work:

> :i map
Unrecognized directive. Type :? for help.

From the other side, in PureScript only one implicit import is allowed, which is great!

  1. As PureScript is split onto tons of micro-modules, the problem amplifies.

So what do I propose? I have little knowledge of PS and Haskell to really advice something.
My gut instinct wants to unify all three: packages, modules and files / folders like it is in Node.

If it's not possible or not desirable for some reason - please document at least how modules and packages are supposed to relate. How, by seeing import Data.List I should immediately know it comes from purescript-lists. It's hard to play this game of guessing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions