hs2ats 0.3.0.4 → 0.4.0.0
raw patch · 5 files changed
+20/−29 lines, 5 filesdep −cpphsPVP ok
version bump matches the API change (PVP)
Dependencies removed: cpphs
API changes (from Hackage documentation)
- Language.ATS.Generate: genATSTypes :: FilePath -> FilePath -> Bool -> IO ()
+ Language.ATS.Generate: genATSTypes :: FilePath -> FilePath -> IO ()
Files
- CHANGELOG.md +4/−0
- README.md +1/−7
- app/Main.hs +3/−2
- hs2ats.cabal +10/−11
- src/Language/ATS/Generate.hs +2/−9
CHANGELOG.md view
@@ -1,5 +1,9 @@ # hs2ats +## 0.4.0.0+ + * Stop depending on `cpphs`+ ## 0.3.0.4 * Allow newer `language-ats`
README.md view
@@ -15,11 +15,5 @@ Install [cabal](https://www.haskell.org/cabal/download.html). Then: ```-cabal new-install hs2ats --symlink-bindir ~/.cabal/bin-```--or--```-cabal new-install hs2ats --alex-options='-g' --happy-options='-gcsa' --symlink-bindir ~/.cabal/bin+cabal new-install hs2ats ```
app/Main.hs view
@@ -6,15 +6,16 @@ module Main where +import Data.Function ((&)) import Language.ATS.Generate import Options.Generic data Program = Program { src :: FilePath <?> "Haskell source file" , target :: FilePath <?> "ATS target"- , cpphs :: Bool <?> "Use cpphs as a preprocessor" } deriving (Generic, ParseRecord) main :: IO () main = do x <- getRecord "Generate ATS types for Haskell source code" :: IO Program- genATSTypes (unHelpful . src $ x) (unHelpful . target $ x) (unHelpful . cpphs $ x)+ let go = (x &) . (unHelpful .)+ genATSTypes (go src) (go target)
hs2ats.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: hs2ats-version: 0.3.0.4+version: 0.4.0.0 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2018 Vanessa McHale@@ -41,12 +41,11 @@ microlens -any, ansi-wl-pprint -any, composition-prelude -any,- deepseq -any,- cpphs -any- + deepseq -any+ if flag(development) ghc-options: -Werror- + if impl(ghc >=8.0) ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates @@ -61,10 +60,10 @@ base -any, optparse-generic -any, hs2ats -any- + if flag(development) ghc-options: -Werror- + if impl(ghc >=8.0) ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates @@ -80,10 +79,10 @@ hspec -any, hspec-dirstream -any, system-filepath -any- + if flag(development) ghc-options: -Werror- + if impl(ghc >=8.0) ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates @@ -97,9 +96,9 @@ base -any, hs2ats -any, criterion -any- + if flag(development) ghc-options: -Werror- + if impl(ghc >=8.0) ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates
src/Language/ATS/Generate.hs view
@@ -10,7 +10,6 @@ ) where import Control.Arrow-import Data.Bool (bool) import Data.Char (toUpper) import Data.Either (lefts, rights) import Data.Foldable@@ -20,7 +19,6 @@ import Language.ATS.Generate.Error import Language.Haskell.Exts import Language.Haskell.Exts.Syntax as HS-import Language.Preprocessor.Cpphs (defaultCpphsOptions, runCpphs) import Lens.Micro (over, _head) import Text.Casing (quietSnake) @@ -174,15 +172,10 @@ ParseOk x -> Right x ParseFailed loc' msg -> syntaxError (loc' { srcFilename = file }) msg -process :: FilePath -> String -> IO String-process p = fmap (unlines . drop 1 . lines) . runCpphs defaultCpphsOptions p- genATSTypes :: FilePath -- ^ Haskell source file -> FilePath -- ^ @.sats@ file to be generated- -> Bool -- ^ Whether to use pre-process the Haskell source (use this if you use @{#- LANGUAGE CPP #-}@ anywhere) -> IO ()-genATSTypes p p' withCPP = do- let proc = bool pure (process p) withCPP- contents <- proc =<< readFile p+genATSTypes p p' = do+ contents <- readFile p let warnDo (x, es) = traverse_ displayErr es *> writeFile p' x either displayErr warnDo (generateATS p contents)