git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Add position info to do-desugaring errors
commitb822bb4ba1d2271896faf1b65e47a1f554c0fa6f authorGary Burgess <gary.burgess@gmail.com> dateMon 12 May 2014, 23:47 (12 years ago) parent797dfa0
1 file changed+5−3
src/Language/PureScript/Sugar/DoNotation.hs+5−3
src/Language/PureScript/Sugar/DoNotation.hs+5−3
@@ -35,9 +35,10 @@ desugarDoModule :: Module -> Either ErrorStack Module
3535desugarDoModule (Module mn ds exts) = Module mn <$> mapM desugarDo ds <*> pure exts
3636
3737desugarDo :: Declaration -> Either ErrorStack Declaration
38−desugarDo =
38+desugarDo (PositionedDeclaration pos d) = rethrowWithPosition pos $ desugarDo d
39+desugarDo d =
3940 let (f, _, _) = everywhereOnValuesM return replace return
40− in f
41+ in f d
4142 where
4243 prelude :: ModuleName
4344 prelude = ModuleName [ProperName C.prelude]
@@ -47,6 +48,7 @@ desugarDo =
4748
4849 replace :: Value -> Either ErrorStack Value
4950 replace (Do els) = go els
51+ replace (PositionedValue pos d) = rethrowWithPosition pos $ replace d
5052 replace other = return other
5153
5254 go :: [DoNotationElement] -> Either ErrorStack Value
@@ -69,4 +71,4 @@ desugarDo =
6971 go (DoNotationLet ds : rest) = do
7072 rest' <- go rest
7173 return $ Let ds rest'
72− go (PositionedDoNotationElement pos el : rest) = PositionedValue pos <$> go (el : rest)
74+ go (PositionedDoNotationElement pos el : rest) = rethrowWithPosition pos $ PositionedValue pos <$> go (el : rest)