From eef6e4931fc245aebec1268bfead06e960b7fcb3 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Sun, 22 Sep 2024 00:52:53 +0000 Subject: [PATCH 1/3] ogma-core: Replace uses of awhen with uses of for_. Refs #150. The dependency on IfElse is quite unnecessary: it seems like the only function we use from that library is awhen :: Monad m => Maybe a -> (a -> m ()) -> m (), which is a type-specialized version of Data.Foldable.for_.. Since the latter is in base, we can simplify Ogma by removing the dependency on IfElse. This commit replaces uses of awhen with uses of for_. --- ogma-core/src/Command/FRETComponentSpec2Copilot.hs | 4 ++-- ogma-core/src/Command/FRETReqsDB2Copilot.hs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ogma-core/src/Command/FRETComponentSpec2Copilot.hs b/ogma-core/src/Command/FRETComponentSpec2Copilot.hs index fcf2144..74ed887 100644 --- a/ogma-core/src/Command/FRETComponentSpec2Copilot.hs +++ b/ogma-core/src/Command/FRETComponentSpec2Copilot.hs @@ -41,9 +41,9 @@ module Command.FRETComponentSpec2Copilot where -- External imports -import Control.Monad.IfElse ( awhen ) import Data.Aeson ( eitherDecode, decode ) import Data.ByteString.Lazy (fromStrict) +import Data.Foldable (for_) -- External imports: auxiliary import Data.ByteString.Extra as B ( safeReadFile ) @@ -91,7 +91,7 @@ fretComponentSpec2Copilot fp options = do let (mOutput, result) = fretComponentSpec2CopilotResult options fp copilot - awhen mOutput putStrLn + for_ mOutput putStrLn return result -- | Print the contents of a Copilot module that implements the Past-time TL diff --git a/ogma-core/src/Command/FRETReqsDB2Copilot.hs b/ogma-core/src/Command/FRETReqsDB2Copilot.hs index ee6d100..7dc52b9 100644 --- a/ogma-core/src/Command/FRETReqsDB2Copilot.hs +++ b/ogma-core/src/Command/FRETReqsDB2Copilot.hs @@ -39,9 +39,9 @@ module Command.FRETReqsDB2Copilot where -- External imports -import Control.Monad.IfElse ( awhen ) -import Data.Aeson ( eitherDecode ) -import Data.List ( nub, (\\) ) +import Data.Aeson (eitherDecode) +import Data.Foldable (for_) +import Data.List (nub, (\\)) -- External imports: auxiliary import Data.ByteString.Extra as B ( safeReadFile ) @@ -88,7 +88,7 @@ fretReqsDB2Copilot fp options = do let (mOutput, result) = fretReqsDB2CopilotResult options fp copilot - awhen mOutput putStrLn + for_ mOutput putStrLn return result -- | Print the contents of a Copilot module that implements the Past-time TL From dda0380efb25b2324d1e5a6d092ffdb16f13ae88 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Sun, 22 Sep 2024 00:53:29 +0000 Subject: [PATCH 2/3] ogma-core: Remove unnecessary dependency on IfElse. Refs #150. All uses of functions from IfElse have been replaced with uses of functions from base. This commit removes the dependency on IfElse from the ogma-core's cabal file. --- ogma-core/ogma-core.cabal | 1 - 1 file changed, 1 deletion(-) diff --git a/ogma-core/ogma-core.cabal b/ogma-core/ogma-core.cabal index a89d79e..2484716 100644 --- a/ogma-core/ogma-core.cabal +++ b/ogma-core/ogma-core.cabal @@ -107,7 +107,6 @@ library , aeson >= 2.0.0.0 && < 2.2 , bytestring , filepath - , IfElse , mtl , ogma-extra >= 1.4.0 && < 1.5 From 0db6542adbeeba654f4d011126a30a6adeeadb81 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Sun, 22 Sep 2024 00:55:42 +0000 Subject: [PATCH 3/3] ogma-core: Document changes in CHANGELOG. Refs #150. --- ogma-core/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ogma-core/CHANGELOG.md b/ogma-core/CHANGELOG.md index 1090c40..7f85dce 100644 --- a/ogma-core/CHANGELOG.md +++ b/ogma-core/CHANGELOG.md @@ -1,5 +1,9 @@ # Revision history for ogma-core +## [1.4.X] - 2024-09-21 + +* Remove dependency on IfElse (#150). + ## [1.4.0] - 2024-05-21 * Version bump 1.4.0 (#145).