diff options
| author | Seraphime Kirkovski <kirkseraph@gmail.com> | 2016-06-06 12:29:38 +0200 |
|---|---|---|
| committer | Ben Gamari <ben@smart-cactus.org> | 2016-06-06 15:07:18 +0200 |
| commit | a90085bd45239fffd65c01c24752a9bbcef346f1 (patch) | |
| tree | 41a85ba36720d8fba0a3296ea7a844dd9fc0042a /libraries/base/Control/Monad/Fix.hs | |
| parent | 48e9a1f5521fa3185510d144dd28a87e452ce134 (diff) | |
| download | haskell-a90085bd45239fffd65c01c24752a9bbcef346f1.tar.gz | |
Add @since annotations to base instances
Add @since annotations to instances in `base`.
Test Plan:
* ./validate # some commets shouldn't break the build
* review the annotations for absurdities.
Reviewers: ekmett, goldfire, RyanGlScott, austin, hvr, bgamari
Reviewed By: RyanGlScott, hvr, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2277
GHC Trac Issues: #11767
Diffstat (limited to 'libraries/base/Control/Monad/Fix.hs')
| -rw-r--r-- | libraries/base/Control/Monad/Fix.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libraries/base/Control/Monad/Fix.hs b/libraries/base/Control/Monad/Fix.hs index 4862770f26..c8a9ddab58 100644 --- a/libraries/base/Control/Monad/Fix.hs +++ b/libraries/base/Control/Monad/Fix.hs @@ -62,60 +62,76 @@ class (Monad m) => MonadFix m where -- Instances of MonadFix for Prelude monads +-- | @since 2.01 instance MonadFix Maybe where mfix f = let a = f (unJust a) in a where unJust (Just x) = x unJust Nothing = errorWithoutStackTrace "mfix Maybe: Nothing" +-- | @since 2.01 instance MonadFix [] where mfix f = case fix (f . head) of [] -> [] (x:_) -> x : mfix (tail . f) +-- | @since 2.01 instance MonadFix IO where mfix = fixIO +-- | @since 2.01 instance MonadFix ((->) r) where mfix f = \ r -> let a = f a r in a +-- | @since 4.3.0.0 instance MonadFix (Either e) where mfix f = let a = f (unRight a) in a where unRight (Right x) = x unRight (Left _) = errorWithoutStackTrace "mfix Either: Left" +-- | @since 2.01 instance MonadFix (ST s) where mfix = fixST -- Instances of Data.Monoid wrappers +-- | @since 4.8.0.0 instance MonadFix Dual where mfix f = Dual (fix (getDual . f)) +-- | @since 4.8.0.0 instance MonadFix Sum where mfix f = Sum (fix (getSum . f)) +-- | @since 4.8.0.0 instance MonadFix Product where mfix f = Product (fix (getProduct . f)) +-- | @since 4.8.0.0 instance MonadFix First where mfix f = First (mfix (getFirst . f)) +-- | @since 4.8.0.0 instance MonadFix Last where mfix f = Last (mfix (getLast . f)) +-- | @since 4.8.0.0 instance MonadFix f => MonadFix (Alt f) where mfix f = Alt (mfix (getAlt . f)) -- Instances for GHC.Generics +-- | @since 4.9.0.0 instance MonadFix Par1 where mfix f = Par1 (fix (unPar1 . f)) +-- | @since 4.9.0.0 instance MonadFix f => MonadFix (Rec1 f) where mfix f = Rec1 (mfix (unRec1 . f)) +-- | @since 4.9.0.0 instance MonadFix f => MonadFix (M1 i c f) where mfix f = M1 (mfix (unM1. f)) +-- | @since 4.9.0.0 instance (MonadFix f, MonadFix g) => MonadFix (f :*: g) where mfix f = (mfix (fstP . f)) :*: (mfix (sndP . f)) where |
