someFunction :: a -> b
someFunction = undefined
함수 본체 작성을 잊은 경우, 프로그램 실행시에 불친절한 error가 출력된다. compile시에는 문제없이 넘어간다.
shAegis:Haskell shaegis$ ghc myUtil.hs
[1 of 1] Compiling Main ( myUtil.hs, myUtil.o )
Linking myUtil ...
shaegis$ ./myUtil
myUtil: Prelude.undefined
Development.Placeholders를 이용하면 compile시에도 error를 잡아주며 undefined된 위치까지 알려준다.
{-# LANGUAGE TemplateHaskell #-}
import Development.Placeholders
someFunction :: a -> b
someFunction = $notImplemented
Or
someFunction = $(todo "주말까지 작성.")
compile을 하면 다음과 같이 error를 잡아준다.
shAegis:Haskell shaegis$ ghc myUtil.hs
[1 of 1] Compiling Main ( myUtil.hs, myUtil.o )
myUtil.hs:24:17: Warning: Unimplemented feature
Linking myUtil ...
Or
myUtil.hs:24:19: Warning: TODO: 주말까지 작성.
댓글 없음:
댓글 쓰기