Ticket #1773: Category.dpatch

File Category.dpatch, 6.1 KB (added by guest, 4 years ago)

updated patch

Line 
1
2New patches:
3
4[new Control.Compositor module
5Ashley Yakeley <ashley@semantic.org>**20071013074851
6 
7 The Compositor class is a superclass of Arrow.
8] {
9addfile ./Control/Compositor.hs
10hunk ./Control/Applicative.hs 42
11+import Control.Compositor
12hunk ./Control/Applicative.hs 44
13-       (Arrow(arr, (>>>), (&&&)), ArrowZero(zeroArrow), ArrowPlus((<+>)))
14+       (Arrow(arr, (&&&)), ArrowZero(zeroArrow), ArrowPlus((<+>)))
15hunk ./Control/Arrow.hs 28
16-               (<<<), (<<^), (^<<),
17+               (<<^), (^<<),
18hunk ./Control/Arrow.hs 43
19+import Control.Compositor
20hunk ./Control/Arrow.hs 50
21-infixr 1 >>>, ^>>, >>^
22-infixr 1 <<<, ^<<, <<^
23+infixr 1 ^>>, >>^
24+infixr 1 ^<<, <<^
25hunk ./Control/Arrow.hs 55
26---   as well as '>>>' and 'first'.  The other combinators have sensible
27+--   as well as 'first'.  The other combinators have sensible
28hunk ./Control/Arrow.hs 58
29-class Arrow a where
30+class Compositor a => Arrow a where
31hunk ./Control/Arrow.hs 69
32-       -- | Left-to-right composition of arrows.
33-       (>>>) :: a b c -> a c d -> a b d
34-
35hunk ./Control/Arrow.hs 98
36+"identity"
37+               arr id = identity
38hunk ./Control/Arrow.hs 120
39-       f >>> g = g . f
40hunk ./Control/Arrow.hs 130
41+instance Monad m => Compositor (Kleisli m) where
42+       identity = Kleisli return
43+       Kleisli f >>> Kleisli g = Kleisli (\b -> f b >>= g)
44+
45hunk ./Control/Arrow.hs 136
46-       Kleisli f >>> Kleisli g = Kleisli (\b -> f b >>= g)
47hunk ./Control/Arrow.hs 152
48--- | Right-to-left composition, for a better fit with arrow notation.
49-(<<<) :: Arrow a => a c d -> a b c -> a b d
50-f <<< g = g >>> f
51-
52hunk ./Control/Compositor.hs 1
53+-----------------------------------------------------------------------------
54+-- |
55+-- Module      :  Control.Compositor
56+-- Copyright   :  (c) Ashley Yakeley 2007
57+-- License     :  BSD-style (see the LICENSE file in the distribution)
58+--
59+-- Maintainer  :  ashley@semantic.org
60+-- Stability   :  experimental
61+-- Portability :  portable
62+
63+module Control.Compositor where
64+
65+infixr 1 >>>, <<<
66+
67+class Compositor comp where
68+       identity :: comp a a
69+
70+       -- | Left-to-right composition
71+       (>>>) :: comp a b -> comp b c -> comp a c
72+
73+{-# RULES
74+"identity/left"        forall p .
75+               identity >>> p = p
76+"identity/right"       forall p .
77+               p >>> identity = p
78+"association"  forall p q r .
79+               (p >>> q) >>> r = p >>> (q >>> r)
80+ #-}
81+
82+instance Compositor (->) where
83+       identity = id
84+       p >>> q = q . p
85+
86+-- | Right-to-left composition
87+(<<<) :: Compositor comp => comp b c -> comp a b -> comp a c
88+f <<< g = g >>> f
89+
90hunk ./base.cabal 72
91+        Control.Compositor,
92}
93
94[new Control.Category, ghc ticket #1773
95Ashley Yakeley <ashley@semantic.org>**20071029022526] {
96move ./Control/Compositor.hs ./Control/Category.hs
97replace ./Control/Applicative.hs [A-Za-z_0-9] Compositor Category
98replace ./Control/Arrow.hs [A-Za-z_0-9] Compositor Category
99replace ./Control/Category.hs [A-Za-z_0-9] Compositor Category
100replace ./Control/Category.hs [A-Za-z_0-9] comp cat
101replace ./base.cabal [A-Za-z_0-9] Compositor Category
102hunk ./Control/Applicative.hs 38
103-#ifdef __HADDOCK__
104-import Prelude
105-#endif
106+import Prelude hiding (id,(.))
107hunk ./Control/Arrow.hs 39
108-import Prelude
109+import Prelude hiding (id,(.))
110hunk ./Control/Arrow.hs 99
111-               arr id = identity
112+               arr id = id
113hunk ./Control/Arrow.hs 101
114-               arr f >>> arr g = arr (f >>> g)
115+               (arr f) . (arr g) = arr (f . g)
116hunk ./Control/Arrow.hs 111
117-               first f >>> first g = first (f >>> g)
118+               (first f) . (first g) = first (f . g)
119hunk ./Control/Arrow.hs 113
120-               second f >>> second g = second (f >>> g)
121+               (second f) . (second g) = second (f . g)
122hunk ./Control/Arrow.hs 131
123-       identity = Kleisli return
124-       Kleisli f >>> Kleisli g = Kleisli (\b -> f b >>= g)
125+       id = Kleisli return
126+       (Kleisli f) . (Kleisli g) = Kleisli (\b -> g b >>= f)
127hunk ./Control/Category.hs 11
128+-- http://hackage.haskell.org/trac/ghc/ticket/1773
129+
130hunk ./Control/Category.hs 15
131+import Prelude hiding (id,(.))
132+import qualified Prelude
133+
134+infixr 9 .
135hunk ./Control/Category.hs 21
136+-- | A class for categories.
137+--   id and (.) must form a monoid.
138hunk ./Control/Category.hs 24
139-       identity :: cat a a
140+       -- | the identity morphism
141+       id :: cat a a
142hunk ./Control/Category.hs 27
143-       -- | Left-to-right composition
144-       (>>>) :: cat a b -> cat b c -> cat a c
145+       -- | morphism composition
146+       (.) :: cat b c -> cat a b -> cat a c
147hunk ./Control/Category.hs 32
148-               identity >>> p = p
149+               id . p = p
150hunk ./Control/Category.hs 34
151-               p >>> identity = p
152+               p . id = p
153hunk ./Control/Category.hs 36
154-               (p >>> q) >>> r = p >>> (q >>> r)
155+               (p . q) . r = p . (q . r)
156hunk ./Control/Category.hs 40
157-       identity = id
158-       p >>> q = q . p
159+       id = Prelude.id
160+       (.) = (Prelude..)
161hunk ./Control/Category.hs 45
162-f <<< g = g >>> f
163+(<<<) = (.)
164hunk ./Control/Category.hs 47
165+-- | Left-to-right composition
166+(>>>) :: Category cat => cat a b -> cat b c -> cat a c
167+f >>> g = g . f
168}
169
170Context:
171
172[Fix doc building with Haddock 0.9
173Simon Marlow <simonmar@microsoft.com>**20071024090947
174 I was using a recent build here, which is more tolerant.
175]
176[FIX #1258: document that openTempFile is secure(ish)
177Simon Marlow <simonmar@microsoft.com>**20071023130928
178 Also change the mode from 0666 to 0600, which seems like a more
179 sensible value and matches what C's mkstemp() does.
180]
181[Clean up .cabal file a bit
182Duncan Coutts <duncan@haskell.org>**20071022132708
183 specify build-type and cabal-version >= 1.2
184 put extra-tmp-files in the right place
185 use os(windows) rather than os(mingw32)
186]
187[base in 6.8 and head branch should be version 3.0
188Don Stewart <dons@galois.com>**20071007150408]
189[FIX #1652: openTempFile should accept an empty string for the directory
190Simon Marlow <simonmar@microsoft.com>**20071018122345]
191[clean up duplicate code
192Simon Marlow <simonmar@microsoft.com>**20071017141311]
193[expose the value of +RTS -N as GHC.Conc.numCapabilities (see #1733)
194Simon Marlow <simonmar@microsoft.com>**20071009132042]
195[typo
196Simon Marlow <simonmar@microsoft.com>**20070917130703]
197[put extra-tmp-files field in the right place
198Simon Marlow <simonmar@microsoft.com>**20070914140812]
199[Add more entries to boring file
200Ian Lynagh <igloo@earth.li>**20070913210500]
201[Add a boring file
202Ian Lynagh <igloo@earth.li>**20070913204641]
203[TAG 2007-09-13
204Ian Lynagh <igloo@earth.li>**20070913215720]
205Patch bundle hash:
206c9be4454266d7c68b75bb60609db84d73ad949e1