Changes to time for Safe Haskell

Omari Norman omari at smileystation.com
Tue Feb 25 21:33:57 UTC 2014


It would be great to make some minor changes to time so that the
Data.Time packages are Safe or Trustworthy for Safe Haskell.
Currently I have a raft of packages that are Unsafe solely due to
Data.Time being unsafe.  The necessary changes are minor, and I
changed nothing in the functions themselves.  One module just needs to
import Foreign.Safe rather than Foreign. Another is Unsafe due to use
of rewrite rules; I simply marked those modules Trustworthy.

Safe Haskell will be much more useful if modules that sit at the
bottom of tall stacks, such as Data.Time, are Safe.

Thanks,
Omari
-------------- next part --------------
1 patch for repository http://code.haskell.org/time:

Thu Feb 13 18:24:36 EST 2014  omari at smileystation.com
  * Changes for Safe Haskell
  
  Makes minimal necessary changes so that modules will infer as Safe
  for Safe Haskell.  Some modules are using rewrite rules, which are
  not Safe; to these I added Trustworthy pragmas.  The rewrite rules
  will continue to fire as normal, according to GHC's documentation.
  
  Other modules import Foreign.  I changed these to import
  Foreign.Safe instead.
  
  I changed the time.cabal file so that the minimum version of Base is
  4.4; that was the first version of Base that has the Foreign.Safe
  module.  (base 4.4 came with GHC 7.2, which is over two years old.)
  
  


New patches:

[Changes for Safe Haskell
omari at smileystation.com**20140213232436
 Ignore-this: c7c8f97541bd4ab2620613c51fad3b91
 
 Makes minimal necessary changes so that modules will infer as Safe
 for Safe Haskell.  Some modules are using rewrite rules, which are
 not Safe; to these I added Trustworthy pragmas.  The rewrite rules
 will continue to fire as normal, according to GHC's documentation.
 
 Other modules import Foreign.  I changed these to import
 Foreign.Safe instead.
 
 I changed the time.cabal file so that the minimum version of Base is
 4.4; that was the first version of Base that has the Foreign.Safe
 module.  (base 4.4 came with GHC 7.2, which is over two years old.)
 
 
] {
hunk ./Data/Time/Clock/CTimeval.hs 7
 #ifndef mingw32_HOST_OS
 -- All Unix-specific, this
 
-import Foreign
+import Foreign.Safe
 import Foreign.C
 
 data CTimeval = MkCTimeval CLong CLong
hunk ./Data/Time/Clock/Scale.hs 1
+{-# LANGUAGE Trustworthy #-}
 {-# OPTIONS -fno-warn-unused-imports #-}
 #include "HsConfigure.h"
 -- #hide
hunk ./Data/Time/Clock/UTC.hs 2
 {-# OPTIONS -fno-warn-unused-imports #-}
+{-# LANGUAGE Trustworthy #-}
 #include "HsConfigure.h"
 -- #hide
 module Data.Time.Clock.UTC
hunk ./Data/Time/LocalTime/TimeZone.hs 20
 import Data.Time.Clock
 import Data.Time.Clock.POSIX
 
-import Foreign
+import Foreign.Safe
 import Foreign.C
 import Control.DeepSeq
 import Data.Typeable
hunk ./time.cabal 39
 
 library
     build-depends: 
-        base >= 4 && < 5,
+        base >= 4.4 && < 5,
         deepseq >= 1.1,
         old-locale
     ghc-options: -Wall
}

Context:

[TAG 1.4.1
Ashley Yakeley <ashley at semantic.org>**20130630082310
 Ignore-this: 5332cf440a95a0cd691a8fb72d632282
] 
Patch bundle hash:
3212b712858c755593312eba3c045851a5d071f7


More information about the Libraries mailing list