Use stylish-haskell to format import lists.

This commit is contained in:
Michael Walker 2017-04-08 05:20:39 +01:00
parent d934222fe7
commit cc27e03d6d
35 changed files with 327 additions and 245 deletions

62
.stylish-haskell.yaml Normal file
View File

@ -0,0 +1,62 @@
# stylish-haskell configuration file
# https://github.com/jaspervdj/stylish-haskell
##########################
steps:
# Import cleanup
- imports:
# Align the import names and import list throughout the entire
# file.
align: global
# Import list is aligned with end of import including 'as' and
# 'hiding' keywords.
#
# > import qualified Data.List as List (concat, foldl, foldr, head,
# > init, last, length)
list_align: after_alias
# Put as many import specs on same line as possible.
long_list_align: inline
# () is right after the module name:
#
# > import Vector.Instances ()
empty_list_align: right_after
# Align import list on lines after the import under the start of
# the module name.
list_padding: module_name
# There is no space between classes and constructors and the
# list of it's members.
#
# > import Data.Foldable (Foldable(fold, foldl, foldMap))
separate_lists: false
# Language pragmas
- language_pragmas:
# Vertical-spaced language pragmas, one per line.
style: vertical
# Brackets are not aligned together. There is only one space
# between actual import and closing bracket.
align: false
# Remove redundant language pragmas.
remove_redundant: true
# Remove trailing whitespace
- trailing_whitespace: {}
# Maximum line length, used by some of the steps above.
columns: 80
# Convert newlines to LF ("\n").
newline: lf
# For some reason, stylish-haskell thinks I need these extensions
# turning on in order to parse the code.
language_extensions:
- MultiParamTypeClasses
- TemplateHaskell

View File

@ -29,10 +29,10 @@ module Control.Concurrent.Classy
, module Control.Concurrent.Classy.QSemN
) where
import Control.Monad.Conc.Class
import Control.Concurrent.Classy.Chan
import Control.Concurrent.Classy.CRef
import Control.Concurrent.Classy.MVar
import Control.Concurrent.Classy.STM
import Control.Concurrent.Classy.QSem
import Control.Concurrent.Classy.QSemN
import Control.Concurrent.Classy.STM
import Control.Monad.Conc.Class

View File

@ -78,10 +78,13 @@ module Control.Concurrent.Classy.Async
) where
import Control.Applicative
import Control.Concurrent.Classy.STM.TMVar (newEmptyTMVar, putTMVar, readTMVar)
import Control.Exception (AsyncException(ThreadKilled), BlockedIndefinitelyOnSTM(..), Exception, SomeException)
import Control.Concurrent.Classy.STM.TMVar (newEmptyTMVar, putTMVar,
readTMVar)
import Control.Exception (AsyncException(ThreadKilled),
BlockedIndefinitelyOnSTM(..),
Exception, SomeException)
import Control.Monad
import Control.Monad.Catch (finally, try, onException)
import Control.Monad.Catch (finally, onException, try)
import Control.Monad.Conc.Class
import Control.Monad.STM.Class
import Data.Foldable (foldMap)

View File

@ -16,9 +16,10 @@ module Control.Concurrent.Classy.QSemN
, signalQSemN
) where
import Control.Monad.Conc.Class (MonadConc)
import Control.Concurrent.Classy.MVar
import Control.Monad.Catch (mask_, onException, uninterruptibleMask_)
import Control.Monad.Catch (mask_, onException,
uninterruptibleMask_)
import Control.Monad.Conc.Class (MonadConc)
import Data.Maybe
-- | 'QSemN' is a quantity semaphore in which the resource is aqcuired

View File

@ -17,10 +17,10 @@ module Control.Concurrent.Classy.STM
, module Control.Concurrent.Classy.STM.TArray
) where
import Control.Monad.STM.Class
import Control.Concurrent.Classy.STM.TVar
import Control.Concurrent.Classy.STM.TMVar
import Control.Concurrent.Classy.STM.TChan
import Control.Concurrent.Classy.STM.TQueue
import Control.Concurrent.Classy.STM.TBQueue
import Control.Concurrent.Classy.STM.TArray
import Control.Concurrent.Classy.STM.TBQueue
import Control.Concurrent.Classy.STM.TChan
import Control.Concurrent.Classy.STM.TMVar
import Control.Concurrent.Classy.STM.TQueue
import Control.Concurrent.Classy.STM.TVar
import Control.Monad.STM.Class

View File

@ -1,4 +1,5 @@
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
-- |
-- Module : Control.Concurrent.Classy.STM.
@ -16,8 +17,8 @@
module Control.Concurrent.Classy.STM.TArray (TArray) where
import Data.Array (Array, bounds)
import Data.Array.Base (listArray, arrEleBottom, unsafeAt, MArray(..),
IArray(numElements))
import Data.Array.Base (IArray(numElements), MArray(..),
arrEleBottom, listArray, unsafeAt)
import Data.Ix (rangeSize)
import Control.Monad.STM.Class

View File

@ -29,7 +29,7 @@ module Control.Concurrent.Classy.STM.TMVar
, swapTMVar
) where
import Control.Monad (liftM, when, unless)
import Control.Monad (liftM, unless, when)
import Control.Monad.STM.Class
import Data.Maybe (isJust, isNothing)

View File

@ -25,8 +25,8 @@ module Control.Concurrent.Classy.STM.TVar
, registerDelay
) where
import Control.Monad.STM.Class
import Control.Monad.Conc.Class
import Control.Monad.STM.Class
import Data.Functor (void)
-- * @TVar@s

View File

@ -66,8 +66,10 @@ module Control.Monad.Conc.Class
) where
-- for the class and utilities
import Control.Exception (Exception, AsyncException(ThreadKilled), SomeException)
import Control.Monad.Catch (MonadCatch, MonadThrow, MonadMask)
import Control.Exception (AsyncException(ThreadKilled),
Exception, SomeException)
import Control.Monad.Catch (MonadCatch, MonadMask,
MonadThrow)
import qualified Control.Monad.Catch as Ca
import Control.Monad.STM.Class (MonadSTM, TVar, readTVar)
import Control.Monad.Trans.Control (MonadTransControl, StT, liftWith)
@ -82,12 +84,12 @@ import qualified Data.IORef as IO
-- for the transformer instances
import Control.Monad.Reader (ReaderT)
import Control.Monad.Trans (lift)
import Control.Monad.Trans.Identity (IdentityT)
import qualified Control.Monad.RWS.Lazy as RL
import qualified Control.Monad.RWS.Strict as RS
import qualified Control.Monad.State.Lazy as SL
import qualified Control.Monad.State.Strict as SS
import Control.Monad.Trans (lift)
import Control.Monad.Trans.Identity (IdentityT)
import qualified Control.Monad.Writer.Lazy as WL
import qualified Control.Monad.Writer.Strict as WS

View File

@ -244,7 +244,7 @@ module Test.DejaFu
import Control.Arrow (first)
import Control.DeepSeq (NFData(..))
import Control.Monad (when, unless)
import Control.Monad (unless, when)
import Control.Monad.Ref (MonadRef)
import Control.Monad.ST (runST)
import Data.Function (on)

View File

@ -62,7 +62,7 @@ module Test.DejaFu.Common
import Control.DeepSeq (NFData(..))
import Control.Exception (MaskingState(..))
import Data.List (sort, nub, intercalate)
import Data.List (intercalate, nub, sort)
import Data.List.NonEmpty (NonEmpty)
import Data.Maybe (fromMaybe, mapMaybe)
import Data.Set (Set)

View File

@ -15,14 +15,17 @@
-- interface of this library.
module Test.DejaFu.Conc.Internal where
import Control.Exception (MaskingState(..), toException)
import Control.Monad.Ref (MonadRef, newRef, readRef, writeRef)
import Control.Exception (MaskingState(..),
toException)
import Control.Monad.Ref (MonadRef, newRef, readRef,
writeRef)
import qualified Data.Foldable as F
import Data.Functor (void)
import Data.List (sort)
import Data.List.NonEmpty (NonEmpty(..), fromList)
import qualified Data.Map.Strict as M
import Data.Maybe (fromJust, isJust, isNothing)
import Data.Maybe (fromJust, isJust,
isNothing)
import Data.Monoid ((<>))
import Data.Sequence (Seq, (<|))
import qualified Data.Sequence as Seq
@ -32,7 +35,8 @@ import Test.DejaFu.Conc.Internal.Common
import Test.DejaFu.Conc.Internal.Memory
import Test.DejaFu.Conc.Internal.Threading
import Test.DejaFu.Schedule
import Test.DejaFu.STM (Result(..), runTransaction)
import Test.DejaFu.STM (Result(..),
runTransaction)
--------------------------------------------------------------------------------
-- * Execution

View File

@ -14,8 +14,8 @@
module Test.DejaFu.Conc.Internal.Common where
import Control.Exception (Exception, MaskingState(..))
import Data.Map.Strict (Map)
import Data.List.NonEmpty (NonEmpty, fromList)
import Data.Map.Strict (Map)
import Test.DejaFu.Common
import Test.DejaFu.STM (STMLike)

View File

@ -24,11 +24,13 @@
module Test.DejaFu.Conc.Internal.Memory where
import Control.Monad (when)
import Control.Monad.Ref (MonadRef, readRef, writeRef)
import Control.Monad.Ref (MonadRef, readRef,
writeRef)
import Data.Map.Strict (Map)
import Data.Maybe (isJust, fromJust)
import Data.Maybe (fromJust, isJust)
import Data.Monoid ((<>))
import Data.Sequence (Seq, ViewL(..), (><), singleton, viewl)
import Data.Sequence (Seq, ViewL(..), singleton,
viewl, (><))
import Test.DejaFu.Common
import Test.DejaFu.Conc.Internal.Common

View File

@ -13,7 +13,8 @@
-- form part of the public interface of this library.
module Test.DejaFu.Conc.Internal.Threading where
import Control.Exception (Exception, MaskingState(..), SomeException, fromException)
import Control.Exception (Exception, MaskingState(..),
SomeException, fromException)
import Data.List (intersect)
import Data.Map.Strict (Map)
import Data.Maybe (fromMaybe, isJust)

View File

@ -14,21 +14,23 @@ module Test.DejaFu.SCT.Internal where
import Control.DeepSeq (NFData(..))
import Control.Exception (MaskingState(..))
import Data.Char (ord)
import Data.Function (on)
import qualified Data.Foldable as F
import Data.Function (on)
import Data.List (intercalate, nubBy, partition, sortOn)
import Data.List.NonEmpty (NonEmpty(..), toList)
import Data.Map.Strict (Map)
import Data.Maybe (catMaybes, fromJust, isJust, isNothing, listToMaybe)
import qualified Data.Map.Strict as M
import Data.Set (Set)
import qualified Data.Set as S
import Data.Maybe (catMaybes, fromJust, isJust, isNothing,
listToMaybe)
import Data.Sequence (Seq, (|>))
import qualified Data.Sequence as Sq
import Data.Set (Set)
import qualified Data.Set as S
import System.Random (RandomGen, randomR)
import Test.DejaFu.Common
import Test.DejaFu.Schedule (Decision(..), Scheduler, decisionOf, tidOf)
import Test.DejaFu.Schedule (Decision(..), Scheduler, decisionOf,
tidOf)
-------------------------------------------------------------------------------
-- * Dynamic partial-order reduction

View File

@ -16,7 +16,8 @@
module Test.DejaFu.STM.Internal where
import Control.DeepSeq (NFData(..))
import Control.Exception (Exception, SomeException, fromException, toException)
import Control.Exception (Exception, SomeException, fromException,
toException)
import Control.Monad.Cont (Cont, runCont)
import Control.Monad.Ref (MonadRef, newRef, readRef, writeRef)
import Data.List (nub)

View File

@ -63,11 +63,12 @@ import Control.Monad.Catch (try)
import Control.Monad.ST (runST)
import Data.List (intercalate, intersperse)
import System.Random (RandomGen)
import Test.HUnit (Assertable(..), Test(..), Testable(..), assertString)
import Test.HUnit.Lang (HUnitFailure(..))
import Test.DejaFu
import qualified Test.DejaFu.Conc as Conc
import qualified Test.DejaFu.SCT as SCT
import Test.HUnit (Assertable(..), Test(..), Testable(..),
assertString)
import Test.HUnit.Lang (HUnitFailure(..))
-- Can't put the necessary forall in the @Assertable Conc.ConcST t@
-- instance :(

View File

@ -67,8 +67,10 @@ import Test.DejaFu
import qualified Test.DejaFu.Conc as Conc
import qualified Test.DejaFu.SCT as SCT
import Test.Tasty (TestName, TestTree, testGroup)
import Test.Tasty.Options (OptionDescription(..), IsOption(..), lookupOption)
import Test.Tasty.Providers (IsTest(..), singleTest, testPassed, testFailed)
import Test.Tasty.Options (IsOption(..), OptionDescription(..),
lookupOption)
import Test.Tasty.Providers (IsTest(..), singleTest, testFailed,
testPassed)
-- Can't put the necessary forall in the @IsTest ConcST t@
-- instance :(