hs2ats 0.3.0.2 → 0.3.0.3
raw patch · 2 files changed
+7/−17 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- hs2ats.cabal +1/−12
- src/Language/ATS/Generate.hs +6/−5
hs2ats.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: hs2ats-version: 0.3.0.2+version: 0.3.0.3 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2018 Vanessa McHale@@ -16,20 +16,12 @@ test/data/*.hs test/data/*.out -source-repository head- type: git- location: https://github.com/vmchale/hs2ats- flag development description: Enable `-Werror` default: False manual: True -flag no-executable- description:- Don't generate an executable- library exposed-modules: Language.ATS.Generate@@ -68,9 +60,6 @@ base -any, optparse-generic -any, hs2ats -any- - if flag(no-executable)- buildable: False if flag(development) ghc-options: -Werror
src/Language/ATS/Generate.hs view
@@ -13,6 +13,7 @@ import Data.Bool (bool) import Data.Char (toUpper) import Data.Either (lefts, rights)+import Data.Foldable import Data.Maybe import Language.ATS as ATS import Language.ATS.Generate.Error@@ -81,7 +82,7 @@ typeToType (TyParen _ t) = typeToType t typeToType (TyBang _ _ _ t) = typeToType t typeToType (TyFun _ t t') = FunctionType "-<lincloptr1>" <$> typeToType t <*> typeToType t'-typeToType (TyTuple _ _ ts) = ATS.Tuple undefined <$> mapM typeToType ts+typeToType (TyTuple _ _ ts) = ATS.Tuple undefined <$> traverse typeToType ts typeToType _ = Left $ Unsupported "typeToType" fieldDeclToType :: FieldDecl a -> ErrM (String, ATS.Type b)@@ -91,8 +92,8 @@ conDeclToType :: ConDecl a -> ErrM (String, Maybe (ATS.Type b)) 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 <$> mapM typeToType ts-conDeclToType (RecDecl _ n fs) = (,) (toStringATS n) . Just . AnonymousRecord undefined <$> mapM fieldDeclToType (reverse fs)+conDeclToType (ConDecl _ n ts) = (,) (toStringATS n) . Just . ATS.Tuple undefined <$> traverse typeToType ts+conDeclToType (RecDecl _ n fs) = (,) (toStringATS n) . Just . AnonymousRecord undefined <$> traverse fieldDeclToType (reverse fs) conDeclToType _ = unsupported "conDeclToType" toStringATS :: HS.Name a -> String@@ -130,7 +131,7 @@ asATSType (TypeDecl _ dh t) = ViewTypeDef undefined <$> (fst <$> asATSName dh) <*> (pruneATSNils . snd <$> asATSName dh) <*> typeToType t 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) <*> mapM qualConDeclToLeaf (reverse qcds)+asATSType (DataDecl _ DataType{} _ dh qcds _) = SumViewType <$> (fst <$> asATSName dh) <*> (pruneATSNils . snd <$> asATSName dh) <*> traverse qualConDeclToLeaf (reverse qcds) asATSType _ = unsupported "asATSType" -- TODO GDataDecl@@ -180,5 +181,5 @@ genATSTypes p p' withCPP = do let proc = bool pure (process p) withCPP contents <- proc =<< readFile p- let warnDo (x, es) = mapM_ displayErr es >> writeFile p' x+ let warnDo (x, es) = traverse_ displayErr es *> writeFile p' x either displayErr warnDo (generateATS p contents)