packages feed

language-ats 0.1.1.9 → 0.1.1.10

raw patch · 3 files changed

+14/−4 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

language-ats.cabal view
@@ -1,5 +1,5 @@ name:                language-ats-version:             0.1.1.9+version:             0.1.1.10 synopsis:            Parser and pretty-printer for ATS. description:         Parser and pretty-printer for [ATS](http://www.ats-lang.org/), written with Happy and Alex. license:             BSD3
src/Language/ATS/Parser.y view
@@ -560,6 +560,7 @@ -- | Optionally parse a function body OptExpression : { Nothing }               | eq Expression { Just $2 } -- FIXME only let this happen for external declarations+              | let {% Left $ Expected $1 "=" "let" } -- TODO is this actually a good idea?  -- | Parse a constructor for a 'dataprop' DataPropLeaf : vbar Universals Expression { DataPropLeaf $2 $3 Nothing }@@ -595,7 +596,6 @@             | Universals FunName Universals OptTermetric openParen FullArgs closeParen Signature OptType OptExpression { PreF $2 $8 $1 $3 $6 $9 $4 $10 }             | Universals FunName Universals OptTermetric doubleParens Signature OptType OptExpression { PreF $2 $6 $1 $3 [] $7 $4 $8 }             | Universals FunName Universals OptTermetric Signature OptType OptExpression { PreF $2 $5 $1 $3 [] $6 $4 $7 }-            | FunName openParen FullArgs closeParen Signature OptType let {% Left $ Expected $7 "Function body" "let" }             | prval {% Left $ Expected $1 "Function signature" "prval" }             | var {% Left $ Expected $1 "Function signature" "var" }             | val {% Left $ Expected (token_posn $1) "Function signature" "val" }
src/Language/ATS/PrettyPrint.hs view
@@ -277,7 +277,9 @@         a DoubleF                 = "double"         a FloatF                  = "float"         a (ForAF u t)             = pretty u <+> t-        a (UnconsumedF t)         = "!" <> t+        a (UnconsumedF t)+            | hasFunction "<> " t = "!" <> parens t+            | otherwise = "!" <> t         a (AsProofF t (Just t'))  = t <+> ">>" <+> t'         a (AsProofF t Nothing)    = t <+> ">> _"         a (FromVTF t)             = t <> "?!"@@ -291,11 +293,19 @@         a (TupleF _ ts)           = parens (mconcat (punctuate ", " (fmap pretty (reverse ts))))         a (RefTypeF t)            = "&" <> t         a (ViewTypeF _ t)         = "view@" <> parens t-        a (FunctionTypeF s t t')  = t <+> string s <+> t'+        a (FunctionTypeF s t t')+            | startsAnd t = parens t <+> string s <+> t'+            | otherwise = t <+> string s <+> t'         a (ViewLiteralF c)        = "view" <> pretty c         a NoneTypeF{}             = "()"         a ImplicitTypeF{}         = ".."         a (AnonymousRecordF _ rs) = prettyRecord rs++hasFunction :: String -> Doc -> Bool+hasFunction is = (\x -> all (`elem` x) is) . showFast++startsAnd :: Doc -> Bool+startsAnd = (=='&') . head . showFast  gan :: Maybe Type -> Doc gan (Just t) = " : " <> pretty t <> " "