From 45aed208f1b1ddca4f87c61b04f6cd26d833bf8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Akg=C3=BCn?= Date: Thu, 27 Jun 2024 15:02:46 +0100 Subject: [PATCH] starting with cosmetic changes --- Makefile | 1 + etc/build/gen_Operator.hs | 1 + src/Conjure/Prelude.hs | 6 ++++++ src/test/Conjure/ModelAllSolveAll.hs | 2 +- src/test/Conjure/RepresentationsTest.hs | 1 - 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 729101097c..ff80ebe6c2 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,7 @@ test: stack test --test-arguments '--hide-successes --limit-time ${LIMIT_TIME}';\ fi +.PHONY: stack.yaml stack.yaml: etc/hs-deps/stack-${GHC_VERSION}.yaml @cp etc/hs-deps/stack-${GHC_VERSION}.yaml stack.yaml diff --git a/etc/build/gen_Operator.hs b/etc/build/gen_Operator.hs index 666d2fb235..171d1aa080 100644 --- a/etc/build/gen_Operator.hs +++ b/etc/build/gen_Operator.hs @@ -66,6 +66,7 @@ main = do , [ "" , "instance ( Pretty x" + , " , Data x" , " , ExpressionLike x" , " , ReferenceContainer x" , " , TypeOf x" diff --git a/src/Conjure/Prelude.hs b/src/Conjure/Prelude.hs index 8b25867768..140a585315 100644 --- a/src/Conjure/Prelude.hs +++ b/src/Conjure/Prelude.hs @@ -9,6 +9,7 @@ module Conjure.Prelude ( module X , stringToDoc + , textToDoc , padRight, padLeft, padCenter , pairWithContents , withRest, withAfter, withBefore @@ -123,6 +124,7 @@ import Data.List as X ( (\\), intercalate, intersperse, minimumBy, nub, , inits, tails , findIndex , filter, partition + , cycle ) import Data.List.Split as X ( splitOn, chunksOf ) import Data.Maybe as X ( Maybe(..), catMaybes, listToMaybe, fromMaybe, maybe, maybeToList, mapMaybe @@ -170,6 +172,7 @@ import Data.Generics.Uniplate.Data as X , transformM, transformBiM , descend, descendM , descendBi, descendBiM + , rewriteBi , universe, universeBi , children, childrenBi , uniplate @@ -257,6 +260,9 @@ textToString = T.unpack stringToDoc :: String -> Doc stringToDoc = Pr.text +textToDoc :: T.Text -> Doc +textToDoc = stringToDoc . textToString + padRight :: Int -> Char -> String -> String padRight n ch s = s ++ replicate (n - length s) ch diff --git a/src/test/Conjure/ModelAllSolveAll.hs b/src/test/Conjure/ModelAllSolveAll.hs index 47749303e9..871acb6a81 100644 --- a/src/test/Conjure/ModelAllSolveAll.hs +++ b/src/test/Conjure/ModelAllSolveAll.hs @@ -193,7 +193,7 @@ testSingleDir (TestTimeLimit timeLimitMin timeLimitMax) srOptions t@TestDirFiles then validateSolutionNoParam step t expectedSols else validateSolutionWithParams step t [ ( p , [ s | s <- expectedSols - , dropExtension p `isInfixOf` dropExtension s + , (dropExtension p ++ "-solution") `isInfixOf` dropExtension s ] ) | p <- paramFiles diff --git a/src/test/Conjure/RepresentationsTest.hs b/src/test/Conjure/RepresentationsTest.hs index 8df5d6b981..deef396a70 100644 --- a/src/test/Conjure/RepresentationsTest.hs +++ b/src/test/Conjure/RepresentationsTest.hs @@ -1234,4 +1234,3 @@ instance Show (Pr (Name, Constant)) where instance Show (Pr [(Name, Constant)]) where show (Pr xs) = intercalate "\n" $ map (show . Pr) xs -