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/GHC/Enum.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/GHC/Enum.hs')
-rw-r--r-- | libraries/base/GHC/Enum.hs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libraries/base/GHC/Enum.hs b/libraries/base/GHC/Enum.hs index c0e2f5a783..e09d2a9bfa 100644 --- a/libraries/base/GHC/Enum.hs +++ b/libraries/base/GHC/Enum.hs @@ -154,7 +154,10 @@ predError inst_ty = -- Tuples ------------------------------------------------------------------------ +-- | @since 2.01 deriving instance Bounded () + +-- | @since 2.01 instance Enum () where succ _ = errorWithoutStackTrace "Prelude.Enum.().succ: bad argument" pred _ = errorWithoutStackTrace "Prelude.Enum.().pred: bad argument" @@ -169,44 +172,58 @@ instance Enum () where enumFromThenTo () () () = let many = ():many in many -- Report requires instances up to 15 +-- | @since 2.01 deriving instance (Bounded a, Bounded b) => Bounded (a,b) +-- | @since 2.01 deriving instance (Bounded a, Bounded b, Bounded c) => Bounded (a,b,c) +-- | @since 2.01 deriving instance (Bounded a, Bounded b, Bounded c, Bounded d) => Bounded (a,b,c,d) +-- | @since 2.01 deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e) => Bounded (a,b,c,d,e) +-- | @since 2.01 deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f) => Bounded (a,b,c,d,e,f) +-- | @since 2.01 deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g) => Bounded (a,b,c,d,e,f,g) +-- | @since 2.01 deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h) => Bounded (a,b,c,d,e,f,g,h) +-- | @since 2.01 deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i) => Bounded (a,b,c,d,e,f,g,h,i) +-- | @since 2.01 deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j) => Bounded (a,b,c,d,e,f,g,h,i,j) +-- | @since 2.01 deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k) => Bounded (a,b,c,d,e,f,g,h,i,j,k) +-- | @since 2.01 deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l) => Bounded (a,b,c,d,e,f,g,h,i,j,k,l) +-- | @since 2.01 deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m) => Bounded (a,b,c,d,e,f,g,h,i,j,k,l,m) +-- | @since 2.01 deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m, Bounded n) => Bounded (a,b,c,d,e,f,g,h,i,j,k,l,m,n) +-- | @since 2.01 deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m, Bounded n, Bounded o) @@ -216,7 +233,10 @@ deriving instance (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, -- Bool ------------------------------------------------------------------------ +-- | @since 2.01 deriving instance Bounded Bool + +-- | @since 2.01 instance Enum Bool where succ False = True succ True = errorWithoutStackTrace "Prelude.Enum.Bool.succ: bad argument" @@ -239,7 +259,9 @@ instance Enum Bool where -- Ordering ------------------------------------------------------------------------ +-- | @since 2.01 deriving instance Bounded Ordering +-- | @since 2.01 instance Enum Ordering where succ LT = EQ succ EQ = GT @@ -266,10 +288,12 @@ instance Enum Ordering where -- Char ------------------------------------------------------------------------ +-- | @since 2.01 instance Bounded Char where minBound = '\0' maxBound = '\x10FFFF' +-- | @since 2.01 instance Enum Char where succ (C# c#) | isTrue# (ord# c# /=# 0x10FFFF#) = C# (chr# (ord# c# +# 1#)) @@ -393,10 +417,12 @@ Be careful about these instances. (c) remember that Int is bounded, so [1..] terminates at maxInt -} +-- | @since 2.01 instance Bounded Int where minBound = minInt maxBound = maxInt +-- | @since 2.01 instance Enum Int where succ x | x == maxBound = errorWithoutStackTrace "Prelude.Enum.succ{Int}: tried to take `succ' of maxBound" @@ -559,6 +585,7 @@ efdtIntDnFB c n x1 x2 y -- Be careful about underflow! -- Word ------------------------------------------------------------------------ +-- | @since 2.01 instance Bounded Word where minBound = 0 @@ -572,6 +599,7 @@ instance Bounded Word where #error Unhandled value for WORD_SIZE_IN_BITS #endif +-- | @since 2.01 instance Enum Word where succ x | x /= maxBound = x + 1 @@ -611,6 +639,7 @@ wordToIntegerX (W# x#) = wordToInteger x# -- Integer ------------------------------------------------------------------------ +-- | @since 2.01 instance Enum Integer where succ x = x + 1 pred x = x - 1 |