Skip to content

Commit

Permalink
Export lens from Prelude.
Browse files Browse the repository at this point in the history
Now there's only a few conflicts with lens and Prelude. Namely beside,
backwards, none, transform, (#) (moved to (##)) and (.>). inside and
outside are in Diagrams.BoundingBox but not exported by Prelude.
  • Loading branch information
cchalmers committed Mar 9, 2015
1 parent da7d665 commit da4e3af
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/Diagrams/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Diagrams.Prelude
-- Copyright : (c) 2011 diagrams-lib team (see LICENSE)
-- Copyright : (c) 2011-2015 diagrams-lib team (see LICENSE)
-- License : BSD-style (see LICENSE)
-- Maintainer : diagrams-discuss@googlegroups.com
--
Expand Down Expand Up @@ -114,6 +114,7 @@ module Diagrams.Prelude
, module Diagrams.Util

-- * Convenience re-exports

-- | For representing and operating on colors.
, module Data.Colour

Expand All @@ -139,8 +140,11 @@ module Diagrams.Prelude
-- | For working with 'Active' (i.e. animated) things.
, module Data.Active

-- | Essential Lens Combinators
, (&), (.~), (%~)
-- | This exports most of the lens module, excluding the
-- following functions that can cause collisions with diagrams:
-- @contains@, @inside@, @outside@, @none@, @transform@, @(#)@
-- (replaced by @##@) and @.>@ (which is just '.' anyway).
, module Control.Lens

, Applicative(..), (*>), (<*), (<$>), (<$), liftA, liftA2, liftA3
) where
Expand All @@ -151,7 +155,7 @@ import Diagrams.Align
import Diagrams.Angle
import Diagrams.Animation
import Diagrams.Attributes
import Diagrams.BoundingBox hiding (intersection, union)
import Diagrams.BoundingBox hiding (intersection, union, inside, outside, contains)
import Diagrams.Combinators
import Diagrams.Coordinates
import Diagrams.CubicSpline
Expand All @@ -170,22 +174,20 @@ import Diagrams.Size
import Diagrams.Tangent
import Diagrams.ThreeD
import Diagrams.Trace
import Diagrams.Trail hiding (linePoints, loopPoints, trailPoints)
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 Control.Lens hiding (at, backwards, beside,
contains, inside, none, outside,
transform, ( # ), (.>))
import Data.Active
<<<<<<< HEAD
import Data.Colour hiding (AffineSpace (..), atop, over)
=======
import Data.Colour hiding (AffineSpace (..), atop,
over)
import Data.Colour.SRGB
>>>>>>> 8bd62e5... SomeColor Show instance.
import Data.Colour.Names hiding (tan)
import Data.Semigroup

Expand Down

4 comments on commit da4e3af

@bergey
Copy link
Member

@bergey bergey commented on da4e3af Mar 10, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recent experience with adding Foldable and Monoid to the Prelude have made me wary of convenience re-exports. I think bringing all of lens into scope will inconvenience many users, and needing an explicit import list for Diagrams in order to limit the lens imports is unpleasant. I'd be fine with a new module that re-exports the non-conflicting names from Control.Lens. At very least, I've been meaning to document that import line somewhere; thank you for working out what it is.

@cchalmers
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean, lens exports a lot but most of the names aren't going to conflict (I made a list http://lpaste.net/124451). Maybe we could prune some more off?

I'd you'd still like a separate module I'd prefer to have a Diagrams module that only exports functions from diagrams for people that want that. And just have a single prelude that exports almost everything you'd need.

thank you for working out what it is

I just tried to export both and ghc gave me the list of conflicts :)

@bergey
Copy link
Member

@bergey bergey commented on da4e3af Mar 11, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd you'd still like a separate module I'd prefer to have a Diagrams module that only exports functions from diagrams for people that want that

That would also work for me.

I could have been more clear, above. Because lens exports so much, I find it's common to overlap with part of lens I'm not planning to use. It need not be overlap between lens & diagrams, just overlap between lens and some library or some name I want locally.

@cchalmers
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I wasn't clear. I meant most of lens won't conflict with anything (foldMapByOf, <<<>= etc.). I've updated the list with possible conflicts with other libraries (http://lpaste.net/124451), there are others but I think these most of the most used ones. I think I'll exclude these too.

I'll still make a Diagrams module for just diagrams things.

Please sign in to comment.