Ticket #2392 (closed proposal: wontfix)

Opened 5 years ago

Last modified 5 years ago

Make Applicative a superclass of Monad

Reported by: Ashley Yakeley Owned by:
Priority: normal Milestone:
Component: libraries/base Version: 6.8.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Make Applicative (in Control.Applicative) a superclass of Monad (in Control.Monad). Rename members of Applicative and other functions, to avoid unnecessary duplication.

class Functor f => Applicative f where
  return :: a -> f a
  ap :: f (a -> b) -> f a -> f b

liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
liftA2 f a b = ap (fmap f a) b

(>>) :: (Applicative f) => f a -> f b -> f b
(>>) = liftA2 (const id)

-- etc.
class Applicative m => Monad m where
  (>>=) :: forall a b . m a -> (a -> m b) -> m b
  fail :: String -> m a
  fail s = error s

Change History

Changed 5 years ago by Ashley Yakeley

Will break Haskell 98.

Changed 5 years ago by igloo

  • status changed from new to closed
  • difficulty set to Unknown
  • resolution set to wontfix

Ashley says "OK. Please close it, and I'll submit it for [Haskell] Prime."

Changed 5 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

Changed 5 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.