packages feed

prelude-safeenum 0.1.0.1 → 0.1.1

raw patch · 3 files changed

+35/−9 lines, 3 files

Files

VERSION view
@@ -1,3 +1,5 @@+0.1.1 (2013.03.07):+    - Prelude.SafeEnum: corrected the Char instance for GHC 7.8 0.1.0.1 (2013.06.01):     - Documentation changes. 0.1.0 (2013.05.29):
prelude-safeenum.cabal view
@@ -1,5 +1,5 @@ ------------------------------------------------------------------- wren ng thornton <wren@community.haskell.org>    ~ 2013.06.01+-- wren ng thornton <wren@community.haskell.org>    ~ 2014.03.07 ----------------------------------------------------------------  -- By and large Cabal >=1.2 is fine; but >= 1.6 gives tested-with:@@ -8,12 +8,12 @@ Build-Type:     Simple  Name:           prelude-safeenum-Version:        0.1.0.1+Version:        0.1.1 Stability:      provisional Homepage:       http://code.haskell.org/~wren/ Author:         wren ng thornton Maintainer:     wren@community.haskell.org-Copyright:      Copyright (c) 2012--2013 wren ng thornton+Copyright:      Copyright (c) 2012--2014 wren ng thornton License:        BSD3 License-File:   LICENSE @@ -30,7 +30,7 @@     direction.  Tested-With:-    GHC ==6.12.1, GHC ==7.6.1+    GHC ==6.12.1, GHC ==7.6.1, GHC ==7.8.2 Extra-source-files:     AUTHORS, README, VERSION Source-Repository head
src/Prelude/SafeEnum.hs view
@@ -7,7 +7,7 @@ {-# LANGUAGE Trustworthy #-} #endif -------------------------------------------------------------------                                                    2013.06.01+--                                                    2014.03.07 -- | -- Module      :  Prelude.SafeEnum -- Copyright   :  2012--2013 wren ng thornton@@ -65,7 +65,12 @@ import qualified Prelude (Enum(..))  #ifdef __GLASGOW_HASKELL__-import GHC.Exts (build, Int(I#), Char(C#), ord#, chr#, (==#), (<=#), (+#), (-#), leChar#)+#   if __GLASGOW_HASKELL__ >= 708+import GHC.Exts (isTrue#, (/=#))+#   else+import GHC.Exts ((==#))+#   endif+import GHC.Exts (build, Int(I#), Char(C#), ord#, chr#, (<=#), (+#), (-#), leChar#) #else import Data.Char (chr, ord) #endif@@ -483,8 +488,13 @@  ---------------------------------------------------------------- instance UpwardEnum Char where-#ifdef __GLASGOW_HASKELL__+#if __GLASGOW_HASKELL__ >= 708     succ (C# c#)+        | isTrue# (ord# c# /=# 0x10FFFF#)+                    = Just $! C# (chr# (ord# c# +# 1#))+        | otherwise = Nothing+#elif defined __GLASGOW_HASKELL__+    succ (C# c#)         | not (ord# c# ==# 0x10FFFF#) = Just $! C# (chr# (ord# c# +# 1#))         | otherwise                   = Nothing #else@@ -501,8 +511,13 @@     {-# INLINE enumFromTo #-}  instance DownwardEnum Char where-#ifdef __GLASGOW_HASKELL__+#if __GLASGOW_HASKELL__ >= 708     pred (C# c#)+        | isTrue# (ord# c# /=# 0#)+                    = Just $! C# (chr# (ord# c# -# 1#))+        | otherwise = Nothing+#elif defined __GLASGOW_HASKELL__+    pred (C# c#)         | not (ord# c# ==# 0#) = Just $! C# (chr# (ord# c# -# 1#))         | otherwise            = Nothing #else@@ -519,7 +534,16 @@     {-# INLINE enumDownFromTo #-}  instance Enum Char where-#ifdef __GLASGOW_HASKELL__+#if __GLASGOW_HASKELL__ >= 708+    toEnum (I# i#)+        | isTrue# (0# <=# i#)+            && isTrue# (i# <=# 0x10FFFF#) = Just $! C# (chr# i#)+        | otherwise                       = Nothing+    fromEnum (C# c#)+        | isTrue# (leChar# (chr# 0#) c#)+            && isTrue# (leChar# c# (chr# 0x10FFFF#)) = Just $! I# (ord# c#)+        | otherwise                                  = Nothing+#elif defined __GLASGOW_HASKELL__     toEnum (I# i#)         | 0# <=# i# && i# <=# 0x10FFFF# = Just $! C# (chr# i#)         | otherwise                     = Nothing