guessCompilers :: Options -> IO Options
guessCompilers options = foldl (>>=) (return options) modifiers where
modifiers =
[guessMetapost
-- guessAsymptote,
-- guessTex,
-- guessLatex,
-- guessXelatex
]
guessMetapost :: Options -> IO Options
guessMetapost opts = if isJust $ optMetaPost opts
then
putStrLn $ printf "using enforced Metapost compiler: %s" (fromJust $optMetaPost opts)
>> return opts
else do
cc <- compiler Metapost.interface
if isJust cc then putStrLn $ printf "found Metapost compiler: %s" (fromJust cc)
else putStrLn "found Metapost compiler: none"
Here is part of my project(build system). Compiler can be spectified by cmd args or can be guessed. But double check for Nothing is not cool in my opinion. Also, I heard fromJust is evil. Any suggestions to improve my code?