Skip to content
Snippets Groups Projects
Commit e34ab489 authored by BasLaa's avatar BasLaa Committed by Mergify
Browse files

Add changelog and move utility function

parent 170c862e
No related branches found
No related tags found
No related merge requests found
......@@ -64,8 +64,10 @@ import Distribution.Types.UnitId
( UnitId )
import Distribution.Client.ScriptUtils
( AcceptNoTargets(..), withContextAndSelectors, updateContextAndWriteProjectFile, TargetContext(..) )
import Distribution.Client.Utils
( occursOnlyOrBefore )
import Data.List (elemIndex, group)
import Data.List ( group )
import qualified Data.Set as Set
import GHC.Environment
......@@ -473,10 +475,3 @@ renderRunProblem (TargetProblemNoExes targetSelector) =
++ " because "
++ plural (targetSelectorPluralPkgs targetSelector) "it does" "they do"
++ " not contain any executables."
-- True if x occurs before y
occursOnlyOrBefore :: (Eq a) => [a] -> a -> a -> Bool
occursOnlyOrBefore xs x y = case (elemIndex x xs, elemIndex y xs) of
(Just i, Just j) -> i < j
(Just _, _) -> True
_ -> False
......@@ -29,6 +29,7 @@ module Distribution.Client.Utils
, listFilesInside
, safeRead
, hasElem
, occursOnlyOrBefore
) where
import Prelude ()
......@@ -47,7 +48,7 @@ import System.FilePath
import Control.Monad
( zipWithM_ )
import Data.List
( groupBy )
( groupBy, elemIndex )
import qualified Control.Exception as Exception
( finally )
import qualified Control.Exception.Safe as Safe
......@@ -488,3 +489,10 @@ safeRead s
-- This is [Agda.Utils.List.hasElem](https://hackage.haskell.org/package/Agda-2.6.2.2/docs/Agda-Utils-List.html#v:hasElem).
hasElem :: Ord a => [a] -> a -> Bool
hasElem xs = (`Set.member` Set.fromList xs)
-- True if x occurs before y
occursOnlyOrBefore :: (Eq a) => [a] -> a -> a -> Bool
occursOnlyOrBefore xs x y = case (elemIndex x xs, elemIndex y xs) of
(Just i, Just j) -> i < j
(Just _, _) -> True
_ -> False
synopsis: Add warning for running cabal run with +RTS flag
packages: cabal-install
prs: #8709
description: {
This adds a warning when 'cabal run +RTS' is run,
as this passes the +RTS options to cabal instead of the program.
More often, users want to use 'cabal run -- +RTS'
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment