elm-syntax 0.3.0.0 → 0.3.1.0
raw patch · 5 files changed
+30/−7 lines, 5 filesdep ~basenew-uploaderPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−1
- elm-syntax.cabal +1/−1
- src/Language/Elm/Expression.hs +4/−4
- src/Language/Elm/Pretty.hs +15/−1
- src/Language/Elm/Simplification.hs +5/−0
CHANGELOG.md view
@@ -1,6 +1,10 @@ # Changelog for elm-syntax -## Unreleased changes+## 0.3.1.0++- Simplify record projections on known records+- Write explicit export lists+- Fix build with GHC 9.0. (see [#2](https://github.com/folq/elm-syntax/pull/2)) ## 0.3.0.0
elm-syntax.cabal view
@@ -7,7 +7,7 @@ -- hash: 7a5a97356a0303c135c29af83618eccb2a2d5844234020ab4cd4f38ee561609d name: elm-syntax-version: 0.3.0.0+version: 0.3.1.0 synopsis: Elm syntax and pretty-printing description: Please see the README on GitHub at <https://github.com/folq/elm-syntax#readme> category: Elm, Compiler, Language
src/Language/Elm/Expression.hs view
@@ -94,13 +94,13 @@ bind (fmap F . global) (unvar (pure . B) (fmap F . var)) . fromScope -deriving instance Eq v => Eq (Expression v)-deriving instance Ord v => Ord (Expression v)-deriving instance Show v => Show (Expression v)- deriveEq1 ''Expression deriveOrd1 ''Expression deriveShow1 ''Expression++deriving instance Eq v => Eq (Expression v)+deriving instance Ord v => Ord (Expression v)+deriving instance Show v => Show (Expression v) instance IsString (Expression v) where fromString = Global . fromString
src/Language/Elm/Pretty.hs view
@@ -1,3 +1,4 @@+{-# language LambdaCase #-} {-# language OverloadedStrings #-} {-# language ViewPatterns #-} module Language.Elm.Pretty@@ -92,8 +93,21 @@ HashSet.map (\(Name.Qualified m _) -> m) $ HashSet.filter (isNothing . defaultImport) $ foldMap (Definition.foldMapGlobals HashSet.singleton) defs++ exports =+ indent 4 $+ (<> line <> ")") $+ vsep $+ zipWith (<>) ("( " : repeat ", ") $+ map export defs++ export = \case+ Definition.Constant (Name.Qualified _ name) _ _ _ -> pretty name+ Definition.Type (Name.Qualified _ name) _ _ -> pretty name <> "(..)"+ Definition.Alias (Name.Qualified _ name) _ _ -> pretty name+ in- "module" <+> moduleName mname <+> "exposing (..)" <> line <> line <>+ "module" <+> moduleName mname <+> "exposing" <> line <> exports <> line <> line <> mconcat ["import" <+> moduleName import_ <> line | import_ <- imports] <> line <> line <> mconcat (intersperse (line <> line <> line) [definition env def | def <- defs])
src/Language/Elm/Simplification.hs view
@@ -69,6 +69,7 @@ -- is simplified to @let xs = es in branch@ provided that @e@ matches none of -- @prefixBranches@ and that it matches @pat@. -- * case-of-case+-- * { n = e, ... }.n = e -- simplifyExpression :: Expression v@@ -129,6 +130,10 @@ (Expression.Global _, _) -> Expression.apps expr args++ (Expression.Proj field, Expression.Record record:args')+ | Just e <- lookup field record ->+ simplifyApplication e args' (Expression.App e1 e2, _) -> simplifyApplication e1 (simplifyExpression e2 : args)