old-locale 1.0.0.2 → 1.0.0.7
raw patch · 3 files changed
Files
- System/Locale.hs +31/−19
- changelog.md +25/−0
- old-locale.cabal +29/−17
System/Locale.hs view
@@ -1,17 +1,22 @@+{-# LANGUAGE CPP #-}+#if __GLASGOW_HASKELL__ >= 701 && MIN_VERSION_base(4,4,1)+{-# LANGUAGE Safe #-}+#endif ----------------------------------------------------------------------------- -- | -- Module : System.Locale -- Copyright : (c) The University of Glasgow 2001--- License : BSD-style (see the file libraries/base/LICENSE)--- +-- License : BSD3 (see LICENSE file)+-- -- Maintainer : libraries@haskell.org -- Stability : stable -- Portability : portable -- -- This module provides the ability to adapt to local conventions.+-- -- At present, it supports only time and date information as used by--- System.Time.calendarTimeToString from the System.Time module in the--- old-time package.+-- @calendarTimeToString@ from the @System.Time@ module in the+-- @old-time@ package. -- ----------------------------------------------------------------------------- @@ -20,7 +25,7 @@ TimeLocale(..) , defaultTimeLocale- + , iso8601DateFormat , rfc822DateFormat )@@ -29,23 +34,23 @@ import Prelude data TimeLocale = TimeLocale {- -- |full and abbreviated week days+ -- |full and abbreviated week days wDays :: [(String, String)],- -- |full and abbreviated months+ -- |full and abbreviated months months :: [(String, String)], intervals :: [(String, String)],- -- |AM\/PM symbols+ -- |AM\/PM symbols amPm :: (String, String),- -- |formatting strings+ -- |formatting strings dateTimeFmt, dateFmt,- timeFmt, time12Fmt :: String + timeFmt, time12Fmt :: String } deriving (Eq, Ord, Show) -defaultTimeLocale :: TimeLocale -defaultTimeLocale = TimeLocale { - wDays = [("Sunday", "Sun"), ("Monday", "Mon"), - ("Tuesday", "Tue"), ("Wednesday", "Wed"), - ("Thursday", "Thu"), ("Friday", "Fri"), +defaultTimeLocale :: TimeLocale+defaultTimeLocale = TimeLocale {+ wDays = [("Sunday", "Sun"), ("Monday", "Mon"),+ ("Tuesday", "Tue"), ("Wednesday", "Wed"),+ ("Thursday", "Thu"), ("Friday", "Fri"), ("Saturday", "Sat")], months = [("January", "Jan"), ("February", "Feb"),@@ -72,15 +77,22 @@ } --- |Normally, ISO-8601 just defines YYYY-MM-DD--- but we can add a time spec.+{- | Construct format string according to <http://en.wikipedia.org/wiki/ISO_8601 ISO-8601>. +The @Maybe String@ argument allows to supply an optional time specification. E.g.:++@+'iso8601DateFormat' Nothing == "%Y-%m-%d" -- i.e. @/YYYY-MM-DD/@+'iso8601DateFormat' (Just "%H:%M:%S") == "%Y-%m-%dT%H:%M:%S" -- i.e. @/YYYY-MM-DD/T/HH:MM:SS/@+@+-}+ iso8601DateFormat :: Maybe String -> String iso8601DateFormat mTimeFmt = "%Y-%m-%d" ++ case mTimeFmt of- Nothing -> "" + Nothing -> "" Just fmt -> 'T' : fmt -+-- | Format string according to <http://tools.ietf.org/html/rfc822#section-5 RFC822>. rfc822DateFormat :: String rfc822DateFormat = "%a, %_d %b %Y %H:%M:%S %Z"
+ changelog.md view
@@ -0,0 +1,25 @@+# Changelog for [`old-locale` package](http://hackage.haskell.org/package/old-locale)++## 1.0.0.7 *Nov 2014*++ * Decoupled from GHC distribution++## 1.0.0.6 *Mar 2014*++ * Bundled with GHC 7.8.1++ * Update Haddock comments++ * Update to Cabal 1.10 format++## 1.0.0.5 *Sep 2012*++ * Bundled with GHC 7.6.1++ * Un-deprecate `old-locale` package++## 1.0.0.4 *Feb 2012*++ * Bundled with GHC 7.4.1++ * Add support for SafeHaskell
old-locale.cabal view
@@ -1,23 +1,35 @@-name: old-locale-version: 1.0.0.2-license: BSD3-license-file: LICENSE-maintainer: libraries@haskell.org-bug-reports: http://hackage.haskell.org/trac/ghc/newticket?component=libraries%20%28other%29-synopsis: locale library-category: System+name: old-locale+version: 1.0.0.7+-- NOTE: Don't forget to update ./changelog.md+license: BSD3+license-file: LICENSE+maintainer: libraries@haskell.org+bug-reports: https://github.com/haskell/old-locale/issues+synopsis: locale library+category: System+build-type: Simple+Cabal-Version:>=1.10+tested-with: GHC==7.8.3, GHC==7.8.2, GHC==7.8.1, GHC==7.6.3, GHC==7.6.2, GHC==7.6.1, GHC==7.4.2, GHC==7.4.1, GHC==7.2.2, GHC==7.2.1, GHC==7.0.4, GHC==7.0.3, GHC==7.0.2, GHC==7.0.1, GHC==6.12.3 description:- This package provides the old locale library.- For new code, the new locale library is recommended.-build-type: Simple-Cabal-Version: >= 1.6+ This package provides the ability to adapt to+ locale conventions such as date and time formats. +extra-source-files:+ changelog.md++source-repository head+ type: git+ location: https://github.com/haskell/old-locale.git+ Library+ default-language: Haskell98+ other-extensions: CPP+ if impl(ghc>=7.2)+ -- && base>=4.4.1+ other-extensions: Safe+ exposed-modules: System.Locale- build-depends: base >= 3 && < 5 -source-repository head- type: darcs- location: http://darcs.haskell.org/packages/old-locale/-+ build-depends: base >= 4.2 && < 4.9+ ghc-options: -Wall