Elm-format: Add `exposing` if `module X (Y)`

Created on 10 Apr 2018  路  4Comments  路  Source: avh4/elm-format

It would be nice if elm-format could convert

module Foo (Bar)

import Bar (Foo)

to

module Foo exposing (Bar)

import Bar exposing (Foo)

on a save, similarly to how it converts

foo =
    { bar : "foobar"
    }

to

foo =
    { bar = "foobar"
    }

It would let you save some some typing, and maybe help some people either used to, or hopping back and forth between Haskell. I don't know if it's out-of-scope for what elm-format wants to be, but since it felt similar to the record example, I thought it worth creating an issue.

help wanted lenient parser

All 4 comments

If it's meant for people coming form Haskell, shouldn't it be:

module Foo (Bar) where

to

module Foo exposing (Bar)

@basile-henry Well, I suppose both would be fine with me, I mainly wanted it because I'm lazy

module case is already working, I drafted a PR in progress... (thanks @avh4 for the pair programming!) as soon as I fix the import case as well this will be finished! 馃殌

Fixed and ready for review! 馃檶

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sporto picture sporto  路  7Comments

conradwt picture conradwt  路  8Comments

pdamoc picture pdamoc  路  8Comments

rtfeldman picture rtfeldman  路  8Comments

avh4 picture avh4  路  5Comments