X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Control%2FArrow.hs;h=f3c1de2f3b9ca9e5887446c2a64ec42285891fbe;hb=d92335309378a55fcd85074bbe9b4d7ff6fdba8b;hp=ed9fa734b108e7c51727c44529a896f2257edcf1;hpb=10e529099e84e0270da4228132e27f0adae638b5;p=ghc-base.git diff --git a/Control/Arrow.hs b/Control/Arrow.hs index ed9fa73..f3c1de2 100644 --- a/Control/Arrow.hs +++ b/Control/Arrow.hs @@ -39,7 +39,6 @@ module Control.Arrow ( ) where import Prelude hiding (id,(.)) -import qualified Prelude import Control.Monad import Control.Monad.Fix @@ -54,20 +53,16 @@ infixr 1 ^>>, >>^ infixr 1 ^<<, <<^ -- | The basic arrow class. --- Any instance must define either 'arr' or 'pure' (which are synonyms), --- as well as 'first'. The other combinators have sensible --- default definitions, which may be overridden for efficiency. +-- +-- Minimal complete definition: 'arr' and 'first'. +-- +-- The other combinators have sensible default definitions, +-- which may be overridden for efficiency. class Category a => Arrow a where - -- | Lift a function to an arrow: you must define either this - -- or 'pure'. + -- | Lift a function to an arrow. arr :: (b -> c) -> a b c - arr = pure - - -- | A synonym for 'arr': you must define one or other of them. - pure :: (b -> c) -> a b c - pure = arr -- | Send the first component of the input through the argument -- arrow, and copy the rest unchanged to the output. @@ -98,8 +93,6 @@ class Category a => Arrow a where f &&& g = arr (\b -> (b,b)) >>> f *** g {-# RULES -"identity" - arr id = id "compose/arr" forall f g . (arr f) . (arr g) = arr (f . g) "first/arr" forall f . @@ -221,9 +214,9 @@ class Arrow a => ArrowChoice a where "fanin/arr" forall f g . arr f ||| arr g = arr (f ||| g) "compose/left" forall f g . - left f >>> left g = left (f >>> g) + left f . left g = left (f . g) "compose/right" forall f g . - right f >>> right g = right (f >>> g) + right f . right g = right (f . g) #-} instance ArrowChoice (->) where