Using a compiler specified on the command line or automatically detected
Pattern match instead of using isJust and fromJust. (You could use maybe instead of pattern matching, but I think pattern matching is clearer in this case.)

This eliminates the possibility of forgetting to ensure a value is a Just before calling fromJust on it.

guessMetapost :: Options -&gt; IO ()
guessMetapost opts
   = case optMetaPost opts of
         Just mcc -&gt; putStrLn $ printf "using enforced Metapost compiler: %s" mcc
         Nothing -&gt; do
           cc' &lt;- compiler Metapost.interface
           case cc' of
               Just cc -&gt; putStrLn $ printf "found Metapost compiler: %s" cc
               Nothing -&gt; putStrLn "found Metapost compiler: none"


(Your code wasn't consistently returning any options, so I've stripped that bit out.)