patch applied (packages/arrows-base-3.0): add Functor, Applicative, Alternative and Monoid instances

Ross Paterson ross at soi.city.ac.uk
Thu Feb 14 19:57:31 EST 2008


Thu Feb 14 16:55:25 PST 2008  Ross Paterson <ross at soi.city.ac.uk>
  * add Functor, Applicative, Alternative and Monoid instances
  
  They all have the same form:
  
  instance ... => Functor (MyTransformer a b) where
  	fmap f g = g >>> arr f
  
  instance ... => Applicative (MyTransformer a b) where
  	pure x = arr (const x)
  	f <*> g = f &&& g >>> arr (uncurry id)
  
  instance ... => Alternative (MyTransformer a b) where
  	empty = zeroArrow
  	f <|> g = f <+> g
  
  instance ... => Monoid (MyTransformer a b c) where
  	mempty = zeroArrow
  	mappend f g = f <+> g
  

    M ./Control/Arrow/Transformer/Automaton.hs -1 +21
    M ./Control/Arrow/Transformer/CoState.hs -1 +21
    M ./Control/Arrow/Transformer/Error.hs -1 +20
    M ./Control/Arrow/Transformer/Reader.hs -1 +21
    M ./Control/Arrow/Transformer/State.hs -1 +21
    M ./Control/Arrow/Transformer/Static.hs -2 +21
    M ./Control/Arrow/Transformer/Stream.hs -3 +23
    M ./Control/Arrow/Transformer/Writer.hs -1 +20


More information about the Cvs-libraries mailing list