Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style lenses #80

Merged
merged 4 commits into from
Feb 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/Diagrams/Core.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Diagrams.Core
-- Copyright : (c) 2011 diagrams-core team (see LICENSE)
-- Copyright : (c) 2011-2015 diagrams-core team (see LICENSE)
-- License : BSD-style (see LICENSE)
-- Maintainer : diagrams-discuss@googlegroups.com
--
Expand All @@ -22,7 +22,7 @@
-- The diagrams library relies heavily on custom types and classes. Many
-- of the relevant definitions are in the "Diagrams.Core.Types" module.
-- Indeed the definition of the diagram type @QDiagram@ is contained in:
-- 'Diagrams.Core.Types.QDiagram'.
-- 'Diagrams.Core.Types.QDiagram'.
--
-- The best place to start when learning
-- about diagrams\' types is the user manual:
Expand All @@ -32,11 +32,11 @@
--
-- * "Diagrams.Core.Types"
--
-- * @Annotation@,
-- * @Annotation@,
-- * @UpAnnots b v m@, @DownAnnots v@,
-- * @QDiaLeaf b v m@, @Measure v@,
-- * @Subdiagram b v m@, @SubMap b v m@,
-- * @Prim b v@, @Backend b v@,
-- * @Prim b v@, @Backend b v@,
-- * @DNode b v a@, @DTree b v a@,
-- * @RNode b v a@, @RTree b v a@,
-- * @NullBackend@, @Renderable t b@,
Expand Down Expand Up @@ -149,10 +149,11 @@ module Diagrams.Core
-- * Attributes and styles

, AttributeClass
, Attribute, mkAttr, mkTAttr, unwrapAttr
, Attribute (..)

, Style, HasStyle(..)
, getAttr, combineAttr
, getAttr
, atAttr, atMAttr, atTAttr
, applyAttr, applyMAttr, applyTAttr

-- * Envelopes
Expand Down
5 changes: 3 additions & 2 deletions src/Diagrams/Core/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Diagrams.Core.Compile
-- Copyright : (c) 2013 diagrams-core team (see LICENSE)
-- Copyright : (c) 2013-2015 diagrams-core team (see LICENSE)
-- License : BSD-style (see LICENSE)
-- Maintainer : diagrams-discuss@googlegroups.com
--
Expand Down Expand Up @@ -63,7 +63,8 @@ uncurry3 :: (a -> b -> c -> r) -> (a, b, c) -> r
uncurry3 f (x, y, z) = f x y z

-- | Convert a @QDiagram@ into a raw tree.
toDTree :: (HasLinearMap v, Floating n, Typeable n) => n -> n -> QDiagram b v n m -> Maybe (DTree b v n Annotation)
toDTree :: (HasLinearMap v, Floating n, Typeable n)
=> n -> n -> QDiagram b v n m -> Maybe (DTree b v n Annotation)
toDTree g n (QD qd)
= foldDUAL

Expand Down
9 changes: 4 additions & 5 deletions src/Diagrams/Core/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Diagrams.Core.Query
-- Copyright : (c) 2011 diagrams-core team (see LICENSE)
-- Copyright : (c) 2011-2015 diagrams-core team (see LICENSE)
-- License : BSD-style (see LICENSE)
-- Maintainer : diagrams-discuss@googlegroups.com
--
Expand All @@ -15,9 +15,8 @@
-----------------------------------------------------------------------------

module Diagrams.Core.Query
( Query (Query)
, runQuery
) where
( Query (..)
) where

import Control.Applicative
import Control.Lens (Rewrapped, Wrapped (..), iso)
Expand All @@ -44,7 +43,7 @@ newtype Query v n m = Query { runQuery :: Point v n -> m }
deriving (Functor, Applicative, Semigroup, Monoid)

instance Wrapped (Query v n m) where
type Unwrapped (Query v n m) = (Point v n -> m)
type Unwrapped (Query v n m) = Point v n -> m
_Wrapped' = iso runQuery Query

instance Rewrapped (Query v a m) (Query v' a' m')
Expand Down
Loading