on master help sign in
Better failure on indentation stack underflow
commita660919934912dc9d64919232a5becd5bbbd031f authorDavid Raymond Christiansen <david@davidchristiansen.dk> dateWed 12 Aug 2015, 10:45 (11 years ago) parent030da05
1 file changed+3−2
src/Idris/ParseHelpers.hs+3−2
src/Idris/ParseHelpers.hs+3−2
@@ -450,8 +450,9 @@ pushIndent = do pos <- position
450450-- | Pops indentation from stack
451451popIndent :: IdrisParser ()
452452popIndent = do ist <- get
453− let (x : xs) = indent_stack ist
454− put (ist { indent_stack = xs })
453+ case indent_stack ist of
454+ [] -> error "The impossible happened! Tried to pop an indentation level where none was pushed (underflow)."
455+ (x : xs) -> put (ist { indent_stack = xs })
455456
456457
457458-- | Gets current indentation