Skip to content

Commit

Permalink
Output fussing
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottt committed Jan 6, 2018
1 parent 598bf53 commit 5e28209
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions dang.cabal
Expand Up @@ -51,6 +51,7 @@ executable dang
build-depends: base >=4.8 && <5,
containers,
text,
pretty-show,
dang
hs-source-dirs: dang
default-language: Haskell2010
Expand Down
14 changes: 8 additions & 6 deletions dang/Main.hs
Expand Up @@ -19,6 +19,7 @@ import qualified Data.Text as S
import qualified Data.Text.IO as S
import System.Exit (exitFailure)
import System.Environment (getArgs)
import Text.Show.Pretty (pPrint)


main :: IO ()
Expand All @@ -40,12 +41,13 @@ main = runDang $
$ F.toList ms

(mbMod,ms) <- collectMessages $ try $
do pMod <- parseModule interactive txt
do pMod <- parseModule (S.pack file) txt
rnMod <- renameModule pMod
-- KC.checkModule rnMod
return rnMod

io (print rnMod)
io (pPrint mbMod)

KC.checkModule rnMod

dumpMessages ms
io (print mbMod)
if null ms
then io (putStrLn "No messages")
else dumpMessages ms
12 changes: 6 additions & 6 deletions src/Dang/ModuleSystem/Rename.hs
Expand Up @@ -128,9 +128,10 @@ withModuleScope lpname body =
return a

-- | A local scope, introduced by a declaration.
withDeclScope :: RN a -> RN a
withDeclScope body =
do RN (sets_ (\ rw -> pushScope (declScope (view currentScope rw)) rw))
withDeclScope :: Bind Parsed -> RN a -> RN a
withDeclScope bind body =
do introBind bind
RN (sets_ (\ rw -> pushScope (declScope (view currentScope rw)) rw))
a <- body
RN (sets_ popScope)
return a
Expand Down Expand Up @@ -295,9 +296,8 @@ introBind Bind { .. } =
rnBind :: Rename Bind
rnBind b =
withLoc (bMeta b) $
withDeclScope $
do introBind b
n' <- rnValueName (bName b)
withDeclScope b $
do n' <- rnValueName (bName b)
ps' <- traverse (rnPat n') (bParams b)
b' <- rnExpr (bBody b)
return Bind { bName = n', bMeta = bMeta b, bParams = ps', bBody = b' }
Expand Down

0 comments on commit 5e28209

Please sign in to comment.