diff --git a/Setup.hs b/Setup.hs index 9a994af6..44671092 100644 --- a/Setup.hs +++ b/Setup.hs @@ -1,2 +1,2 @@ -import Distribution.Simple +import Distribution.Simple main = defaultMain diff --git a/misc/DKSolve.hs b/misc/DKSolve.hs index 1230f94e..3f02c4ba 100644 --- a/misc/DKSolve.hs +++ b/misc/DKSolve.hs @@ -5,8 +5,8 @@ -- See http://en.wikipedia.org/wiki/Durand–Kerner_method -import Data.Complex -import Data.List (inits, tails) +import Data.Complex +import Data.List (inits, tails) eps :: Double eps = 1e-14 @@ -48,4 +48,4 @@ type C = Complex Double fixedPt :: Double -> ([C] -> [C]) -> [C] -> [C] fixedPt eps f as | all (( a -> a snugCenter d = applyAll fs d where - fs = map snugCenterV basis \ No newline at end of file + fs = map snugCenterV basis diff --git a/src/Diagrams/Angle.hs b/src/Diagrams/Angle.hs index 31cb0497..08145600 100644 --- a/src/Diagrams/Angle.hs +++ b/src/Diagrams/Angle.hs @@ -1,8 +1,8 @@ +{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE FlexibleContexts #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.Angle @@ -26,14 +26,14 @@ module Diagrams.Angle , HasPhi(..) ) where -import Control.Lens (Iso', Lens', iso, review) +import Control.Lens (Iso', Lens', iso, review) -import Data.Monoid hiding ((<>)) -import Data.Semigroup -import Data.VectorSpace +import Data.Monoid hiding ((<>)) +import Data.Semigroup +import Data.VectorSpace -import Diagrams.Core.V -import Diagrams.Points +import Diagrams.Core.V +import Diagrams.Points -- | Angles can be expressed in a variety of units. Internally, -- they are represented in radians. diff --git a/src/Diagrams/Animation.hs b/src/Diagrams/Animation.hs index 647f91c5..cceb4fa6 100644 --- a/src/Diagrams/Animation.hs +++ b/src/Diagrams/Animation.hs @@ -1,7 +1,7 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.Animation diff --git a/src/Diagrams/Attributes.hs b/src/Diagrams/Attributes.hs index f08ae854..379e9644 100644 --- a/src/Diagrams/Attributes.hs +++ b/src/Diagrams/Attributes.hs @@ -48,8 +48,8 @@ module Diagrams.Attributes ( ) where import Data.Colour -import Data.Colour.RGBSpace (RGB (..)) -import Data.Colour.SRGB (toSRGB) +import Data.Colour.RGBSpace (RGB (..)) +import Data.Colour.SRGB (toSRGB) import Data.Default.Class import Data.Semigroup @@ -209,4 +209,4 @@ lineMiterLimit = applyAttr . LineMiterLimit . Last -- | Apply a 'LineMiterLimit' attribute. lineMiterLimitA :: HasStyle a => LineMiterLimit -> a -> a -lineMiterLimitA = applyAttr \ No newline at end of file +lineMiterLimitA = applyAttr diff --git a/src/Diagrams/Backend/CmdLine.hs b/src/Diagrams/Backend/CmdLine.hs index 68e61ccc..72ac6aae 100644 --- a/src/Diagrams/Backend/CmdLine.hs +++ b/src/Diagrams/Backend/CmdLine.hs @@ -426,10 +426,10 @@ class Mainable d where -- @ -- import Diagrams.Prelude -- import Diagrams.Backend.TheBestBackend.CmdLine - -- + -- -- d :: Diagram B R2 -- d = ... - -- + -- -- main = mainWith d -- @ -- diff --git a/src/Diagrams/BoundingBox.hs b/src/Diagrams/BoundingBox.hs index f913b56f..650fe8b3 100644 --- a/src/Diagrams/BoundingBox.hs +++ b/src/Diagrams/BoundingBox.hs @@ -43,15 +43,13 @@ module Diagrams.BoundingBox import Control.Applicative ((<$>)) import qualified Data.Foldable as F -import Data.Map (Map, fromDistinctAscList, fromList, - toAscList, toList) +import Data.Map (Map, fromDistinctAscList, fromList, toAscList, toList) import Data.Maybe (fromMaybe) import Data.VectorSpace -- (VectorSpace, Scalar, AdditiveGroup, zeroV, negateV, (^+^), (^-^)) -import Data.Basis (Basis, HasBasis, basisValue, - decompose, recompose) +import Data.Basis (Basis, HasBasis, basisValue, decompose, recompose) import Data.Monoid (Monoid (..)) import Data.Semigroup (Option (..), Semigroup (..)) @@ -61,8 +59,8 @@ import Data.Typeable (Typeable) import Diagrams.Core.Envelope (Enveloped (..), appEnvelope) import Diagrams.Core.HasOrigin (HasOrigin (..)) import Diagrams.Core.Points (Point (..)) -import Diagrams.Core.Transform (HasLinearMap, Transformable (..), - Transformation (..), (<->)) +import Diagrams.Core.Transform (HasLinearMap, Transformable (..), Transformation (..), + (<->)) import Diagrams.Core.V (V) -- Unexported utility newtype diff --git a/src/Diagrams/Combinators.hs b/src/Diagrams/Combinators.hs index 2b0aa4b0..e6d45ed4 100644 --- a/src/Diagrams/Combinators.hs +++ b/src/Diagrams/Combinators.hs @@ -32,7 +32,7 @@ module Diagrams.Combinators -- * n-ary operations , appends - , position, atPoints + , position, atPoints , cat, cat' , CatOpts(_catMethod, _sep), catMethod, sep , CatMethod(..) @@ -41,9 +41,8 @@ module Diagrams.Combinators import Data.Typeable -import Control.Lens (Lens', generateSignatures, lensField, - lensRules, makeLensesWith, (%~), (&), - (.~), (^.), _Wrapping) +import Control.Lens (Lens', generateSignatures, lensField, lensRules, + makeLensesWith, (%~), (&), (.~), (^.), _Wrapping) import Data.AdditiveGroup import Data.AffineSpace ((.+^)) import Data.Default.Class diff --git a/src/Diagrams/Coordinates.hs b/src/Diagrams/Coordinates.hs index 8d1050bb..f6a0f5b2 100644 --- a/src/Diagrams/Coordinates.hs +++ b/src/Diagrams/Coordinates.hs @@ -20,12 +20,12 @@ module Diagrams.Coordinates ) where -import Control.Lens (Lens') +import Control.Lens (Lens') import Data.VectorSpace -import Diagrams.Points import Data.AffineSpace.Point import Diagrams.Core.V +import Diagrams.Points -- | Types which are instances of the @Coordinates@ class can be -- constructed using '^&' (for example, a three-dimensional vector diff --git a/src/Diagrams/CubicSpline/Internal.hs b/src/Diagrams/CubicSpline/Internal.hs index 03bd10c5..3ff33196 100644 --- a/src/Diagrams/CubicSpline/Internal.hs +++ b/src/Diagrams/CubicSpline/Internal.hs @@ -1,6 +1,5 @@ -{-# LANGUAGE TypeFamilies - , FlexibleContexts - #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} ----------------------------------------------------------------------------- -- | @@ -25,10 +24,10 @@ module Diagrams.CubicSpline.Internal , solveCubicSplineCoefficients ) where -import Data.List +import Data.List --- | Solves a system of the form 'A*X=D' for 'x' where 'A' is an --- 'n' by 'n' matrix with 'bs' as the main diagonal and +-- | Solves a system of the form 'A*X=D' for 'x' where 'A' is an +-- 'n' by 'n' matrix with 'bs' as the main diagonal and -- 'as' the diagonal below and 'cs' the diagonal above. -- See: solveTriDiagonal :: Fractional a => [a] -> [a] -> [a] -> [a] -> [a] @@ -39,11 +38,11 @@ solveTriDiagonal as (b0:bs) (c0:cs) (d0:ds) = h cs' ds' f (c':cs') (a:as) (b:bs) (c:cs) = c / (b - c' * a) : f cs' as bs cs f _ _ _ _ = error "solveTriDiagonal.f: impossible!" - ds' = d0 / b0 : g ds' as bs cs' ds + ds' = d0 / b0 : g ds' as bs cs' ds g _ [] _ _ _ = [] g (d':ds') (a:as) (b:bs) (c':cs') (d:ds) = (d - d' * a)/(b - c' * a) : g ds' as bs cs' ds g _ _ _ _ _ = error "solveTriDiagonal.g: impossible!" - + h _ [d] = [d] h (c:cs) (d:ds) = let xs@(x:_) = h cs ds in d - c * x : xs h _ _ = error "solveTriDiagonal.h: impossible!" @@ -58,13 +57,13 @@ modifyLast f (a:as) = a : modifyLast f as -- Helper that builds a list of length n of the form: '[s,m,m,...,m,m,e]' sparseVector :: Int -> a -> a -> a -> [a] -sparseVector n s m e +sparseVector n s m e | n < 1 = [] | otherwise = s : h (n - 1) - where + where h 1 = [e] h n = m : h (n - 1) - + -- | Solves a system similar to the tri-diagonal system using a special case -- of the Sherman-Morrison formula . -- This code is based on /Numerical Recpies in C/'s @cyclic@ function in section 2.7. @@ -74,12 +73,12 @@ solveCyclicTriDiagonal as (b0:bs) cs ds alpha beta = zipWith ((+) . (fact *)) zs l = length ds gamma = -b0 us = sparseVector l gamma 0 alpha - + bs' = (b0 - gamma) : modifyLast (subtract (alpha*beta/gamma)) bs - + xs@(x:_) = solveTriDiagonal as bs' cs ds zs@(z:_) = solveTriDiagonal as bs' cs us - + fact = -(x + beta * last xs / gamma) / (1.0 + z + beta * last zs / gamma) solveCyclicTriDiagonal _ _ _ _ _ _ = error "second argument to solveCyclicTriDiagonal must be nonempty" @@ -87,7 +86,7 @@ solveCyclicTriDiagonal _ _ _ _ _ _ = error "second argument to solveCyclicTriDia -- | Use the tri-diagonal solver with the appropriate parameters for an open cubic spline. solveCubicSplineDerivatives :: Fractional a => [a] -> [a] solveCubicSplineDerivatives (x:xs) = solveTriDiagonal as bs as ds - where + where as = replicate (l - 1) 1 bs = 2 : replicate (l - 2) 4 ++ [2] l = length ds @@ -99,7 +98,7 @@ solveCubicSplineDerivatives _ = error "argument to solveCubicSplineDerivatives m -- | Use the cyclic-tri-diagonal solver with the appropriate parameters for a closed cubic spline. solveCubicSplineDerivativesClosed :: Fractional a => [a] -> [a] solveCubicSplineDerivativesClosed xs = solveCyclicTriDiagonal as bs as ds 1 1 - where + where as = replicate (l - 1) 1 bs = replicate l 4 l = length xs @@ -109,11 +108,11 @@ solveCubicSplineDerivativesClosed xs = solveCyclicTriDiagonal as bs as ds 1 1 -- | Use the cyclic-tri-diagonal solver with the appropriate parameters for a closed cubic spline. solveCubicSplineCoefficients :: Fractional a => Bool -> [a] -> [[a]] -solveCubicSplineCoefficients closed xs = +solveCubicSplineCoefficients closed xs = [ [x,d,3*(x1-x)-2*d-d1,2*(x-x1)+d+d1] | (x,x1,d,d1) <- zip4 xs' (tail xs') ds' (tail ds') ] - where + where ds | closed = solveCubicSplineDerivativesClosed xs | otherwise = solveCubicSplineDerivatives xs close as | closed = as ++ [head as] diff --git a/src/Diagrams/Direction.hs b/src/Diagrams/Direction.hs index e05a7a64..87d2ee40 100644 --- a/src/Diagrams/Direction.hs +++ b/src/Diagrams/Direction.hs @@ -1,6 +1,6 @@ -{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} -{-# LANGUAGE TypeFamilies #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.Direction @@ -19,11 +19,11 @@ module Diagrams.Direction , angleBetweenDirs ) where -import Control.Lens (Iso', iso) -import Data.VectorSpace +import Control.Lens (Iso', iso) +import Data.VectorSpace -import Diagrams.Angle -import Diagrams.Core +import Diagrams.Angle +import Diagrams.Core -------------------------------------------------------------------------------- -- Direction diff --git a/src/Diagrams/Parametric.hs b/src/Diagrams/Parametric.hs index 05ae5782..bc65c980 100644 --- a/src/Diagrams/Parametric.hs +++ b/src/Diagrams/Parametric.hs @@ -25,7 +25,7 @@ module Diagrams.Parametric import Diagrams.Core import Data.VectorSpace -import qualified Numeric.Interval.Kaucher as I +import qualified Numeric.Interval.Kaucher as I -- | Codomain of parametric classes. This is usually either @(V p)@, for relative -- vector results, or @(Point (V p))@, for functions with absolute coordinates. diff --git a/src/Diagrams/Parametric/Adjust.hs b/src/Diagrams/Parametric/Adjust.hs index 13b7484e..0ffe163a 100644 --- a/src/Diagrams/Parametric/Adjust.hs +++ b/src/Diagrams/Parametric/Adjust.hs @@ -20,7 +20,8 @@ module Diagrams.Parametric.Adjust ) where -import Control.Lens (makeLensesWith, lensRules, lensField, generateSignatures, (^.), (&), (.~), Lens') +import Control.Lens (Lens', generateSignatures, lensField, lensRules, + makeLensesWith, (&), (.~), (^.)) import Data.Proxy import Data.Default.Class diff --git a/src/Diagrams/Path.hs b/src/Diagrams/Path.hs index fd5a1b57..5a1278b4 100644 --- a/src/Diagrams/Path.hs +++ b/src/Diagrams/Path.hs @@ -71,8 +71,8 @@ import Diagrams.TrailLike import Diagrams.Transform import Control.Arrow ((***)) -import Control.Lens (Rewrapped, Wrapped (..), iso, mapped, op, - over, view, (%~), _Unwrapped', _Wrapped) +import Control.Lens (Rewrapped, Wrapped (..), iso, mapped, op, over, view, (%~), + _Unwrapped', _Wrapped) import Data.AffineSpace import qualified Data.Foldable as F import Data.List (partition) diff --git a/src/Diagrams/Prelude.hs b/src/Diagrams/Prelude.hs index ca39ffb9..77ca8907 100644 --- a/src/Diagrams/Prelude.hs +++ b/src/Diagrams/Prelude.hs @@ -146,17 +146,17 @@ import Diagrams.Query import Diagrams.Segment import Diagrams.Tangent import Diagrams.Trace -import Diagrams.Trail hiding (trailPoints, loopPoints, linePoints) +import Diagrams.Trail hiding (linePoints, loopPoints, trailPoints) import Diagrams.TrailLike import Diagrams.Transform import Diagrams.TwoD import Diagrams.Util import Control.Applicative +import Control.Lens ((%~), (&), (.~)) import Data.Active import Data.AffineSpace import Data.Colour hiding (AffineSpace (..), atop, over) import Data.Colour.Names hiding (tan) import Data.Semigroup import Data.VectorSpace hiding (Sum (..)) -import Control.Lens ((&), (.~), (%~)) diff --git a/src/Diagrams/Prelude/ThreeD.hs b/src/Diagrams/Prelude/ThreeD.hs index 0f1f91d2..c1ba3fc4 100644 --- a/src/Diagrams/Prelude/ThreeD.hs +++ b/src/Diagrams/Prelude/ThreeD.hs @@ -137,18 +137,18 @@ import Diagrams.Points import Diagrams.Query import Diagrams.Segment import Diagrams.Tangent +import Diagrams.ThreeD import Diagrams.Trace import Diagrams.Trail import Diagrams.TrailLike import Diagrams.Transform -import Diagrams.ThreeD import Diagrams.Util import Control.Applicative +import Control.Lens ((%~), (&), (.~)) import Data.Active import Data.AffineSpace import Data.Colour hiding (AffineSpace (..), atop, over) import Data.Colour.Names hiding (tan) import Data.Semigroup import Data.VectorSpace hiding (Sum (..)) -import Control.Lens ((&), (.~), (%~)) diff --git a/src/Diagrams/Segment.hs b/src/Diagrams/Segment.hs index d9284cc8..4bcb156d 100644 --- a/src/Diagrams/Segment.hs +++ b/src/Diagrams/Segment.hs @@ -11,7 +11,6 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} -{-# LANGUAGE ViewPatterns #-} ----------------------------------------------------------------------------- -- | @@ -64,15 +63,15 @@ module Diagrams.Segment ) where -import Control.Lens (makeLenses, Wrapped(..), Rewrapped, iso, op) -import Control.Applicative (liftA2) +import Control.Applicative (liftA2) +import Control.Lens (Rewrapped, Wrapped (..), iso, makeLenses, op) import Data.AffineSpace import Data.FingerTree import Data.Monoid.MList import Data.Semigroup -import Data.VectorSpace hiding (Sum (..)) -import Numeric.Interval.Kaucher (Interval (..)) -import qualified Numeric.Interval.Kaucher as I +import Data.VectorSpace hiding (Sum (..)) +import Numeric.Interval.Kaucher (Interval (..)) +import qualified Numeric.Interval.Kaucher as I import Diagrams.Core import Diagrams.Located diff --git a/src/Diagrams/Solve.hs b/src/Diagrams/Solve.hs index f027548d..9c18a0df 100644 --- a/src/Diagrams/Solve.hs +++ b/src/Diagrams/Solve.hs @@ -21,8 +21,8 @@ import Data.Ord (comparing) import Diagrams.Util (tau) -import Prelude hiding ((^)) -import qualified Prelude as P ((^)) +import Prelude hiding ((^)) +import qualified Prelude as P ((^)) -- | A specialization of (^) to Integer -- c.f. http://comments.gmane.org/gmane.comp.lang.haskell.libraries/21164 @@ -130,7 +130,7 @@ _cubForm_prop a b c d = all (aboutZero' 1e-5 . eval) (cubForm a b c d) -- issue in practice we could, say, use the solutions -- generated here as very good guesses to a numerical -- solver which can give us a more precise answer? - + ------------------------------------------------------------ -- Quartic formula ------------------------------------------------------------ @@ -165,7 +165,7 @@ quartForm' toler c4 c3 c2 c1 c0 -- solve the resolvent cubic - only one solution is needed z:_ = cubForm 1 (-p/2) (-r) (p*r/2 - q^2/8) - + -- solve the two quadratic equations -- y^2 ± v*y-(±u-z) u = z^2 - r diff --git a/src/Diagrams/Tangent.hs b/src/Diagrams/Tangent.hs index 8f69ff70..697a73b3 100644 --- a/src/Diagrams/Tangent.hs +++ b/src/Diagrams/Tangent.hs @@ -1,9 +1,9 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} -{-# LANGUAGE ConstraintKinds #-} ----------------------------------------------------------------------------- -- | @@ -31,8 +31,8 @@ import Diagrams.Core import Diagrams.Located import Diagrams.Parametric import Diagrams.Segment -import Diagrams.TwoD.Vector (perp) import Diagrams.TwoD.Types (R2Ish) +import Diagrams.TwoD.Vector (perp) ------------------------------------------------------------ -- Tangent diff --git a/src/Diagrams/ThreeD.hs b/src/Diagrams/ThreeD.hs index 60292d48..f536c5a2 100644 --- a/src/Diagrams/ThreeD.hs +++ b/src/Diagrams/ThreeD.hs @@ -44,13 +44,13 @@ module Diagrams.ThreeD , module Diagrams.ThreeD.Vector ) where -import Diagrams.ThreeD.Align -import Diagrams.ThreeD.Attributes -import Diagrams.ThreeD.Camera -import Diagrams.ThreeD.Deform -import Diagrams.ThreeD.Light -import Diagrams.ThreeD.Shapes -import Diagrams.ThreeD.Transform -import Diagrams.ThreeD.Types -import Diagrams.ThreeD.Types.Double -import Diagrams.ThreeD.Vector +import Diagrams.ThreeD.Align +import Diagrams.ThreeD.Attributes +import Diagrams.ThreeD.Camera +import Diagrams.ThreeD.Deform +import Diagrams.ThreeD.Light +import Diagrams.ThreeD.Shapes +import Diagrams.ThreeD.Transform +import Diagrams.ThreeD.Types +import Diagrams.ThreeD.Types.Double +import Diagrams.ThreeD.Vector diff --git a/src/Diagrams/ThreeD/Align.hs b/src/Diagrams/ThreeD/Align.hs index 0e9c262c..e4b3f577 100644 --- a/src/Diagrams/ThreeD/Align.hs +++ b/src/Diagrams/ThreeD/Align.hs @@ -1,6 +1,6 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.ThreeD.Align diff --git a/src/Diagrams/ThreeD/Attributes.hs b/src/Diagrams/ThreeD/Attributes.hs index 469c9937..db05639f 100644 --- a/src/Diagrams/ThreeD/Attributes.hs +++ b/src/Diagrams/ThreeD/Attributes.hs @@ -1,8 +1,10 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE ExistentialQuantification #-} +{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts #-} +{-# LANGUAGE TypeFamilies #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.ThreeD.Attributes @@ -26,13 +28,13 @@ module Diagrams.ThreeD.Attributes where -import Control.Lens -import Data.Semigroup -import Data.Typeable +import Control.Lens +import Data.Semigroup +import Data.Typeable -import Data.Colour +import Data.Colour -import Diagrams.Core +import Diagrams.Core -- | @SurfaceColor@ is the inherent pigment of an object, assumed to -- be opaque. @@ -88,7 +90,7 @@ ambient = applyAttr . review _Ambient -- Physically, the intensity and the value of @Diffuse@ must add up to -- less than 1; this is not enforced. data Specular = Specular { _specularIntensity :: Double - , _specularSize :: Double + , _specularSize :: Double } makeLenses ''Specular diff --git a/src/Diagrams/ThreeD/Camera.hs b/src/Diagrams/ThreeD/Camera.hs index 58f54176..ee4b924d 100644 --- a/src/Diagrams/ThreeD/Camera.hs +++ b/src/Diagrams/ThreeD/Camera.hs @@ -1,9 +1,11 @@ -{-# LANGUAGE DeriveDataTypeable, ConstraintKinds, UndecidableInstances #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} ----------------------------------------------------------------------------- -- | @@ -121,7 +123,7 @@ mm50 = PerspectiveLens (40.5 @@ deg) (27 @@ deg) mm50Wide = PerspectiveLens (43.2 @@ deg) (27 @@ deg) -- | mm50Narrow has the same vertical field of view as mm50, but an --- aspect ratio of 4:3, for VGA and similar computer resulotions. +-- aspect ratio of 4:3, for VGA and similar computer resolutions. mm50Narrow = PerspectiveLens (36 @@ deg) (27 @@ deg) camForward :: (R3Ish v, v ~ V l) => Camera l -> Direction v @@ -137,5 +139,5 @@ camRight c = direction right where camLens :: (R3Ish v, v ~ V l) => Camera l -> l camLens = lens -camAspect :: (R3Ish v, v ~ V l) => CameraLens l => Camera l -> Scalar v +camAspect :: (R3Ish v, v ~ V l, CameraLens l) => Camera l -> Scalar v camAspect = aspect . camLens diff --git a/src/Diagrams/ThreeD/Deform.hs b/src/Diagrams/ThreeD/Deform.hs index f684e306..c3ce4ad4 100644 --- a/src/Diagrams/ThreeD/Deform.hs +++ b/src/Diagrams/ThreeD/Deform.hs @@ -1,12 +1,14 @@ -{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE TypeFamilies #-} module Diagrams.ThreeD.Deform where -import Control.Lens +import Control.Lens -import Diagrams.Deform +import Diagrams.Deform -import Diagrams.Coordinates -import Diagrams.ThreeD.Types +import Diagrams.Coordinates +import Diagrams.ThreeD.Types -- | The parallel projection onto the plane x=0 parallelX0 :: (R3Ish v) => Deformation v diff --git a/src/Diagrams/ThreeD/Light.hs b/src/Diagrams/ThreeD/Light.hs index 962e8492..01986ea6 100644 --- a/src/Diagrams/ThreeD/Light.hs +++ b/src/Diagrams/ThreeD/Light.hs @@ -1,8 +1,9 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE ConstraintKinds, UndecidableInstances #-} +{-# LANGUAGE UndecidableInstances #-} ----------------------------------------------------------------------------- -- | diff --git a/src/Diagrams/ThreeD/Shapes.hs b/src/Diagrams/ThreeD/Shapes.hs index 3479cfb5..69e272b7 100644 --- a/src/Diagrams/ThreeD/Shapes.hs +++ b/src/Diagrams/ThreeD/Shapes.hs @@ -1,7 +1,9 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} -{-# LANGUAGE TypeFamilies, ConstraintKinds, UndecidableInstances #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.ThreeD.Shapes diff --git a/src/Diagrams/ThreeD/Transform.hs b/src/Diagrams/ThreeD/Transform.hs index 547e450d..0dfc34b3 100644 --- a/src/Diagrams/ThreeD/Transform.hs +++ b/src/Diagrams/ThreeD/Transform.hs @@ -1,8 +1,10 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE ViewPatterns , ConstraintKinds, ScopedTypeVariables #-} +{-# LANGUAGE ViewPatterns #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.ThreeD.Transform @@ -47,12 +49,12 @@ import Diagrams.Core import qualified Diagrams.Core.Transform as T import Diagrams.Angle +import Diagrams.Coordinates import Diagrams.Direction -import Diagrams.Transform import Diagrams.ThreeD.Types -import Diagrams.Coordinates +import Diagrams.Transform -import Control.Lens (view, (*~), (//~)) +import Control.Lens (view, (*~), (//~)) import Data.Semigroup import Data.AffineSpace diff --git a/src/Diagrams/ThreeD/Types.hs b/src/Diagrams/ThreeD/Types.hs index f232819a..09dab03e 100644 --- a/src/Diagrams/ThreeD/Types.hs +++ b/src/Diagrams/ThreeD/Types.hs @@ -1,12 +1,13 @@ -{-# LANGUAGE FlexibleInstances, FlexibleContexts #-} -{-# LANGUAGE MultiParamTypeClasses #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeOperators #-} -{-# LANGUAGE TypeSynonymInstances #-} -{-# LANGUAGE UndecidableInstances #-} -{-# LANGUAGE ViewPatterns #-} -{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE TypeSynonymInstances #-} +{-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE ViewPatterns #-} ----------------------------------------------------------------------------- -- | @@ -31,16 +32,16 @@ module Diagrams.ThreeD.Types import Control.Lens (Iso', iso) -import Diagrams.Core import Diagrams.Angle import Diagrams.Coordinates +import Diagrams.Core import Diagrams.Points import Data.AffineSpace.Point import Data.Basis import Data.Cross -import Data.VectorSpace import Data.Typeable +import Data.VectorSpace ------------------------------------------------------------ -- 3D Euclidean space diff --git a/src/Diagrams/ThreeD/Types/Double.hs b/src/Diagrams/ThreeD/Types/Double.hs index 8cf6c7b9..6880e95e 100644 --- a/src/Diagrams/ThreeD/Types/Double.hs +++ b/src/Diagrams/ThreeD/Types/Double.hs @@ -1,11 +1,12 @@ -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE MultiParamTypeClasses #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeOperators #-} -{-# LANGUAGE TypeSynonymInstances #-} -{-# LANGUAGE UndecidableInstances #-} -{-# LANGUAGE ViewPatterns, DeriveDataTypeable #-} +{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE TypeSynonymInstances #-} +{-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE ViewPatterns #-} ----------------------------------------------------------------------------- -- | @@ -23,13 +24,13 @@ module Diagrams.ThreeD.Types.Double R3(..), P3, T3 ) where -import Control.Lens (iso, over, _1, _2, _3, (^.)) +import Control.Lens (iso, over, (^.), _1, _2, _3) -import Diagrams.Core import Diagrams.Angle -import Diagrams.TwoD.Types.Double(R2) -import Diagrams.ThreeD.Types import Diagrams.Coordinates +import Diagrams.Core +import Diagrams.ThreeD.Types +import Diagrams.TwoD.Types.Double (R2) import Data.Basis import Data.Cross diff --git a/src/Diagrams/ThreeD/Vector.hs b/src/Diagrams/ThreeD/Vector.hs index 46b8aea3..ca325698 100644 --- a/src/Diagrams/ThreeD/Vector.hs +++ b/src/Diagrams/ThreeD/Vector.hs @@ -1,7 +1,6 @@ -{-# LANGUAGE FlexibleContexts - , TypeFamilies - , ViewPatterns, ConstraintKinds - #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE TypeFamilies #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.ThreeD.Vector @@ -17,8 +16,8 @@ module Diagrams.ThreeD.Vector unitX, unitY, unitZ, unit_X, unit_Y, unit_Z, ) where -import Diagrams.Coordinates -import Diagrams.ThreeD.Types +import Diagrams.Coordinates +import Diagrams.ThreeD.Types -- | The unit vector in the positive X direction. diff --git a/src/Diagrams/Trace.hs b/src/Diagrams/Trace.hs index a1a3a6dd..0f856327 100644 --- a/src/Diagrams/Trace.hs +++ b/src/Diagrams/Trace.hs @@ -27,14 +27,13 @@ module Diagrams.Trace ) where -import Diagrams.Core (HasLinearMap, Point, Subdiagram - , location, origin, setTrace, trace - , OrderedField) +import Diagrams.Core (HasLinearMap, OrderedField, Point, Subdiagram, location, + origin, setTrace, trace) import Diagrams.Core.Trace import Data.Maybe import Data.Semigroup -import Data.VectorSpace (Scalar, negateV, InnerSpace) +import Data.VectorSpace (InnerSpace, Scalar, negateV) import Diagrams.Combinators (withTrace) -- | Compute the furthest point on the boundary of a subdiagram, diff --git a/src/Diagrams/Trail.hs b/src/Diagrams/Trail.hs index f8490bf9..6735a7f2 100644 --- a/src/Diagrams/Trail.hs +++ b/src/Diagrams/Trail.hs @@ -104,20 +104,19 @@ module Diagrams.Trail ) where -import Control.Arrow ((***)) -import Control.Lens (AnIso', iso, view, op, Wrapped(..), Rewrapped - , cloneIso, (^.)) +import Control.Arrow ((***)) +import Control.Lens (AnIso', Rewrapped, Wrapped (..), cloneIso, iso, op, view, + (^.)) import Data.AffineSpace -import Data.FingerTree (FingerTree, ViewL (..), ViewR (..), (<|), - (|>)) -import qualified Data.FingerTree as FT -import qualified Data.Foldable as F +import Data.FingerTree (FingerTree, ViewL (..), ViewR (..), (<|), (|>)) +import qualified Data.FingerTree as FT +import qualified Data.Foldable as F import Data.Monoid.MList import Data.Semigroup -import Data.VectorSpace hiding (Sum (..)) -import qualified Numeric.Interval.Kaucher as I +import Data.VectorSpace hiding (Sum (..)) +import qualified Numeric.Interval.Kaucher as I -import Diagrams.Core hiding ((|>)) +import Diagrams.Core hiding ((|>)) import Diagrams.Located import Diagrams.Parametric import Diagrams.Segment @@ -1057,7 +1056,7 @@ tolerance = 10e-16 -- @trailVertices . (\`at\` origin)@. trailVertices' :: (InnerSpace v, OrderedField (Scalar v)) => Scalar v -> Located (Trail v) -> [Point v] -trailVertices' toler (viewLoc -> (p,t)) +trailVertices' toler (viewLoc -> (p,t)) = withTrail (lineVertices' toler . (`at` p)) (loopVertices' toler . (`at` p)) t -- : Like trailVertices' but the tolerance is set to tolerance @@ -1069,20 +1068,20 @@ trailVertices l = trailVertices' tolerance l -- 'trailVertices' for more information. lineVertices' :: (InnerSpace v, OrderedField (Scalar v)) => Scalar v -> Located (Trail' Line v) -> [Point v] -lineVertices' toler (viewLoc -> (p,t)) +lineVertices' toler (viewLoc -> (p,t)) = segmentVertices' toler p . lineSegments $ t -- | Like lineVertices' with tolerance set to tolerance. lineVertices :: (InnerSpace v, OrderedField (Scalar v)) => Located (Trail' Line v) -> [Point v] -lineVertices l = lineVertices' tolerance l +lineVertices l = lineVertices' tolerance l -- | Extract the vertices of a concretely located loop. Note that the -- initial vertex is not repeated at the end. See 'trailVertices' for -- more information. loopVertices' :: (InnerSpace v, OrderedField (Scalar v)) => Scalar v -> Located (Trail' Loop v) -> [Point v] -loopVertices' toler (viewLoc -> (p,t)) +loopVertices' toler (viewLoc -> (p,t)) | length segs > 1 = if far > toler then init ps else init . (drop 1) $ ps | otherwise = ps where diff --git a/src/Diagrams/TrailLike.hs b/src/Diagrams/TrailLike.hs index 5a6b03b1..e9fa26df 100644 --- a/src/Diagrams/TrailLike.hs +++ b/src/Diagrams/TrailLike.hs @@ -28,9 +28,9 @@ module Diagrams.TrailLike ) where +import Control.Lens (view, _Unwrapped') import Data.AffineSpace ((.-.)) import Data.VectorSpace -import Control.Lens (view, _Unwrapped') import Diagrams.Core import Diagrams.Located diff --git a/src/Diagrams/TwoD.hs b/src/Diagrams/TwoD.hs index 5f81da7b..c4bccede 100644 --- a/src/Diagrams/TwoD.hs +++ b/src/Diagrams/TwoD.hs @@ -239,7 +239,7 @@ module Diagrams.TwoD , sized, sizedAs -- * Textures - , Texture(..), solid + , Texture(..), solid , SpreadMethod(..), GradientStop(..), mkStops, getFillTexture , fillTexture, getLineTexture, lineTexture, lineTextureA , stopFraction, stopColor @@ -293,4 +293,4 @@ import Diagrams.TwoD.Types import Diagrams.TwoD.Types.Double import Diagrams.TwoD.Vector -import Diagrams.Util (tau) +import Diagrams.Util (tau) diff --git a/src/Diagrams/TwoD/Adjust.hs b/src/Diagrams/TwoD/Adjust.hs index 808e46c9..d41afaeb 100644 --- a/src/Diagrams/TwoD/Adjust.hs +++ b/src/Diagrams/TwoD/Adjust.hs @@ -1,5 +1,7 @@ -{-# LANGUAGE Rank2Types #-} -{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE Rank2Types #-} +{-# LANGUAGE TypeFamilies #-} ----------------------------------------------------------------------------- -- | @@ -20,12 +22,10 @@ module Diagrams.TwoD.Adjust , adjustDia2D ) where -import Diagrams.Attributes (lineCap, lineJoin, - lineMiterLimitA) +import Diagrams.Attributes (lineCap, lineJoin, lineMiterLimitA) import Diagrams.Core -import Diagrams.TwoD.Attributes (lineWidthA, lineTextureA) -import Diagrams.TwoD.Size (SizeSpec2D (..), center2D, - requiredScale, size2D) +import Diagrams.TwoD.Attributes (lineTextureA, lineWidthA) +import Diagrams.TwoD.Size (SizeSpec2D (..), center2D, requiredScale, size2D) import Diagrams.TwoD.Text (fontSizeA) import Diagrams.TwoD.Types (R2Ish, p2) import Diagrams.Util (( # )) diff --git a/src/Diagrams/TwoD/Align.hs b/src/Diagrams/TwoD/Align.hs index 6f08b2b7..dbbf4d75 100644 --- a/src/Diagrams/TwoD/Align.hs +++ b/src/Diagrams/TwoD/Align.hs @@ -1,6 +1,6 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts #-} ----------------------------------------------------------------------------- -- | diff --git a/src/Diagrams/TwoD/Arc.hs b/src/Diagrams/TwoD/Arc.hs index 78d92daf..b015974e 100644 --- a/src/Diagrams/TwoD/Arc.hs +++ b/src/Diagrams/TwoD/Arc.hs @@ -1,5 +1,7 @@ -{-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE ViewPatterns, ConstraintKinds, FlexibleContexts #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE ViewPatterns #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.TwoD.Arc @@ -23,8 +25,8 @@ module Diagrams.TwoD.Arc ) where import Diagrams.Angle -import Diagrams.Direction import Diagrams.Core +import Diagrams.Direction import Diagrams.Located (at) import Diagrams.Segment import Diagrams.Trail @@ -34,7 +36,7 @@ import Diagrams.TwoD.Types import Diagrams.TwoD.Vector (unitX, unitY, unit_Y) import Diagrams.Util (( # )) -import Control.Lens ((^.), (&), (<>~)) +import Control.Lens ((&), (<>~), (^.)) import Data.AffineSpace import Data.Semigroup ((<>)) import Data.VectorSpace diff --git a/src/Diagrams/TwoD/Arrow.hs b/src/Diagrams/TwoD/Arrow.hs index afbb620e..61c5b216 100644 --- a/src/Diagrams/TwoD/Arrow.hs +++ b/src/Diagrams/TwoD/Arrow.hs @@ -1,11 +1,13 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts, UndecidableInstances, ScopedTypeVariables #-} +{-# LANGUAGE UndecidableInstances #-} ----------------------------------------------------------------------------- -- | @@ -100,10 +102,8 @@ module Diagrams.TwoD.Arrow ) where import Control.Applicative ((<*>)) -import Control.Lens (Lens', Setter', Traversal', - generateSignatures, lensRules, - makeLensesWith, view, (%~), (&), - (.~), (^.)) +import Control.Lens (Lens', Setter', Traversal', generateSignatures, + lensRules, makeLensesWith, view, (%~), (&), (.~), (^.)) import Data.AffineSpace import Data.Default.Class import Data.Functor ((<$>)) @@ -184,7 +184,7 @@ headGap :: Lens' (ArrowOpts v) (Measure v) tailGap :: Lens' (ArrowOpts v) (Measure v) -- | Set both the @headGap@ and @tailGap@ simultaneously. -gaps :: Traversal' (ArrowOpts v) (Measure v) +gaps :: Traversal' (ArrowOpts v) (Measure v) gaps f opts = (\h t -> opts & headGap .~ h & tailGap .~ t) <$> f (opts ^. headGap) <*> f (opts ^. tailGap) @@ -208,7 +208,7 @@ shaftStyle :: Lens' (ArrowOpts v) (Style v) -- | The length from the start of the joint to the tip of the head. headLength :: Lens' (ArrowOpts v) (Measure v) --- | The length of the tail plus its joint. +-- | The length of the tail plus its joint. tailLength :: Lens' (ArrowOpts v) (Measure v) -- | Set both the @headLength@ and @tailLength@ simultaneously. diff --git a/src/Diagrams/TwoD/Arrowheads.hs b/src/Diagrams/TwoD/Arrowheads.hs index 2dbe40f6..73eabc11 100644 --- a/src/Diagrams/TwoD/Arrowheads.hs +++ b/src/Diagrams/TwoD/Arrowheads.hs @@ -1,7 +1,8 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE NoMonomorphismRestriction #-} +{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts, ScopedTypeVariables #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.TwoD.Arrowheads @@ -55,7 +56,7 @@ module Diagrams.TwoD.Arrowheads , ArrowHT ) where -import Control.Lens ((&), (.~), (^.), (<>~)) +import Control.Lens ((&), (.~), (<>~), (^.)) import Data.AffineSpace import Data.Default.Class import Data.Monoid (mempty, (<>)) @@ -204,7 +205,7 @@ spike = arrowheadSpike (3/8 @@ turn) -- > thornEx = drawHead thorn thorn :: (R2Ish v) => ArrowHT v -thorn = arrowheadThorn (3/8 @@ turn) +thorn = arrowheadThorn (3/8 @@ turn) -- | <> diff --git a/src/Diagrams/TwoD/Attributes.hs b/src/Diagrams/TwoD/Attributes.hs index b9858083..a0a0c067 100644 --- a/src/Diagrams/TwoD/Attributes.hs +++ b/src/Diagrams/TwoD/Attributes.hs @@ -1,11 +1,14 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE ExistentialQuantification #-} +{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts, StandaloneDeriving, UndecidableInstances #-} +{-# LANGUAGE UndecidableInstances #-} ----------------------------------------------------------------------------- -- | @@ -68,10 +71,10 @@ module Diagrams.TwoD.Attributes ( ) where -import Diagrams.Core -import Diagrams.Core.Style (setAttr) import Diagrams.Attributes import Diagrams.Attributes.Compile +import Diagrams.Core +import Diagrams.Core.Style (setAttr) import Diagrams.TwoD.Types import Diagrams.Core.Types (RTree) @@ -79,10 +82,10 @@ import Diagrams.Located (unLoc) import Diagrams.Path (Path, pathTrails) import Diagrams.Trail (isLoop) -import Control.Lens ( makeLensesWith, generateSignatures, lensRules - , makePrisms, Lens', (&), (%~), (.~), Setter', sets) +import Control.Lens (Lens', Setter', generateSignatures, lensRules, + makeLensesWith, makePrisms, sets, (%~), (&), (.~)) -import Data.Colour hiding (AffineSpace) +import Data.Colour hiding (AffineSpace) import Data.Data import Data.Default.Class import Data.Maybe (fromMaybe) diff --git a/src/Diagrams/TwoD/Combinators.hs b/src/Diagrams/TwoD/Combinators.hs index eeaf6b8e..4a41e220 100644 --- a/src/Diagrams/TwoD/Combinators.hs +++ b/src/Diagrams/TwoD/Combinators.hs @@ -1,8 +1,9 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ViewPatterns #-} -{-# LANGUAGE ConstraintKinds, ScopedTypeVariables #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.TwoD.Combinators @@ -38,7 +39,7 @@ module Diagrams.TwoD.Combinators ) where -import Control.Lens ((&), (.~)) +import Control.Lens ((&), (.~)) import Data.AffineSpace import Data.Colour import Data.Default.Class @@ -54,7 +55,7 @@ import Diagrams.Path import Diagrams.Segment import Diagrams.TrailLike import Diagrams.TwoD.Align -import Diagrams.TwoD.Attributes (lineWidth, fc) +import Diagrams.TwoD.Attributes (fc, lineWidth) import Diagrams.TwoD.Path () import Diagrams.TwoD.Shapes import Diagrams.TwoD.Transform (scaleX, scaleY) @@ -260,6 +261,6 @@ bg c d = d <> boundingRect d # lineWidth (Output 0) # fc c -- | Similar to 'bg' but makes the colored background rectangle larger than -- the diagram. The first parameter is used to set how far the background -- extends beyond the diagram. -bgFrame :: (R2Ish v, Renderable (Path v) b, Backend b v) +bgFrame :: (R2Ish v, Renderable (Path v) b, Backend b v) => Scalar v -> Colour Double -> Diagram b v -> Diagram b v bgFrame f c d = d <> boundingRect (frame f d) # lineWidth (Output 0) # fc c diff --git a/src/Diagrams/TwoD/Curvature.hs b/src/Diagrams/TwoD/Curvature.hs index d1b50711..7d7e95bf 100644 --- a/src/Diagrams/TwoD/Curvature.hs +++ b/src/Diagrams/TwoD/Curvature.hs @@ -1,5 +1,6 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GADTs, ConstraintKinds #-} +{-# LANGUAGE GADTs #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.TwoD.Curvature @@ -22,8 +23,8 @@ module Diagrams.TwoD.Curvature import Data.Monoid.Inf import Data.VectorSpace -import Control.Arrow (first, second) -import Control.Monad (join) +import Control.Arrow (first, second) +import Control.Monad (join) import Diagrams.Segment import Diagrams.Tangent diff --git a/src/Diagrams/TwoD/Deform.hs b/src/Diagrams/TwoD/Deform.hs index 5718ec6e..95a9be68 100644 --- a/src/Diagrams/TwoD/Deform.hs +++ b/src/Diagrams/TwoD/Deform.hs @@ -1,12 +1,14 @@ -{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE TypeFamilies #-} module Diagrams.TwoD.Deform where -import Control.Lens +import Control.Lens -import Diagrams.Deform +import Diagrams.Deform -import Diagrams.Coordinates -import Diagrams.TwoD.Types +import Diagrams.Coordinates +import Diagrams.TwoD.Types -- | The parallel projection onto the line x=0 parallelX0 :: (R2Ish v) => Deformation v diff --git a/src/Diagrams/TwoD/Ellipse.hs b/src/Diagrams/TwoD/Ellipse.hs index d29ad9d2..8c3c5378 100644 --- a/src/Diagrams/TwoD/Ellipse.hs +++ b/src/Diagrams/TwoD/Ellipse.hs @@ -1,7 +1,8 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeSynonymInstances, ConstraintKinds #-} +{-# LANGUAGE TypeSynonymInstances #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.TwoD.Ellipse @@ -24,16 +25,16 @@ module Diagrams.TwoD.Ellipse import Diagrams.Core +import Data.VectorSpace import Diagrams.Angle import Diagrams.Located (at) +import Diagrams.Trail (glueTrail) import Diagrams.TrailLike -import Diagrams.Trail (glueTrail) import Diagrams.TwoD.Arc import Diagrams.TwoD.Transform import Diagrams.TwoD.Types import Diagrams.TwoD.Vector (xDir) import Diagrams.Util -import Data.VectorSpace -- | A circle of radius 1, with center at the origin. unitCircle :: (TrailLike t, R2Ish (V t)) => t diff --git a/src/Diagrams/TwoD/Image.hs b/src/Diagrams/TwoD/Image.hs index 49584aa5..1134d7da 100644 --- a/src/Diagrams/TwoD/Image.hs +++ b/src/Diagrams/TwoD/Image.hs @@ -1,10 +1,10 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts #-} ----------------------------------------------------------------------------- -- | @@ -35,8 +35,8 @@ module Diagrams.TwoD.Image import Codec.Picture import Codec.Picture.Types (dynamicMap) -import Data.Typeable (Typeable) import Data.Colour (AlphaColour) +import Data.Typeable (Typeable) import Diagrams.Core diff --git a/src/Diagrams/TwoD/Model.hs b/src/Diagrams/TwoD/Model.hs index 37b23dda..5f1d8a5a 100644 --- a/src/Diagrams/TwoD/Model.hs +++ b/src/Diagrams/TwoD/Model.hs @@ -1,6 +1,8 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} -{-# LANGUAGE TemplateHaskell, ConstraintKinds, TypeFamilies #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeFamilies #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.TwoD.Model @@ -20,34 +22,34 @@ module Diagrams.TwoD.Model , showLabels ) where -import Control.Lens (makeLenses, (^.)) +import Control.Lens (makeLenses, (^.)) import Diagrams.Core -import Diagrams.TwoD.Attributes import Diagrams.Path +import Diagrams.TwoD.Attributes import Diagrams.TwoD.Ellipse import Diagrams.TwoD.Path -import Diagrams.TwoD.Size (size2D) +import Diagrams.TwoD.Size (size2D) import Diagrams.TwoD.Text import Diagrams.TwoD.Types import Diagrams.Util -import Control.Arrow (second) -import Data.AffineSpace ((.-.)) +import Control.Arrow (second) +import Data.AffineSpace ((.-.)) import Data.Default.Class import Data.Semigroup -import Data.VectorSpace ((^*),Scalar) +import Data.VectorSpace (Scalar, (^*)) -import qualified Data.Map as M +import qualified Data.Map as M -import Data.Colour (Colour) +import Data.Colour (Colour) import Data.Colour.Names ------------------------------------------------------------ -- Marking the origin ------------------------------------------------------------ -data OriginOpts d = OriginOpts { _oColor :: Colour Double +data OriginOpts d = OriginOpts { _oColor :: Colour Double , _oScale :: d , _oMinSize :: d } diff --git a/src/Diagrams/TwoD/Offset.hs b/src/Diagrams/TwoD/Offset.hs index 95be95b6..30597a99 100644 --- a/src/Diagrams/TwoD/Offset.hs +++ b/src/Diagrams/TwoD/Offset.hs @@ -1,9 +1,11 @@ -{-# LANGUAGE GADTs #-} -{-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE ViewPatterns #-} -{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts, StandaloneDeriving, UndecidableInstances #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE ViewPatterns #-} ----------------------------------------------------------------------------- -- | @@ -12,15 +14,15 @@ -- License : BSD-style (see LICENSE) -- Maintainer : diagrams-discuss@googlegroups.com -- --- Compute offsets to segments in two dimensions. More details can be --- found in the manual at +-- Compute offsets to segments in two dimensions. More details can be +-- found in the manual at -- . -- ----------------------------------------------------------------------------- module Diagrams.TwoD.Offset - ( + ( -- * Offsets - + offsetSegment , OffsetOpts(..), offsetJoin, offsetMiterLimit, offsetEpsilon @@ -39,33 +41,33 @@ module Diagrams.TwoD.Offset ) where -import Control.Applicative -import Control.Lens hiding (at) - -import Data.AffineSpace -import Data.Maybe (catMaybes) -import Data.Monoid -import Data.Monoid.Inf -import Data.VectorSpace - -import Data.Default.Class - -import Diagrams.Core - -import Diagrams.Angle -import Diagrams.Attributes -import Diagrams.Direction (direction) -import Diagrams.Located -import Diagrams.Parametric -import Diagrams.Path -import Diagrams.Segment -import Diagrams.Trail hiding (offset, isLoop) -import Diagrams.TrailLike -import Diagrams.TwoD.Arc -import Diagrams.TwoD.Curvature -import Diagrams.TwoD.Path () -import Diagrams.TwoD.Types -import Diagrams.TwoD.Vector (perp) +import Control.Applicative +import Control.Lens hiding (at) + +import Data.AffineSpace +import Data.Maybe (catMaybes) +import Data.Monoid +import Data.Monoid.Inf +import Data.VectorSpace + +import Data.Default.Class + +import Diagrams.Core + +import Diagrams.Angle +import Diagrams.Attributes +import Diagrams.Direction (direction) +import Diagrams.Located +import Diagrams.Parametric +import Diagrams.Path +import Diagrams.Segment +import Diagrams.Trail hiding (isLoop, offset) +import Diagrams.TrailLike +import Diagrams.TwoD.Arc +import Diagrams.TwoD.Curvature +import Diagrams.TwoD.Path () +import Diagrams.TwoD.Types +import Diagrams.TwoD.Vector (perp) unitPerp :: (R2Ish v) => v -> v unitPerp = normalized . perp @@ -106,11 +108,11 @@ perpAtParam s@(Cubic _ _ _) t = negateV $ unitPerp a -- | Options for specifying line join and segment epsilon for an offset -- involving multiple segments. data OffsetOpts d = OffsetOpts - { _offsetJoin :: LineJoin + { _offsetJoin :: LineJoin , _offsetMiterLimit :: d - , _offsetEpsilon :: d + , _offsetEpsilon :: d } - + deriving instance Eq d => Eq (OffsetOpts d) deriving instance Show d => Show (OffsetOpts d) @@ -132,10 +134,10 @@ instance (Fractional d) => Default (OffsetOpts d) where -- | Options for specifying how a 'Trail' should be expanded. data ExpandOpts d = ExpandOpts - { _expandJoin :: LineJoin + { _expandJoin :: LineJoin , _expandMiterLimit :: d - , _expandCap :: LineCap - , _expandEpsilon :: d + , _expandCap :: LineCap + , _expandEpsilon :: d } deriving (Eq, Show) makeLensesWith (lensRules & generateSignatures .~ False) ''ExpandOpts @@ -370,7 +372,7 @@ expandLine opts r (mapLoc wrapLine -> t) = caps cap r s e (f r) (f $ -r) where eps = opts^.expandEpsilon offset r' = map (bindLoc (offsetSegment eps r')) . locatedTrailSegments - f r' = joinSegments eps (fromLineJoin (opts^.expandJoin)) False (opts^.expandMiterLimit) r' ends + f r' = joinSegments eps (fromLineJoin (opts^.expandJoin)) False (opts^.expandMiterLimit) r' ends . offset r' $ t ends = tail . trailVertices $ t s = atStart t @@ -382,7 +384,7 @@ expandLoop opts r (mapLoc wrapLoop -> t) = (trailLike $ f r) <> (trailLike . rev where eps = opts^.expandEpsilon offset r' = map (bindLoc (offsetSegment eps r')) . locatedTrailSegments - f r' = joinSegments eps (fromLineJoin (opts^.expandJoin)) True (opts^.expandMiterLimit) r' ends + f r' = joinSegments eps (fromLineJoin (opts^.expandJoin)) True (opts^.expandMiterLimit) r' ends . offset r' $ t ends = (\(a:as) -> as ++ [a]) . trailVertices $ t @@ -472,10 +474,10 @@ capArc r c a b = trailLike . moveTo c $ fs -- Arc helpers -- always picks the shorter arc (< τ/2) -arcV :: (R2Ish v) => (TrailLike t, V t ~ v) => v -> v -> t +arcV :: (R2Ish v, TrailLike t, V t ~ v) => v -> v -> t arcV u v = arc (direction u) (angleBetween v u) -arcVCW :: (R2Ish v) => (TrailLike t, V t ~ v) => v -> v -> t +arcVCW :: (R2Ish v, TrailLike t, V t ~ v) => v -> v -> t arcVCW u v = arc (direction u) (negateV $ angleBetween v u) -- | Join together a list of located trails with the given join style. The @@ -541,7 +543,7 @@ joinSegmentArc _ r e a b = capArc r e (atEnd a) (atStart b) -- If the intersection is beyond the miter limit times the radius, stop at the limit. joinSegmentIntersect :: (R2Ish v) => Scalar v -> Scalar v -> Point v -> Located (Trail v) -> Located (Trail v) -> Trail v -joinSegmentIntersect miterLimit r e a b = +joinSegmentIntersect miterLimit r e a b = if cross < 0.000001 then clip else case traceP pa va t of diff --git a/src/Diagrams/TwoD/Path.hs b/src/Diagrams/TwoD/Path.hs index 9d1973a9..5f012920 100644 --- a/src/Diagrams/TwoD/Path.hs +++ b/src/Diagrams/TwoD/Path.hs @@ -1,13 +1,15 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE Rank2Types #-} +{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE ViewPatterns #-} -{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts, StandaloneDeriving, UndecidableInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} ----------------------------------------------------------------------------- -- | @@ -46,9 +48,8 @@ module Diagrams.TwoD.Path ) where import Control.Applicative (liftA2) -import Control.Lens (Lens, Lens', generateSignatures, - lensRules, makeLensesWith, makeWrapped, - op, (.~), (^.), _Wrapped') +import Control.Lens (Lens, Lens', generateSignatures, lensRules, makeLensesWith, + makeWrapped, op, (.~), (^.), _Wrapped') import qualified Data.Foldable as F import Data.Semigroup import Data.Typeable diff --git a/src/Diagrams/TwoD/Polygons.hs b/src/Diagrams/TwoD/Polygons.hs index 31b7c22d..2657ca2e 100644 --- a/src/Diagrams/TwoD/Polygons.hs +++ b/src/Diagrams/TwoD/Polygons.hs @@ -1,10 +1,13 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE ExistentialQuantification #-} +{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE ViewPatterns #-} -{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts, StandaloneDeriving, UndecidableInstances #-} ----------------------------------------------------------------------------- -- | @@ -46,12 +49,11 @@ module Diagrams.TwoD.Polygons( ) where -import Control.Lens (Lens', generateSignatures, lensRules, - makeLensesWith, (.~), (^.), view) +import Control.Lens (Lens', generateSignatures, lensRules, makeLensesWith, + view, (.~), (^.)) import Control.Monad (forM, liftM) import Control.Monad.ST (ST, runST) -import Data.Array.ST (STUArray, newArray, readArray, - writeArray) +import Data.Array.ST (STUArray, newArray, readArray, writeArray) import Data.List (maximumBy, minimumBy) import Data.Maybe (catMaybes) import Data.Monoid (mconcat, mempty) diff --git a/src/Diagrams/TwoD/Segment.hs b/src/Diagrams/TwoD/Segment.hs index 7689d18b..a510ba00 100644 --- a/src/Diagrams/TwoD/Segment.hs +++ b/src/Diagrams/TwoD/Segment.hs @@ -1,8 +1,8 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} -{-# LANGUAGE ConstraintKinds #-} -{-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-orphans #-} -- Orphan Traced instances for Segment Closed R2 and FixedSegment R2. @@ -24,7 +24,7 @@ module Diagrams.TwoD.Segment where import Control.Applicative (liftA2) -import Control.Lens ((^.)) +import Control.Lens ((^.)) import Data.AffineSpace import Data.VectorSpace diff --git a/src/Diagrams/TwoD/Shapes.hs b/src/Diagrams/TwoD/Shapes.hs index f1c1df7d..7a0dada0 100644 --- a/src/Diagrams/TwoD/Shapes.hs +++ b/src/Diagrams/TwoD/Shapes.hs @@ -1,7 +1,7 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts #-} ----------------------------------------------------------------------------- -- | @@ -62,7 +62,7 @@ import Diagrams.TwoD.Vector import Diagrams.Util -import Control.Lens (makeLenses, op, (&), (.~), (^.), (<>~)) +import Control.Lens (makeLenses, op, (&), (.~), (<>~), (^.)) import Data.Default.Class import Data.Semigroup import Data.VectorSpace @@ -237,9 +237,9 @@ dodecagon = regPoly 12 -- Other shapes ------------------------------------------ ------------------------------------------------------------ data RoundedRectOpts d = RoundedRectOpts { _radiusTL :: d - , _radiusTR :: d - , _radiusBL :: d - , _radiusBR :: d + , _radiusTR :: d + , _radiusBL :: d + , _radiusBR :: d } makeLenses ''RoundedRectOpts diff --git a/src/Diagrams/TwoD/Size.hs b/src/Diagrams/TwoD/Size.hs index 109e5389..ce5cc5c4 100644 --- a/src/Diagrams/TwoD/Size.hs +++ b/src/Diagrams/TwoD/Size.hs @@ -1,6 +1,7 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE TypeFamilies, ConstraintKinds #-} +{-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -funbox-strict-fields #-} ----------------------------------------------------------------------------- diff --git a/src/Diagrams/TwoD/Text.hs b/src/Diagrams/TwoD/Text.hs index 6f4860e9..372cfe39 100644 --- a/src/Diagrams/TwoD/Text.hs +++ b/src/Diagrams/TwoD/Text.hs @@ -1,9 +1,11 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts, StandaloneDeriving, UndecidableInstances #-} +{-# LANGUAGE UndecidableInstances #-} ----------------------------------------------------------------------------- -- | diff --git a/src/Diagrams/TwoD/Transform.hs b/src/Diagrams/TwoD/Transform.hs index 3e16e57b..8a957429 100644 --- a/src/Diagrams/TwoD/Transform.hs +++ b/src/Diagrams/TwoD/Transform.hs @@ -1,8 +1,10 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE ViewPatterns, ConstraintKinds, TypeOperators #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE ViewPatterns #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.TwoD.Transform @@ -57,11 +59,11 @@ import Diagrams.Transform import Diagrams.TwoD.Size (height, width) import Diagrams.TwoD.Types +import Control.Lens (review, (^.)) import Data.AdditiveGroup import Data.AffineSpace import Data.Semigroup import Data.VectorSpace -import Control.Lens (review, (^.)) type T = Transformation type P = Point diff --git a/src/Diagrams/TwoD/Transform/ScaleInv.hs b/src/Diagrams/TwoD/Transform/ScaleInv.hs index 56f5741e..cba9fcc4 100644 --- a/src/Diagrams/TwoD/Transform/ScaleInv.hs +++ b/src/Diagrams/TwoD/Transform/ScaleInv.hs @@ -1,8 +1,14 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE FlexibleInstances, FlexibleContexts, UndecidableInstances #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE InstanceSigs #-} {-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE TypeFamilies ,StandaloneDeriving , ConstraintKinds , AllowAmbiguousTypes, ScopedTypeVariables, InstanceSigs #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.TwoD.Transform.ScaleInv @@ -20,12 +26,12 @@ module Diagrams.TwoD.Transform.ScaleInv , scaleInv, scaleInvPrim) where -import Control.Lens (makeLenses, view,(^.)) +import Control.Lens (makeLenses, view, (^.)) import Data.AdditiveGroup import Data.AffineSpace ((.-.)) -import Data.VectorSpace import Data.Semigroup import Data.Typeable +import Data.VectorSpace import Diagrams.Angle import Diagrams.Core @@ -86,7 +92,6 @@ instance (HasOrigin t) => HasOrigin (ScaleInv t) where moveOriginTo p (ScaleInv t v l) = ScaleInv (moveOriginTo p t) v (moveOriginTo p l) instance (R2Ish (V t), Transformable t) => Transformable (ScaleInv t) where - transform :: Transformation (V (ScaleInv t)) -> ScaleInv t -> ScaleInv t transform tr (ScaleInv t v l) = ScaleInv (trans . rot $ t) (rot v) l' where angle :: Angle (Scalar (V (ScaleInv t))) diff --git a/src/Diagrams/TwoD/Types.hs b/src/Diagrams/TwoD/Types.hs index 539048f7..0bd8e73f 100644 --- a/src/Diagrams/TwoD/Types.hs +++ b/src/Diagrams/TwoD/Types.hs @@ -1,12 +1,13 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE FlexibleInstances, FlexibleContexts #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeSynonymInstances #-} -{-# LANGUAGE ConstraintKinds #-} {-# OPTIONS_GHC -fno-warn-orphans #-} ----------------------------------------------------------------------------- diff --git a/src/Diagrams/TwoD/Types/Double.hs b/src/Diagrams/TwoD/Types/Double.hs index 427d2724..4a653975 100644 --- a/src/Diagrams/TwoD/Types/Double.hs +++ b/src/Diagrams/TwoD/Types/Double.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} @@ -6,7 +7,6 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeSynonymInstances #-} -{-# LANGUAGE ConstraintKinds #-} {-# OPTIONS_GHC -fno-warn-orphans #-} ----------------------------------------------------------------------------- @@ -25,7 +25,7 @@ module Diagrams.TwoD.Types.Double R2(..), P2, T2 ) where -import Control.Lens (Rewrapped, Wrapped (..), iso, (^.), _1, _2) +import Control.Lens (Rewrapped, Wrapped (..), iso, (^.), _1, _2) import Diagrams.Angle diff --git a/src/Diagrams/TwoD/Vector.hs b/src/Diagrams/TwoD/Vector.hs index 32c94764..a45330ee 100644 --- a/src/Diagrams/TwoD/Vector.hs +++ b/src/Diagrams/TwoD/Vector.hs @@ -1,7 +1,7 @@ -{-# LANGUAGE ConstraintKinds #-} -{-# LANGUAGE ViewPatterns #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE ViewPatterns #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.TwoD.Vector @@ -24,14 +24,14 @@ module Diagrams.TwoD.Vector -- * Synonym for R2 things ) where -import Control.Lens ((&), (.~)) +import Control.Lens ((&), (.~)) -import Data.VectorSpace +import Data.VectorSpace -import Diagrams.Core.V -import Diagrams.Angle -import Diagrams.Direction -import Diagrams.TwoD.Types +import Diagrams.Angle +import Diagrams.Core.V +import Diagrams.Direction +import Diagrams.TwoD.Types -- | The unit vector in the positive X direction. unitX :: (R2Ish v) => v diff --git a/test/Arcs.hs b/test/Arcs.hs index 24c5c068..7a867585 100644 --- a/test/Arcs.hs +++ b/test/Arcs.hs @@ -1,30 +1,30 @@ -import Diagrams.Prelude -import Diagrams.Backend.Postscript -import Diagrams.Backend.Postscript.CmdLine +import Diagrams.Backend.Postscript +import Diagrams.Backend.Postscript.CmdLine +import Diagrams.Prelude -import Diagrams.TwoD.Arc +import Diagrams.TwoD.Arc -exampleArc f r = (vertLabel |||) . centerXY . (horzLabel ===) . centerXY $ hcat - [ vcat - [ phantom (circle (1.05 * abs r) :: D R2) +exampleArc f r = (vertLabel |||) . centerXY . (horzLabel ===) . centerXY $ hcat + [ vcat + [ phantom (circle (1.05 * abs r) :: D R2) <> s # lc green # lw 0.01 <> e # lc red # lw 0.01 <> (lw 0.01 . stroke $ f r (n/8) (m/8)) | n <- rs , let s = rotateBy (n/8) (origin ~~ (3 & 0)) , let e = rotateBy (m/8) (origin ~~ (3 & 0)) - ] + ] | m <- rs ] where rs = [0..7 :: CircleFrac] horzLabel = centerX $ rect 5 10 # lw 0 <> (text "start angle" # scale 0.4) vertLabel = centerY . rotateBy (1/4) $ rect 5 10 # lw 0 <> (text "end angle" # scale 0.4) - + exampleRR :: Diagram Postscript R2 -exampleRR = (vertLabel |||) . centerXY . (horzLabel ===) . centerXY $ hcat - [ vcat - [ phantom (pad 1.1 $ rect 10 15 :: D R2) +exampleRR = (vertLabel |||) . centerXY . (horzLabel ===) . centerXY $ hcat + [ vcat + [ phantom (pad 1.1 $ rect 10 15 :: D R2) <> (origin ~~ (0 & r)) # lc red # lw 0.01 <> (fc lightblue . lw 0.01 . stroke $ roundedRect' 10 15 o) | o <- [ RoundedRectOpts 0 r 0 0 @@ -32,7 +32,7 @@ exampleRR = (vertLabel |||) . centerXY . (horzLabel ===) . centerXY $ hcat , RoundedRectOpts 0 0 r 0 , RoundedRectOpts 0 0 0 r ] - ] + ] | r <- [-4..4] ] where @@ -45,4 +45,4 @@ arcs = [ ("arc' CCW", exampleArc arc' 3) , ("arcCW CCW", exampleArc (\r s e -> arcCW s e # scale (abs r)) (-3)) ] :: [(String, Diagram Postscript R2)] -main = defaultMain (vcat (map snd arcs) === exampleRR) \ No newline at end of file +main = defaultMain (vcat (map snd arcs) === exampleRR) diff --git a/test/Arrowtest.hs b/test/Arrowtest.hs index e04d00f1..f4653b92 100644 --- a/test/Arrowtest.hs +++ b/test/Arrowtest.hs @@ -1,8 +1,8 @@ {-# LANGUAGE NoMonomorphismRestriction #-} -import Diagrams.Prelude -import Diagrams.Backend.SVG.CmdLine -import Data.List.Split (chunksOf) +import Data.List.Split (chunksOf) +import Diagrams.Backend.SVG.CmdLine +import Diagrams.Prelude -- Create a 3 x 3 grid of circles named "1" to "9" c = circle 1.5 # fc lightgray # lw none # showOrigin diff --git a/test/BBTest.hs b/test/BBTest.hs index 26b02807..7660affc 100644 --- a/test/BBTest.hs +++ b/test/BBTest.hs @@ -1,9 +1,9 @@ -import Test.QuickCheck +import Test.QuickCheck -import Diagrams.BoundingBox +import Diagrams.BoundingBox instance Arbitrary (NonEmptyBoundingBox Q2) where arbitrary = do p <- arbitrary PosVec v <- arbitrary - return $ NonEmptyBoundingBox p (p .+^ v) \ No newline at end of file + return $ NonEmptyBoundingBox p (p .+^ v) diff --git a/test/Gradient/Ball.hs b/test/Gradient/Ball.hs index a95ec578..d43ce901 100644 --- a/test/Gradient/Ball.hs +++ b/test/Gradient/Ball.hs @@ -2,12 +2,12 @@ module Main where -import Diagrams.Prelude import Diagrams.Backend.Rasterific.CmdLine +import Diagrams.Prelude radial = mkRadialGradient (mkStops [(white,0,1), (black,1,1)]) ((-0.1) ^& (0.1)) 0.06 (0 ^& 0) 0.35 GradPad linear = mkLinearGradient (mkStops [(black,0,1), (white,1,1)]) (0 ^& (-0.5)) (0 ^& 0.5) GradPad example = circle 0.25 # fillTexture radial # lw none <> square 1 # fillTexture linear # lw none -main = defaultMain $ example # scaleX 1 # pad 1.1 \ No newline at end of file +main = defaultMain $ example # scaleX 1 # pad 1.1 diff --git a/test/Gradient/rectGrad.hs b/test/Gradient/rectGrad.hs index decf49f1..6f038b69 100644 --- a/test/Gradient/rectGrad.hs +++ b/test/Gradient/rectGrad.hs @@ -2,8 +2,8 @@ module Main where -import Diagrams.Prelude import Diagrams.Backend.SVG.CmdLine +import Diagrams.Prelude -- Red to White to Blue linear gradient wtih direction vector (1,0). --g = LGradient [(SomeColor red, 0, 1), (SomeColor black, 0.5, 0) @@ -32,4 +32,4 @@ e2 = vcat' (with & sep .~ 35) [s # rotateBy (3/16), s' # rotateBy (1/4), s # rot e3 = vcat' (with & sep .~ 35) [s # rotateBy (3/8), s # rotateBy (7/16), s' # rotateBy (1/2)] example = hcat' (with & sep .~ 25) [e1, e2, e3] -main = defaultMain $ (example # centerXY # pad 1.1) <> (square 600 # fillTexture linear) \ No newline at end of file +main = defaultMain $ (example # centerXY # pad 1.1) <> (square 600 # fillTexture linear) diff --git a/test/Issue57.hs b/test/Issue57.hs index f16bf7f2..be7d85c3 100644 --- a/test/Issue57.hs +++ b/test/Issue57.hs @@ -19,10 +19,10 @@ Concatenating one thousand unit squares shouldn't take more than 20 seconds =). -} -- from diagrams-lib -import Diagrams.Prelude +import Diagrams.Prelude -- from diagrams-cairo -import Diagrams.Backend.Cairo.CmdLine (Cairo, multiMain) +import Diagrams.Backend.Cairo.CmdLine (Cairo, multiMain) main :: IO () main = multiMain [ ("hcat", hcat (dias n)) diff --git a/test/PolyTest.hs b/test/PolyTest.hs index fef9b57f..c3d62301 100644 --- a/test/PolyTest.hs +++ b/test/PolyTest.hs @@ -1,9 +1,9 @@ {-# LANGUAGE NoMonomorphismRestriction #-} -import Diagrams.Prelude -import Diagrams.Backend.Cairo.CmdLine +import Diagrams.Backend.Cairo.CmdLine +import Diagrams.Prelude -import Diagrams.TwoD.Polygons +import Diagrams.TwoD.Polygons -- d = stroke . close $ fromVertices (polyPoints with { polyStar = StarFun succ }) @@ -19,7 +19,7 @@ mkR v = (mconcat . mconcat $ p) d = hcat' with {sep = 0.5} (map mkR vs) # lw 0.05 -s = stroke $ starPoly (StarSkip 5) +s = stroke $ starPoly (StarSkip 5) (polygon (with & polyType .~ PolyPolar (repeat (tau/15 :: Rad)) (take 15 (cycle [6,7,8])) diff --git a/test/ShapeTest.hs b/test/ShapeTest.hs index d342be00..a9ba02b6 100644 --- a/test/ShapeTest.hs +++ b/test/ShapeTest.hs @@ -1,6 +1,6 @@ {-# LANGUAGE NoMonomorphismRestriction #-} -import Diagrams.Prelude -import Diagrams.Backend.Cairo.CmdLine +import Diagrams.Backend.Cairo.CmdLine +import Diagrams.Prelude -main = defaultMain (eqTriangle 1 === square 1 === octagon 1) \ No newline at end of file +main = defaultMain (eqTriangle 1 === square 1 === octagon 1) diff --git a/test/Shapes.hs b/test/Shapes.hs index 695ca715..13ded64b 100644 --- a/test/Shapes.hs +++ b/test/Shapes.hs @@ -1,6 +1,6 @@ {-# LANGUAGE NoMonomorphismRestriction #-} -import Diagrams.Prelude -import Diagrams.Backend.Cairo.CmdLine +import Diagrams.Backend.Cairo.CmdLine +import Diagrams.Prelude -main = defaultMain (eqTriangle === square 1) \ No newline at end of file +main = defaultMain (eqTriangle === square 1) diff --git a/test/Snugtest.hs b/test/Snugtest.hs index abe5311a..83d7d7b0 100644 --- a/test/Snugtest.hs +++ b/test/Snugtest.hs @@ -12,12 +12,12 @@ module Main where -import Diagrams.Prelude hiding (centerXY, alignR, alignL) -import Diagrams.Backend.SVG -import Diagrams.Backend.SVG.CmdLine +import Diagrams.Backend.SVG +import Diagrams.Backend.SVG.CmdLine +import Diagrams.Prelude hiding (alignL, alignR, centerXY) -import Diagrams.Align -import Diagrams.TwoD.Align +import Diagrams.Align +import Diagrams.TwoD.Align concave :: Diagram SVG R2 concave = polygon (with & polyType .~ PolyPolar [a, b, b, b] diff --git a/test/bezbench.hs b/test/bezbench.hs index 7ab699de..71421e1e 100644 --- a/test/bezbench.hs +++ b/test/bezbench.hs @@ -1,8 +1,11 @@ -{-# LANGUAGE FlexibleInstances, TypeSynonymInstances, TypeFamilies, NoMonomorphismRestriction #-} -import Data.VectorSpace -import Data.NumInstances -import Criterion.Main -import Diagrams.Segment +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE NoMonomorphismRestriction #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeSynonymInstances #-} +import Criterion.Main +import Data.NumInstances +import Data.VectorSpace +import Diagrams.Segment type Q2 = (Rational,Rational) type R2 = (Double,Double) diff --git a/test/clipTo.hs b/test/clipTo.hs index 2dc2b38d..829ca16d 100644 --- a/test/clipTo.hs +++ b/test/clipTo.hs @@ -1,7 +1,7 @@ -import Data.Maybe +import Data.Maybe -import Diagrams.Prelude -import Diagrams.Backend.SVG.CmdLine +import Diagrams.Backend.SVG.CmdLine +import Diagrams.Prelude clipPath :: Path R2 clipPath = square 2 # alignR diff --git a/test/diamBench.hs b/test/diamBench.hs index 82e2c77a..2a668b23 100644 --- a/test/diamBench.hs +++ b/test/diamBench.hs @@ -1,9 +1,9 @@ {-# LANGUAGE FlexibleContexts #-} module DiamBench where -import Criterion.Main -import Diagrams.Prelude -import Diagrams.ThreeD.Shapes -import Diagrams.ThreeD.Types +import Criterion.Main +import Diagrams.Prelude +import Diagrams.ThreeD.Shapes +import Diagrams.ThreeD.Types -- Comparing the performance of two different diameter implementations diff --git a/test/splitTests.hs b/test/splitTests.hs index 08f78850..84d14634 100644 --- a/test/splitTests.hs +++ b/test/splitTests.hs @@ -1,12 +1,14 @@ -{-# LANGUAGE FlexibleInstances, TypeSynonymInstances, TypeFamilies #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeSynonymInstances #-} -import Test.QuickCheck -import Control.Applicative -import Data.Ratio -import Data.VectorSpace -import Data.Default +import Control.Applicative +import Data.Default +import Data.Ratio +import Data.VectorSpace +import Test.QuickCheck -import Diagrams.Prelude +import Diagrams.Prelude type Q2 = (Rational, Rational) @@ -56,4 +58,4 @@ x ==~ y = abs (x - y) < eps prop_adjustSeg_byAbs_len :: Segment R2 -> Scalar R2 -> AdjustSide -> Bool prop_adjustSeg_byAbs_len s len side = - arcLength (adjustSegment s with { adjMethod = ByAbsolute len, adjSide = side }) eps ==~ abs (arcLength s eps + len) \ No newline at end of file + arcLength (adjustSegment s with { adjMethod = ByAbsolute len, adjSide = side }) eps ==~ abs (arcLength s eps + len)