packages feed

ats-format 0.1.0.17 → 0.1.0.18

raw patch · 4 files changed

+23/−12 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Language.ATS: SumType :: String -> [Arg] -> [(String, Maybe Type)] -> Declaration
+ Language.ATS: SumType :: String -> [Arg] -> [(String, [String], Maybe Type)] -> Declaration
- Language.ATS: SumViewType :: String -> [Arg] -> [(String, Maybe Type)] -> Declaration
+ Language.ATS: SumViewType :: String -> [Arg] -> [(String, [String], Maybe Type)] -> Declaration

Files

ats-format.cabal view
@@ -1,5 +1,5 @@ name:                ats-format-version:             0.1.0.17+version:             0.1.0.18 synopsis:            A source-code formatter for ATS description:         An opinionated source-code formatter for ATS (http://www.ats-lang.org/). homepage:            https://hub.darcs.net/vmchale/ats-format#readme
src/Language/ATS/Parser.y view
@@ -448,16 +448,23 @@         | Records comma identifier eq Type { ($3, $5) : $1 }         | Records comma identifierSpace eq Type { ($3, $5) : $1 } +IdentifiersIn : identifier { [$1] }+              | IdentifiersIn comma identifier { $3 : $1 }+ -- | Parse a constructor for a sum type-SumLeaf : vbar identifier { ($2, Nothing) }-        | vbar identifierSpace of Type { ($2, Just $4) }+SumLeaf : vbar identifier { ($2, [], Nothing) }+        | vbar identifierSpace of Type { ($2, [], Just $4) }+        | vbar IdentifierOr openParen IdentifiersIn closeParen { ($2, $4, Nothing) }+        | vbar IdentifierOr openParen IdentifiersIn closeParen of Type { ($2, $4, Just $7) }  -- | Parse all constructors of a sum type Leaves : SumLeaf { [$1] }        | Leaves SumLeaf { $2 : $1 }-       | identifierSpace of Type { [($1, Just $3)] }-       | identifier { [($1, Nothing)] }+       | identifierSpace of Type { [($1, [], Just $3)] }+       | identifier { [($1, [], Nothing)] }        | dollar {% Left $ Expected $1 "|" "$" }+       | identifier openParen IdentifiersIn closeParen  { [($1, $3, Nothing)] }+       | identifier openParen IdentifiersIn closeParen of Type { [($1, $3, Just $6)] }  Universals : { [] }            | doubleBraces { [] }
src/Language/ATS/PrettyPrint.hs view
@@ -356,12 +356,16 @@ prettyDL (DataPropLeaf us e Nothing:xs) = prettyDL xs $$ indent 2 ("|" <+> foldMap pretty us <+> pretty e) prettyDL (DataPropLeaf us e (Just e'):xs) = prettyDL xs $$ indent 2 ("|" <+> foldMap pretty us <+> pretty e <+> "of" <+> pretty e') -prettyLeaf :: [(String, Maybe Type)] -> Doc+prettyLeaf :: [(String, [String], Maybe Type)] -> Doc prettyLeaf []                = mempty-prettyLeaf [(s, Nothing)]    = indent 2 ("|" <+> string s)-prettyLeaf [(s, Just e)]     = indent 2 ("|" <+> string s <+> "of" <+> pretty e)-prettyLeaf ((s, Nothing):xs) = prettyLeaf xs $$ indent 2 ("|" <+> string s)-prettyLeaf ((s, Just e):xs)  = prettyLeaf xs $$ indent 2 ("|" <+> string s <+> "of" <+> pretty e)+prettyLeaf [(s, [], Nothing)]    = indent 2 ("|" <+> string s)+prettyLeaf [(s, [], Just e)]     = indent 2 ("|" <+> string s <+> "of" <+> pretty e)+prettyLeaf ((s, [], Nothing):xs) = prettyLeaf xs $$ indent 2 ("|" <+> string s)+prettyLeaf ((s, [], Just e):xs)  = prettyLeaf xs $$ indent 2 ("|" <+> string s <+> "of" <+> pretty e)+prettyLeaf [(s, as, Nothing)]    = indent 2 ("|" <+> string s <> prettyArgs as)+prettyLeaf [(s, as, Just e)]     = indent 2 ("|" <+> string s <> prettyArgs as <+> "of" <+> pretty e)+prettyLeaf ((s, as, Nothing):xs) = prettyLeaf xs $$ indent 2 ("|" <+> string s <> prettyArgs as)+prettyLeaf ((s, as, Just e):xs)  = prettyLeaf xs $$ indent 2 ("|" <+> string s <> prettyArgs as <+> "of" <+> pretty e)  prettyHelper :: Doc -> [Doc] -> [Doc] prettyHelper _ [x]    = [x]
src/Language/ATS/Types.hs view
@@ -69,8 +69,8 @@                  | RecordViewType String [Arg] [Universal] [(String, Type)]                  | TypeDef AlexPosn String [Arg] Type                  | ViewTypeDef AlexPosn String [Arg] Type-                 | SumType String [Arg] [(String, Maybe Type)] -- TODO [Arg] for here-                 | SumViewType String [Arg] [(String, Maybe Type)]+                 | SumType String [Arg] [(String, [String], Maybe Type)]+                 | SumViewType String [Arg] [(String, [String], Maybe Type)]                  | AbsType AlexPosn String [Arg] (Maybe Type)                  | AbsViewType AlexPosn String [Arg] (Maybe Type)                  | AbsView AlexPosn String [Arg] (Maybe Type)