Ticket #1773: Compositor.dpatch

File Compositor.dpatch, 3.0 KB (added by guest, 4 years ago)

darcs patch to base

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 69
91+        Control.Compositor,
92}
93
94Context:
95
96[expose the value of +RTS -N as GHC.Conc.numCapabilities (see #1733)
97Simon Marlow <simonmar@microsoft.com>**20071009132042]
98[typo
99Simon Marlow <simonmar@microsoft.com>**20070917130703]
100[put extra-tmp-files field in the right place
101Simon Marlow <simonmar@microsoft.com>**20070914140812]
102[Add more entries to boring file
103Ian Lynagh <igloo@earth.li>**20070913210500]
104[Add a boring file
105Ian Lynagh <igloo@earth.li>**20070913204641]
106[TAG 2007-09-13
107Ian Lynagh <igloo@earth.li>**20070913215720]
108Patch bundle hash:
109c232026bca8fe5a70b2a70d5963ad2ae55522f4e