Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-w/--watch option #104

Merged
merged 2 commits into from
Jun 1, 2017
Merged

-w/--watch option #104

merged 2 commits into from
Jun 1, 2017

Conversation

yjroot
Copy link
Contributor

@yjroot yjroot commented Mar 7, 2017

Fixes #91.

@yjroot yjroot added the typ:enhance Type: Enhancement/new feature label Mar 7, 2017
@yjroot yjroot force-pushed the watch-option branch 3 times, most recently from 26aa4be to cbe7851 Compare March 11, 2017 14:21
@yjroot yjroot changed the title WIP: -w/--watch option -w/--watch option Mar 11, 2017
@yjroot yjroot requested review from Kroisse and heejongahn March 11, 2017 14:23
src/Nirum/Cli.hs Outdated
, watching :: Bool
, building :: TFlag
, changed :: TFlag
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

들여쓰기

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yjroot @admire93 위쪽에 있는 Options와도 많이 겹치는 것 같은데, 둘이 어떻게 다른 거죠? 공통된 것은 합칠 방법 없을까요?

src/Nirum/Cli.hs Outdated
}

debounceDelay :: Int
debounceDelay = 1 * 1000 * 1000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

단위가 어떻게 되나요? 단위가 드러났으면 좋겠습니다. 상수명 뒤에 단위를 붙이거나, 아니면 type Millisecond = Int 뭐 이런 식으로 type alias한 다음에 해당 타입으로 지정하거나…

src/Nirum/Cli.hs Outdated
Left (CompileError errors) ->
forM_ (M.toList errors) $ \ (filePath, compileError) ->
die [qq|error: $filePath: $compileError|]
tryDie options [qq|error: $filePath: $compileError|]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 함수 안에서 반복해서 tryDie options ...를 호출하고 있는데, 차라리 이 함수의 wheretry' = tryDie options 만들어 두고 그걸 쓰게 하는 게 낫지 않을까요.

src/Nirum/Cli.hs Outdated
options@AppOptions { building = building'
, changed = changed'
}
event
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppOptions의 닫는 중괄호 위치가 여는 중괄호보다 왼쪽에 있네요. 그리고 onFileChanged 함수의 인자들도 밑에 있는 가드와 같은 위치에 있어서 좀 핫갈리는 것 같습니다. 인자들은 차라리 onFileChanged 바로 뒤에 위치시키는 건 어떨까요? 이런 식으로:

onFileChanged :: AppOptions -> Event -> IO ()
onFileChanged options@AppOptions { building = building'
                                 , changed = changed'
                                 }
                                 event

src/Nirum/Cli.hs Outdated
(T.pack $ targetOption opts)
watch'
building'
changed'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 정도면 필드가 꽤 많으니 그냥 레코드 문법을 쓰는 게 좋을 것 같습니다.

src/Nirum/Cli.hs Outdated
@@ -184,5 +258,8 @@ main = do
OPT.strOption
(OPT.long "target" <> OPT.short 't' <> OPT.metavar "TARGET" <>
OPT.help "Target language name") <*>
OPT.switch
(OPT.long "watch" <> OPT.short 'w' <>
OPT.help "Watches files for changes and rebuilds") <*>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3인칭 단수형으로 쓰지 말고 그냥 명령형으로 쓰면 될 것 같습니다. (다들 그렇게 쓰는 것 같네요.)

@yjroot yjroot force-pushed the watch-option branch 2 times, most recently from 7b7a50b to 7cb2879 Compare March 31, 2017 14:56
src/Nirum/Cli.hs Outdated
import GHC.Exts (IsList (toList))

import qualified Data.ByteString as B
import qualified Data.Map.Strict as M
import qualified Data.Set as S
import qualified Data.Text as T
import Control.Concurrent (threadDelay)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Control.Concurrent는 표준 라이브러리니까 위쪽으로 올려주세요.

src/Nirum/Cli.hs Outdated
import GHC.Exts (IsList (toList))

import qualified Data.ByteString as B
import qualified Data.Map.Strict as M
import qualified Data.Set as S
import qualified Data.Text as T
import Control.Concurrent (threadDelay)
import Control.Concurrent.STM (atomically, newTVar, readTVar, TVar, writeTVar)
import Control.Monad (forM_, forever, when)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Control.Monad는 표준 라이브러리니까 위쪽으로 올려주세요.

src/Nirum/Cli.hs Outdated
import System.FilePath (takeDirectory, (</>))
import System.FilePath (takeDirectory, takeExtension, (</>))
import System.FSNotify
import System.IO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System.IO는 표준 라이브러리니까 위쪽으로 올려주세요.

@kanghyojun kanghyojun merged commit 5a1caf0 into nirum-lang:master Jun 1, 2017
@dahlia dahlia added the cmp:frontend Component: Compiler frontend (e.g., CLI, parser, AST) label Aug 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmp:frontend Component: Compiler frontend (e.g., CLI, parser, AST) typ:enhance Type: Enhancement/new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants