Use the Identity monad to avoid unnecessary uses of fromJust

This commit is contained in:
Joseph C. Sible 2020-02-08 23:06:57 -05:00
parent 61b073d507
commit aaffe38198
4 changed files with 10 additions and 7 deletions

View file

@ -806,7 +806,7 @@ isVariableName (x:r) = isVariableStartChar x && all isVariableChar r
isVariableName _ = False
getVariablesFromLiteralToken token =
getVariablesFromLiteral (fromJust $ getLiteralStringExt (const $ return " ") token)
getVariablesFromLiteral (runIdentity $ getLiteralStringExt (const $ return " ") token)
-- Try to get referenced variables from a literal string like "$foo"
-- Ignores tons of cases like arithmetic evaluation and array indices.