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

@ -30,6 +30,7 @@ import ShellCheck.Regex
import Control.Monad
import Control.Monad.RWS
import Data.Char
import Data.Functor.Identity
import Data.List
import Data.Maybe
import qualified Data.Map as Map
@ -488,7 +489,7 @@ checkBraceExpansionVars = ForShell [Bash] f
T_DollarExpansion {} -> return "$"
T_DollarArithmetic {} -> return "$"
_ -> return "-"
toString t = fromJust $ getLiteralStringExt literalExt t
toString t = runIdentity $ getLiteralStringExt literalExt t
isEvaled t = do
cmd <- getClosestCommandM t
return $ maybe False (`isUnqualifiedCommand` "eval") cmd