Is there syntax for importing unqualified & qualified module identifiers

33 views
Skip to first unread message

rvdalen

unread,
Jun 6, 2018, 4:37:19 AM6/6/18
to purescript
Hi,

I am finding myself repeating the same pattern over and over:

```
import Effect.Ref (Ref)
import Effect.Ref (new, read, write, modify_) as Ref
```

I want the `Ref` type to be imported unqualified, but the functions qualified because the function names are quite
general.

I was wondering if purescript has something like:

```
import Effect.Ref (Ref) As Ref (new, read, write, modify_)
```

which allows me to import unqualified & qualified identifiers in 1 go.

I just want to know if the accepted way of doing this is with the 2 import statements or if
a shorthand already exists?

Regards
--Rouan

Christoph Hegemann

unread,
Jun 7, 2018, 3:55:55 AM6/7/18
to purescript
No such syntax exists, the common pattern is to import like so:

```
import Effect.Ref (Ref)
import Effect.Ref as Ref
```

If you use any of the editor plugins you shouldn't need to worry about imports much/at all as they take of import management for you (for the most part).

Regards
Christoph

rvdalen

unread,
Jun 8, 2018, 3:02:40 AM6/8/18
to purescript
Thanks Christoph,

I suspected as much, just wanted to be sure :)

Regards
--Rouan
Reply all
Reply to author
Forward
0 new messages