@@ -35,9 +35,10 @@ desugarDoModule :: Module -> Either ErrorStack Module
35desugarDoModule (Module mn ds exts) = Module mn <$> mapM desugarDo ds <*> pure exts
35desugarDoModule (Module mn ds exts) = Module mn <$> mapM desugarDo ds <*> pure exts
37desugarDo :: Declaration -> Either ErrorStack Declaration
37desugarDo :: Declaration -> Either ErrorStack Declaration
38−desugarDo =
38+desugarDo (PositionedDeclaration pos d) = (PositionedDeclaration pos) <$> (rethrowWithPosition pos $ desugarDo d)
39 let (f, _, _) = everywhereOnValuesM return replace return
40 let (f, _, _) = everywhereOnValuesM return replace return
42 prelude :: ModuleName
43 prelude :: ModuleName
43 prelude = ModuleName [ProperName C.prelude]
44 prelude = ModuleName [ProperName C.prelude]
@@ -47,6 +48,7 @@ desugarDo =
48 replace :: Value -> Either ErrorStack Value
49 replace :: Value -> Either ErrorStack Value
49 replace (Do els) = go els
50 replace (Do els) = go els
51+ replace (PositionedValue pos v) = rethrowWithPosition pos $ replace v
50 replace other = return other
52 replace other = return other
52 go :: [DoNotationElement] -> Either ErrorStack Value
54 go :: [DoNotationElement] -> Either ErrorStack Value
@@ -69,4 +71,4 @@ desugarDo =
69 go (DoNotationLet ds : rest) = do
71 go (DoNotationLet ds : rest) = do
70 rest' <- go rest
72 rest' <- go rest
71 return $ Let ds rest'
73 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)