agda-snippets 2.4.2.4 → 2.4.2.5
raw patch · 2 files changed
+13/−6 lines, 2 filesdep +transformersdep ~Agda
Dependencies added: transformers
Dependency ranges changed: Agda
Files
- agda-snippets.cabal +3/−2
- app/Main.hs +10/−4
agda-snippets.cabal view
@@ -1,5 +1,5 @@ name: agda-snippets-version: 2.4.2.4+version: 2.4.2.5 synopsis: Render just the Agda snippets of a literate Agda file to HTML description: This library provides a very simple function that translates just the code blocks of a literate Agda file to colourised, hyperlinked HTML. The output of this@@ -34,7 +34,7 @@ hs-source-dirs: src exposed-modules: Agda.Contrib.Snippets build-depends: base >= 4.7 && < 4.9- , Agda == 2.4.2.4+ , Agda == 2.4.2.5 , xhtml >= 3000.2.1 && <3000.3 , network-uri >= 2.6 && < 2.7 , containers >= 0.5 && <0.6@@ -49,6 +49,7 @@ , agda-snippets , Agda , network-uri+ , transformers >= 0.4 && < 0.5 default-language: Haskell2010 source-repository head
app/Main.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE LambdaCase, CPP #-} module Main where import Agda.Contrib.Snippets@@ -8,17 +8,23 @@ import System.IO import Network.URI import Control.Applicative-+import Control.Monad.Trans.Except note :: b -> Maybe a -> Either b a note b Nothing = Left b note _ (Just a) = Right a +#if MIN_VERSION_Agda(2,4,3)+getOptions = runExceptT . parseStandardOptions+#else+getOptions = return . parseStandardOptions+#endif+ main :: IO () main = getArgs >>= \case (fp:output:css:uri:agdaOpts) -> do- print (fp,css,uri,agdaOpts)+ opts <- getOptions agdaOpts case liftA2 (,) (note "Malformed URI" $ parseURIReference uri)- (parseStandardOptions agdaOpts) of+ opts of Right (uri', agdaOpts') -> writeFile output =<< renderAgdaSnippets agdaOpts' css uri' fp Left e -> hPutStrLn stderr e >> exitFailure _ -> do