Skip to content

Commit

Permalink
Optparse forwards/backwards compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
colah committed Dec 25, 2012
1 parent 253d715 commit 2586e34
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions extopenscad.hs
Expand Up @@ -13,7 +13,7 @@ import Graphics.Implicit.ObjectUtil (getBox2, getBox3)
import Graphics.Implicit.Definitions (xmlErrorOn, errorMessage, SymbolicObj2, SymbolicObj3)
import qualified Data.Map as Map hiding (null)
import Data.Maybe as Maybe
import Data.Monoid ((<>))
import Data.Monoid (Monoid, mappend)
import Data.Tuple (swap)
import Text.ParserCombinators.Parsec (errorPos, sourceLine)
import Text.ParserCombinators.Parsec.Error
Expand All @@ -22,6 +22,11 @@ import Data.AffineSpace
import Options.Applicative
import System.FilePath

-- Backwards compatibility with old versions of Data.Monoid:
infixr 6 <>
(<>) :: Monoid a => a -> a -> a
(<>) = mappend

data ExtOpenScadOpts = ExtOpenScadOpts
{ outputFile :: Maybe FilePath
, outputFormat :: Maybe OutputFormat
Expand Down Expand Up @@ -67,7 +72,7 @@ extOpenScadOpts =
<> long "output"
<> value Nothing
<> metavar "FILE"
<> reader (Just . str)
<> reader (pure . str)
<> help "Output file name"
)
<*> nullOption
Expand All @@ -76,7 +81,7 @@ extOpenScadOpts =
<> value Nothing
<> metavar "FILE"
<> help "Output format"
<> reader (Just . readOutputFormat)
<> reader (pure . readOutputFormat)
)
<*> option
( short 'r'
Expand Down

0 comments on commit 2586e34

Please sign in to comment.