Make `check` recognise `main-is` in conditional branches (#9768)
[cabal.git] / Cabal / src / Distribution / Compat / SnocList.hs
blobd655b3028813b50a9d3538a034ccdcaf011617f1
1 -----------------------------------------------------------------------------
3 -- |
4 -- Module : Distribution.Compat.SnocList
5 -- License : BSD3
6 --
7 -- Maintainer : cabal-dev@haskell.org
8 -- Stability : experimental
9 -- Portability : portable
11 -- A very reversed list. Has efficient `snoc`
12 module Distribution.Compat.SnocList
13 ( SnocList
14 , runSnocList
15 , snoc
16 ) where
18 import Distribution.Compat.Prelude
19 import Prelude ()
21 newtype SnocList a = SnocList [a]
23 snoc :: SnocList a -> a -> SnocList a
24 snoc (SnocList xs) x = SnocList (x : xs)
26 runSnocList :: SnocList a -> [a]
27 runSnocList (SnocList xs) = reverse xs
29 instance Semigroup (SnocList a) where
30 SnocList xs <> SnocList ys = SnocList (ys <> xs)
32 instance Monoid (SnocList a) where
33 mempty = SnocList []
34 mappend = (<>)