packages feed

eo-phi-normalizer 2.1.0 → 2.2.0

raw patch · 4 files changed

+33/−8 lines, 4 files

Files

CHANGELOG.md view
@@ -6,13 +6,27 @@ and this project adheres to the [Haskell Package Versioning Policy](https://pvp.haskell.org/). +## v2.2.0 - 2024-11-26++### Breaking changes++- Use rules from `new.yaml` by default ([#555](https://github.com/objectionary/eo-phi-normalizer/pull/555))++### Changes and fixes++- Pretty printing doesn't put enough eols ([#550](https://github.com/objectionary/eo-phi-normalizer/pull/550))++### Documentation and maintenance++- Menu is broken on the site ([#551](https://github.com/objectionary/eo-phi-normalizer/pull/551))+ ## v2.1.0 - 2024-11-22 -## Breaking changes+### Breaking changes  - Rename `transform` to `rewrite` in the `eo-phi-normalizer` CLI ([#369](https://github.com/objectionary/eo-phi-normalizer/pull/369)) -## New+### New  - Add new rules ([#523](https://github.com/objectionary/eo-phi-normalizer/pull/523)) - Add new rules tests ([#540](https://github.com/objectionary/eo-phi-normalizer/pull/540))@@ -25,7 +39,7 @@  ## v2.0.0 - 2024-11-18 -## Breaking changes+### Breaking changes  - Rename `normalizer` to `eo-phi-normalizer` everywhere ([#494](https://github.com/objectionary/eo-phi-normalizer/pull/494)) 
app/Main.hs view
@@ -42,6 +42,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE ViewPatterns #-}@@ -56,13 +57,14 @@ import Control.Monad (forM, unless, when) import Data.Aeson (ToJSON) import Data.Aeson.Encode.Pretty (Config (..), Indent (..), defConfig, encodePrettyToTextBuilder')+import Data.FileEmbed (embedFileRelative) import Data.Foldable (forM_) import Data.List (intercalate, isPrefixOf) import Data.Maybe (fromMaybe) import Data.Text.Internal.Builder (toLazyText) import Data.Text.Lazy as TL (unpack) import Data.Version (showVersion)-import Data.Yaml (decodeFileThrow)+import Data.Yaml (decodeFileThrow, decodeThrow) import GHC.Generics (Generic) import Language.EO.Phi (Binding (..), Bytes (Bytes), Object (..), Program (Program), parseProgram, printTree) import Language.EO.Phi.Dataize@@ -586,7 +588,11 @@           Just path -> do             ruleSet <- parseRuleSetFromFile path             return (False, ruleSet.title, convertRuleNamed <$> ruleSet.rules)-          Nothing -> return (True, "Yegor's rules (builtin)", [fastYegorInsideOutAsRule])+          -- Temporary hack while rules are not stabilized.+          -- Nothing -> return (True, "Yegor's rules (builtin)", [fastYegorInsideOutAsRule])+          Nothing -> do+            ruleSet :: RuleSet <- decodeThrow $(embedFileRelative "test/eo/phi/rules/new.yaml")+            return (False, ruleSet.title, convertRuleNamed <$> ruleSet.rules)       unless (single || json) $ logStrLn ruleSetTitle       bindingsWithDeps <- case deepMergePrograms (program' : deps) of         Left err -> throw (CouldNotMergeDependencies err)
eo-phi-normalizer.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           eo-phi-normalizer-version:        2.1.0+version:        2.2.0 synopsis:       Command line normalizer of 𝜑-calculus expressions. description:    Please see the README on GitHub at <https://github.com/objectionary/eo-phi-normalizer#readme> homepage:       https://github.com/objectionary/eo-phi-normalizer#readme
src/Language/EO/Phi/Syntax.hs view
@@ -76,9 +76,14 @@     ")" : ts -> onNewLine (i - 1) p . showChar ')' . new (i - 1) ts     [";"] -> char ';'     ";" : ts -> char ';' . new i ts-    t : ts@(s : _)+    "." : ts -> rend i p (" ." : ts)+    t : ts@(s : ss)       | closingOrPunctuation s ->-          pending . showString t . rend i False ts+          (pending . showString t)+            . ( case s of+                  "," -> showChar ',' . new i ss+                  _ -> rend i False ts+              )     t : ts -> pending . space t . rend i False ts     [] -> id    where