hs2ats 0.5.0.0 → 0.5.0.1
raw patch · 5 files changed
+57/−49 lines, 5 filesdep −composition-preludedep ~haskell-src-extsPVP ok
version bump matches the API change (PVP)
Dependencies removed: composition-prelude
Dependency ranges changed: haskell-src-exts
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−1
- LICENSE +1/−1
- hs2ats.cabal +43/−40
- src/Language/ATS/Generate.hs +7/−5
- src/Language/ATS/Generate/Error.hs +1/−2
CHANGELOG.md view
@@ -1,11 +1,15 @@ # hs2ats +## 0.5.0.1++ * Remove `composition-prelude` dependency+ ## 0.5.0.0 * Re-add `cpphs` dependency ## 0.4.0.0- + * Stop depending on `cpphs` ## 0.3.0.4
LICENSE view
@@ -1,4 +1,4 @@-Copyright Vanessa McHale (c) 2018+Copyright Vanessa McHale (c) 2018-2019 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
hs2ats.cabal view
@@ -1,46 +1,47 @@-cabal-version: 1.18-name: hs2ats-version: 0.5.0.0-license: BSD3-license-file: LICENSE-copyright: Copyright: (c) 2018 Vanessa McHale-maintainer: vamchale@gmail.com-author: Vanessa McHale-synopsis: Create ATS types from Haskell types+cabal-version: 1.18+name: hs2ats+version: 0.5.0.1+license: BSD3+license-file: LICENSE+copyright: Copyright: (c) 2018-2019 Vanessa McHale+maintainer: vamchale@gmail.com+author: Vanessa McHale+synopsis: Create ATS types from Haskell types description: This package enables scanning Haskell source files for data types and then generating [ATS](http://www.ats-lang.org/) types from them.-category: Language, Haskell, ATS-build-type: Simple++category: Language, Haskell, ATS+build-type: Simple extra-source-files: test/data/*.hs test/data/*.out-extra-doc-files: CHANGELOG.md- README.md +extra-doc-files:+ CHANGELOG.md+ README.md+ flag development- description:- Enable `-Werror`- default: False- manual: True+ description: Enable `-Werror`+ default: False+ manual: True library- exposed-modules:- Language.ATS.Generate- hs-source-dirs: src- other-modules:- Language.ATS.Generate.Error+ exposed-modules: Language.ATS.Generate+ hs-source-dirs: src+ other-modules: Language.ATS.Generate.Error default-language: Haskell2010- other-extensions: DeriveAnyClass DeriveGeneric OverloadedStrings- StandaloneDeriving PatternSynonyms- ghc-options: -Wall+ other-extensions:+ DeriveAnyClass DeriveGeneric OverloadedStrings StandaloneDeriving+ PatternSynonyms++ ghc-options: -Wall build-depends: base >=4.7 && <5,- haskell-src-exts -any,+ haskell-src-exts >=1.18.0, language-ats >=1.5.0.0, casing -any, microlens -any, ansi-wl-pprint -any,- composition-prelude -any, deepseq -any, cpphs -any @@ -51,12 +52,14 @@ ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates executable hs2ats- main-is: Main.hs- hs-source-dirs: app+ main-is: Main.hs+ hs-source-dirs: app default-language: Haskell2010- other-extensions: DataKinds DeriveAnyClass DeriveGeneric- OverloadedStrings TypeOperators- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ other-extensions:+ DataKinds DeriveAnyClass DeriveGeneric OverloadedStrings+ TypeOperators++ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall build-depends: base -any, optparse-generic -any,@@ -69,11 +72,11 @@ ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates test-suite hs2ats-test- type: exitcode-stdio-1.0- main-is: Spec.hs- hs-source-dirs: test+ type: exitcode-stdio-1.0+ main-is: Spec.hs+ hs-source-dirs: test default-language: Haskell2010- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall build-depends: base -any, hs2ats -any,@@ -88,11 +91,11 @@ ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates benchmark hs2ats-bench- type: exitcode-stdio-1.0- main-is: Bench.hs- hs-source-dirs: bench+ type: exitcode-stdio-1.0+ main-is: Bench.hs+ hs-source-dirs: bench default-language: Haskell2010- ghc-options: -Wall+ ghc-options: -Wall build-depends: base -any, hs2ats -any,
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@@ -47,6 +46,7 @@ -- should we allow user-defined string map? stringTypeConv :: String -> ErrM String+stringTypeConv "Natural" = Right "intinfGte(0)" -- this is terrible but eh stringTypeConv "Integer" = Right "Intinf" stringTypeConv "String" = Right "Strptr1" stringTypeConv "CString" = Right "Strptr1"@@ -94,7 +94,7 @@ conDeclToType (ConDecl _ n []) = Right (toStringATS n, Nothing) conDeclToType (ConDecl _ n [t]) = (,) (toStringATS n) . Just <$> typeToType t conDeclToType (ConDecl _ n ts) = (,) (toStringATS n) . Just . ATS.Tuple undefined <$> traverse typeToType ts-conDeclToType (RecDecl _ _ []) = malformed "conDeclToType"+conDeclToType (RecDecl _ _ []) = malformed "conDeclToType" conDeclToType (RecDecl _ n fs) = (,) (toStringATS n) . Just . AnonymousRecord undefined <$> traverse fieldDeclToType (NE.fromList (reverse fs)) conDeclToType _ = unsupported "conDeclToType" @@ -130,8 +130,8 @@ -- TODO if it derives functor, use + asATSType :: Decl a -> ErrM (Declaration b)-asATSType (TypeDecl _ dh t) = ViewTypeDef undefined <$> (fst <$> asATSName dh) <*> (pruneATSNils . snd <$> asATSName dh) <*> typeToType t-asATSType (DataDecl _ DataType{} _ _ [] _) = malformed "asATSType"+asATSType (TypeDecl _ dh t) = ViewTypeDef undefined <$> (fst <$> asATSName dh) <*> (pruneATSNils . snd <$> asATSName dh) <*> typeToType t+asATSType (DataDecl _ DataType{} _ _ [] _) = malformed "asATSType" asATSType (DataDecl _ NewType{} _ dh [qcd] _) = ViewTypeDef undefined <$> (fst <$> asATSName dh) <*> (pruneATSNils . snd <$> asATSName dh) <*> qualConDeclToType qcd asATSType (DataDecl _ DataType{} _ dh [qcd] _) = ViewTypeDef undefined <$> (fst <$> asATSName dh) <*> (pruneATSNils . snd <$> asATSName dh) <*> qualConDeclToType qcd asATSType (DataDecl _ DataType{} _ dh qcds _) = SumViewType <$> (fst <$> asATSName dh) <*> (pruneATSNils . snd <$> asATSName dh) <*> traverse qualConDeclToLeaf (NE.fromList (reverse qcds))@@ -182,7 +182,9 @@ -> 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+ let proc = if withCPP+ then process p+ else pure contents <- proc =<< readFile p let warnDo (x, es) = traverse_ displayErr es *> writeFile p' x either displayErr warnDo (generateATS p contents)
src/Language/ATS/Generate/Error.hs view
@@ -15,7 +15,6 @@ , malformed ) where -import Control.Composition import Control.DeepSeq (NFData) import GHC.Generics (Generic) import Language.Haskell.Exts hiding (Pretty, loc)@@ -30,7 +29,7 @@ type ErrM a = Either GenerateError a syntaxError :: SrcLoc -> String -> ErrM a-syntaxError = Left .* HaskellSyntaxError+syntaxError = (Left .) . HaskellSyntaxError unsupported :: String -> ErrM a unsupported = Left . Unsupported