Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Optparse forwards/backwards compatibility.

  • Loading branch information...
commit 2586e3432115c1dc1b7c5276f1516b54b0425d39 1 parent 253d715
@colah authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 extopenscad.hs
View
11 extopenscad.hs
@@ -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
@@ -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
@@ -67,7 +72,7 @@ extOpenScadOpts =
<> long "output"
<> value Nothing
<> metavar "FILE"
- <> reader (Just . str)
+ <> reader (pure . str)
<> help "Output file name"
)
<*> nullOption
@@ -76,7 +81,7 @@ extOpenScadOpts =
<> value Nothing
<> metavar "FILE"
<> help "Output format"
- <> reader (Just . readOutputFormat)
+ <> reader (pure . readOutputFormat)
)
<*> option
( short 'r'
Please sign in to comment.
Something went wrong with that request. Please try again.