Difference between revisions of "Diagrams/Dev/Fixpoint"
(lay out framework for detailed design) |
(Some work on detailed design for fixpoint semantics) |
||
Line 13: | Line 13: | ||
=== diagrams-core === |
=== diagrams-core === |
||
− | No changes should be necessary to the following modules (all prefixed by <code>Diagrams.Core</code>: <code>Envelope</code>, <code>HasOrigin</code>, <code>Juxtapose</code>, <code>Names</code>, <code>Points</code>, <code>Query</code>, <code>Trace</code>, <code>Transform</code>, <code>V</code> |
+ | No changes should be necessary to the following modules (all prefixed by <code>Diagrams.Core</code>): <code>Envelope</code>, <code>HasOrigin</code>, <code>Juxtapose</code>, <code>Names</code>, <code>Points</code>, <code>Query</code>, <code>Trace</code>, <code>Transform</code>, <code>V</code>. |
I'm not sure about <code>Style</code> yet. |
I'm not sure about <code>Style</code> yet. |
||
==== <code>Diagrams.Core.Compile</code> ==== |
==== <code>Diagrams.Core.Compile</code> ==== |
||
+ | |||
+ | * Change the name of <code>UpAnnots</code> to <code>Summary</code>. |
||
+ | * Change the name of <code>DownAnnots</code> to <code>Context</code>, and change its definition to |
||
+ | |||
+ | type Context b v m = Style v |
||
+ | ::: Name |
||
+ | ::: SubMap b v m |
||
+ | ::: () |
||
+ | |||
+ | The addition of <code>SubMap</code> is so that we can use the positions of laid-out subdiagrams to compute the positions of others. |
||
+ | |||
+ | * <code>transfToAnnot</code> and <code>transfFromAnnot</code> can be deleted. |
||
+ | * <code>QDiaLeaf</code> and <code>withQDiaLeaf</code> can be deleted. |
||
+ | |||
+ | * Create new definitions |
||
+ | |||
+ | type ContextualT b v q m a = ReaderT (Context b v q) m a |
||
+ | |||
+ | type Contextual b v q a = ContextualT b v q Identity a |
||
+ | |||
+ | One could imagine making <code>ContextualT</code> a <code>newtype</code> but that would necessitate writing lots of instances for things like <code>MonadState</code>, <code>MonadReader</code>, and so on. |
||
+ | |||
+ | * The definition of <code>QDiagram</code> should be changed to something like |
||
+ | |||
+ | type QDiagram b v m = Contextual b v m (RTree b v Annotation, Summary b v m) |
||
+ | |||
+ | It's important that this is NOT a newtype, so we can freely use the <code>Monad</code> instance for <code>Contextual</code> when working with diagrams. |
||
==== <code>Diagrams.Core.Types</code> ==== |
==== <code>Diagrams.Core.Types</code> ==== |
Revision as of 01:43, 15 May 2014
This page describes the motivation and design for a refactoring of diagrams, to give them a semantics based on computing fixed points of functions from "context" information to raw tree of primitives together with some summary information.
Reference
See the original "manifesto" and ensuing mailing list discussion here: http://thread.gmane.org/gmane.comp.lang.haskell.diagrams/383
See also later IRC discussion beginning here: http://ircbrowse.net/browse/diagrams?events_page=935
Detailed design
Most of the changes should be in the diagrams-core
package, though a few things in diagrams-lib
may need to change as well.
diagrams-core
No changes should be necessary to the following modules (all prefixed by Diagrams.Core
): Envelope
, HasOrigin
, Juxtapose
, Names
, Points
, Query
, Trace
, Transform
, V
.
I'm not sure about Style
yet.
Diagrams.Core.Compile
- Change the name of
UpAnnots
toSummary
. - Change the name of
DownAnnots
toContext
, and change its definition to
type Context b v m = Style v ::: Name ::: SubMap b v m ::: ()
The addition of SubMap
is so that we can use the positions of laid-out subdiagrams to compute the positions of others.
transfToAnnot
andtransfFromAnnot
can be deleted.QDiaLeaf
andwithQDiaLeaf
can be deleted.
- Create new definitions
type ContextualT b v q m a = ReaderT (Context b v q) m a
type Contextual b v q a = ContextualT b v q Identity a
One could imagine making ContextualT
a newtype
but that would necessitate writing lots of instances for things like MonadState
, MonadReader
, and so on.
- The definition of
QDiagram
should be changed to something like
type QDiagram b v m = Contextual b v m (RTree b v Annotation, Summary b v m)
It's important that this is NOT a newtype, so we can freely use the Monad
instance for Contextual
when working with diagrams.