openSUSE Commits
Threads by month
- ----- 2025 -----
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
August 2017
- 1 participants
- 2097 discussions
Hello community,
here is the log from the commit of package ghc-hopenssl for openSUSE:Factory checked in at 2017-08-31 20:47:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-hopenssl (Old)
and /work/SRC/openSUSE:Factory/.ghc-hopenssl.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-hopenssl"
Thu Aug 31 20:47:37 2017 rev:2 rq:513385 version:2.2.1
Changes:
--------
--- /…
[View More]work/SRC/openSUSE:Factory/ghc-hopenssl/ghc-hopenssl.changes 2017-03-08 00:54:47.265586267 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-hopenssl.new/ghc-hopenssl.changes 2017-08-31 20:47:40.181511032 +0200
@@ -1,0 +2,5 @@
+Thu Jul 27 14:06:59 UTC 2017 - psimons(a)suse.com
+
+- Update to version 2.2.1.
+
+-------------------------------------------------------------------
Old:
----
hopenssl-1.7.tar.gz
New:
----
hopenssl-2.2.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-hopenssl.spec ++++++
--- /var/tmp/diff_new_pack.g5Ttsr/_old 2017-08-31 20:47:41.045389773 +0200
+++ /var/tmp/diff_new_pack.g5Ttsr/_new 2017-08-31 20:47:41.049389211 +0200
@@ -1,7 +1,7 @@
#
# spec file for package ghc-hopenssl
#
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,38 +17,39 @@
%global pkg_name hopenssl
+%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 1.7
+Version: 2.2.1
Release: 0
-Summary: FFI bindings to OpenSSL's EVP digest interface
+Summary: FFI Bindings to OpenSSL's EVP Digest Interface
License: BSD-3-Clause
-Group: System/Libraries
+Group: Development/Languages/Other
Url: https://hackage.haskell.org/package/%{pkg_name}
Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{ve…
BuildRequires: ghc-Cabal-devel
-# Begin cabal-rpm deps:
BuildRequires: ghc-bytestring-devel
-BuildRequires: ghc-mtl-devel
+BuildRequires: ghc-cabal-doctest-devel
BuildRequires: ghc-rpm-macros
BuildRequires: libopenssl-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-# End cabal-rpm deps
+%if %{with tests}
+BuildRequires: ghc-HUnit-devel
+BuildRequires: ghc-doctest-devel
+%endif
%description
-Foreign-function bindings to the OpenSSL library <http://www.openssl.org/>.
+Foreign-function bindings to the <http://www.openssl.org/ OpenSSL library>.
Currently provides access to the messages digests MD5, DSS, DSS1, RIPEMD160,
-and several variants of SHA through the EVP digest interface.
+and various SHA variants through the EVP digest interface.
%package devel
Summary: Haskell %{pkg_name} library development files
Group: Development/Libraries/Other
Requires: %{name} = %{version}-%{release}
Requires: ghc-compiler = %{ghc_version}
-# Begin cabal-rpm deps:
Requires: libopenssl-devel
Requires(post): ghc-compiler = %{ghc_version}
Requires(postun): ghc-compiler = %{ghc_version}
-# End cabal-rpm deps
%description devel
This package provides the Haskell %{pkg_name} library development files.
@@ -56,14 +57,14 @@
%prep
%setup -q -n %{pkg_name}-%{version}
-
%build
%ghc_lib_build
-
%install
%ghc_lib_install
+%check
+%cabal_test
%post devel
%ghc_pkg_recache
++++++ hopenssl-1.7.tar.gz -> hopenssl-2.2.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/OpenSSL/Digest/ByteString/Lazy.hs new/hopenssl-2.2.1/OpenSSL/Digest/ByteString/Lazy.hs
--- old/hopenssl-1.7/OpenSSL/Digest/ByteString/Lazy.hs 2014-12-17 18:25:00.000000000 +0100
+++ new/hopenssl-2.2.1/OpenSSL/Digest/ByteString/Lazy.hs 1970-01-01 01:00:00.000000000 +0100
@@ -1,32 +0,0 @@
-{- |
- Module : OpenSSL.Digest.ByteString.Lazy
- Copyright : (c) 2010 by Peter Simons
- License : BSD3
-
- Maintainer : simons(a)cryp.to
- Stability : provisional
- Portability : portable
-
- Wrappers for "OpenSSL.Digest" that supports lazy 'ByteString'.
- -}
-
-module OpenSSL.Digest.ByteString.Lazy where
-
-import OpenSSL.Digest hiding ( update )
-import Data.Word ( Word8 )
-import Control.Monad.State ( evalStateT )
-import qualified OpenSSL.Digest.ByteString as BS ( update )
-import Data.ByteString.Lazy ( ByteString, toChunks )
-
--- |A convenience wrapper which computes the given digest type of a
--- 'ByteString'. Unlike the monadic interface, this function does not
--- allow the computation to be restarted.
-
-digest :: MessageDigest -> ByteString -> IO [Word8]
-digest mdType xs =
- mkDigest mdType $ evalStateT (update xs >> final)
-
--- |Update the internal state with a block of data.
-
-update :: ByteString -> Digest Int
-update = fmap sum . mapM BS.update . toChunks
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/OpenSSL/Digest/ByteString.hs new/hopenssl-2.2.1/OpenSSL/Digest/ByteString.hs
--- old/hopenssl-1.7/OpenSSL/Digest/ByteString.hs 2014-12-17 18:25:00.000000000 +0100
+++ new/hopenssl-2.2.1/OpenSSL/Digest/ByteString.hs 1970-01-01 01:00:00.000000000 +0100
@@ -1,38 +0,0 @@
-{- |
- Module : OpenSSL.Digest.ByteString
- Copyright : (c) 2010 by Peter Simons
- License : BSD3
-
- Maintainer : simons(a)cryp.to
- Stability : provisional
- Portability : portable
-
- Wrappers for "OpenSSL.Digest" that supports 'ByteString'.
- -}
-
-module OpenSSL.Digest.ByteString where
-
-import OpenSSL.Digest hiding ( update )
-import Control.Monad.State ( evalStateT, lift, get )
-import Foreign.Ptr ( castPtr )
-import Data.Word ( Word8 )
-import Data.ByteString ( ByteString )
-import Data.ByteString.Unsafe ( unsafeUseAsCStringLen )
-
--- |A convenience wrapper which computes the given digest type of a
--- 'ByteString'. Unlike the monadic interface, this function does not
--- allow the computation to be restarted.
-
-digest :: MessageDigest -> ByteString -> IO [Word8]
-digest mdType xs =
- mkDigest mdType $ evalStateT (update xs >> final)
-
--- |Update the internal state with a block of data.
-
-update :: ByteString -> Digest Int
-update bs = do
- DST ctx <- get
- l <- lift $
- unsafeUseAsCStringLen bs $ \(ptr, len) ->
- digestUpdate ctx (castPtr ptr) (fromIntegral len)
- return (fromEnum l)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/OpenSSL/Digest.hs new/hopenssl-2.2.1/OpenSSL/Digest.hs
--- old/hopenssl-1.7/OpenSSL/Digest.hs 2014-12-17 18:25:00.000000000 +0100
+++ new/hopenssl-2.2.1/OpenSSL/Digest.hs 1970-01-01 01:00:00.000000000 +0100
@@ -1,237 +0,0 @@
-{-# LANGUAGE ForeignFunctionInterface #-}
-
-{- |
- Module : OpenSSL.Digest
- Copyright : (c) 2014 by Peter Simons
- License : BSD3
-
- Maintainer : simons(a)cryp.to
- Stability : provisional
- Portability : portable
-
- This module proivdes a high-level API to the message
- digest algorithms found in OpenSSL's @crypto@ library.
- Link with @-lcrypto@ when using this module.
-
- Here is a short example program which runs all available
- digests on a string:
-
- > example :: (Enum a) => [a] -> IO [String]
- > example input = mapM hash [minBound .. maxBound]
- > where
- > hash f = fmap (fmt f) (digest f (toWord input))
- > fmt f = shows f . (": \t"++) . (>>=toHex)
- > toWord = map (toEnum . fromEnum)
-
- And when called, the function prints:
-
- > *Digest> example "open sesame" >>= putStr . unlines
- > Null:
- > MD5: 54ef36ec71201fdf9d1423fd26f97f6b
- > SHA: 2ccefef64c76ac0d42ca1657457977675890c42f
- > SHA1: 5bcaff7f22ff533ca099b3408ead876c0ebba9a7
- > DSS: 5bcaff7f22ff533ca099b3408ead876c0ebba9a7
- > DSS1: 5bcaff7f22ff533ca099b3408ead876c0ebba9a7
- > RIPEMD160: bdb2bba6ec93bd566dc1181cadbc92176aa78382
- > MDC2: 112db2200ce1e9db3c2d132aea4ef7d0
- > SHA224: 1ee0f9d93a873a67fe781852d716cb3e5904e015aafaa4d1ff1a81bc
- > SHA256: 41ef4bb0b23661e66301aac36066912dac037827b4ae63a7b1165a5aa93ed4eb
- > SHA384: ae2a5d6649035c00efe2bc1b5c97f4d5ff97fa2df06f273afa0231c425e8aff30e4cc1db5e5756e8d2245a1514ad1a2d
- > SHA512: 8470cdd3bf1ef85d5f092bce5ae5af97ce50820481bf43b2413807fec37e2785b533a65d4c7d71695b141d81ebcd4b6c4def4284e6067f0b400000001b230205
--}
-
-module OpenSSL.Digest where
-
-import Control.Exception ( bracket )
-import Foreign
-import Foreign.C
-import Control.Monad.State
-import Numeric ( showHex )
-
--- * High-level API
-
--- |The message digest algorithms we support.
-
-data MessageDigest
- = Null -- ^ 0 bit
- | MD5 -- ^ 128 bit
- | SHA -- ^ 160 bit
- | SHA1 -- ^ 160 bit
- | DSS -- ^ other name for SHA1
- | DSS1 -- ^ other name for SHA1
- | RIPEMD160 -- ^ 160 bit
- | MDC2 -- ^ 128 bit
- | SHA224 -- ^ 224 bit
- | SHA256 -- ^ 256 bit
- | SHA384 -- ^ 384 bit
- | SHA512 -- ^ 512 bit
- deriving (Show, Eq, Enum, Bounded)
-
--- |A convenience wrapper which computes the given digest
--- over a list of 'Word8'. Unlike the monadic interface,
--- this function does not allow the computation to be
--- restarted.
-
-digest :: MessageDigest -> [Word8] -> IO [Word8]
-digest mdType xs =
- mkDigest mdType $ evalStateT (update xs >> final)
-
--- |A monadic interface to the digest computation.
-
-type Digest a = StateT DigestState IO a
-
--- |The internal EVP context.
-
-newtype DigestState = DST (Ptr OpaqueContext)
-
--- |Run an 'IO' computation with an initialized
--- 'DigestState'. All resources will be freed when the
--- computation returns.
-
-mkDigest :: MessageDigest -> (DigestState -> IO a) -> IO a
-mkDigest mdType f =
- bracket ctxCreate ctxDestroy $ \ctx -> do
- when (ctx == nullPtr) (fail "Digest.mkDigest: ctxCreate failed")
- md <- toMDEngine mdType
- when (md == nullPtr) (fail ("Digest.mkDigest: can't access "++show mdType))
- rc <- digestInit ctx md
- when (rc == 0) (fail ("Digest.mkDigest: can't initialize "++show mdType))
- f (DST ctx)
-
--- |Update the internal state with a block of data. This
--- function is just a wrapper for 'update'', which creates
--- an array in memory using 'withArray'.
-
-update :: [Word8] -> Digest ()
-update xs = do
- st <- get
- liftIO $
- withArray xs $ \p ->
- evalStateT (update' (p, length xs)) st
-
--- |Update the internal state with a block of data from
--- memory. This is the /faster/ version of 'update'.
-
-update' :: (Ptr Word8, Int) -> Digest ()
-update' (p,n) = do
- DST ctx <- get
- rc <- liftIO $ digestUpdate ctx p (toEnum (fromEnum n))
- when (rc == 0) (fail "Digest.update failed")
-
--- |Wrap up the computation, add padding, do whatever has to
--- be done, and return the final hash. The length of the
--- result depends on the chosen 'MessageDigest'. Do not call
--- more than once!
-
-final :: Digest [Word8]
-final = do
- DST ctx <- get
- liftIO $
- allocaArray maxMDSize $ \p ->
- allocaArray (sizeOf (undefined :: CUInt)) $ \i -> do
- rc <- digestFinal ctx p i
- when (rc == 0) (fail "Digest.Final failed")
- i' <- peek i
- peekArray (fromEnum i') p
-
--- * Low-level API
-
--- |The EVP context used by OpenSSL is opaque for us; we
--- only access it through a 'Ptr'.
-
-data OpaqueContext = OpaqueContext
-type Context = Ptr OpaqueContext
-
--- |The message digest engines are opaque for us as well.
-
-data OpaqueMDEngine = OpaqueMDEngine
-type MDEngine = Ptr OpaqueMDEngine
-
--- |Maximum size of all message digests supported by
--- OpenSSL. Allocate a buffer of this size for 'digestFinal'
--- if you want to stay generic.
-
-maxMDSize :: Int
-maxMDSize = 36
-
--- |Create an EVP context. May be 'nullPtr'.
-
-foreign import ccall unsafe "EVP_MD_CTX_create" ctxCreate ::
- IO Context
-
--- |Initialize an EVP context.
-
-foreign import ccall unsafe "EVP_MD_CTX_init" ctxInit ::
- Context -> IO ()
-
--- |Destroy an EVP context and free the allocated resources.
-
-foreign import ccall unsafe "EVP_MD_CTX_destroy" ctxDestroy ::
- Context -> IO ()
-
--- |Set the message digest engine for 'digestUpdate' calls.
--- Returns @\/=0@ in case of an error.
-
-foreign import ccall unsafe "EVP_DigestInit" digestInit ::
- Context -> MDEngine -> IO CInt
-
--- |Update the internal context with a block of input.
--- Returns @\/=0@ in case of an error.
-
-foreign import ccall unsafe "EVP_DigestUpdate" digestUpdate ::
- Context -> Ptr Word8 -> CUInt -> IO CInt
-
--- |Wrap up the digest computation and return the final
--- digest. Do not call repeatedly on the same context!
--- Returns @\/=0@ in case of an error. The pointer to the
--- unsigned integer may be 'nullPtr'. If it is not,
--- 'digestFinal' will store the length of the computed
--- digest there.
-
-foreign import ccall unsafe "EVP_DigestFinal" digestFinal ::
- Context -> Ptr Word8 -> Ptr CUInt -> IO CInt
-
--- ** Message Digest Engines
-
-foreign import ccall unsafe "EVP_dss" mdDSS :: IO MDEngine
-foreign import ccall unsafe "EVP_dss1" mdDSS1 :: IO MDEngine
-foreign import ccall unsafe "EVP_md5" mdMD5 :: IO MDEngine
-foreign import ccall unsafe "EVP_md_null" mdNull :: IO MDEngine
-foreign import ccall unsafe "EVP_mdc2" mdMDC2 :: IO MDEngine
-foreign import ccall unsafe "EVP_ripemd160" mdRIPEMD160 :: IO MDEngine
-foreign import ccall unsafe "EVP_sha" mdSHA :: IO MDEngine
-foreign import ccall unsafe "EVP_sha1" mdSHA1 :: IO MDEngine
-foreign import ccall unsafe "EVP_sha224" mdSHA224 :: IO MDEngine
-foreign import ccall unsafe "EVP_sha256" mdSHA256 :: IO MDEngine
-foreign import ccall unsafe "EVP_sha384" mdSHA384 :: IO MDEngine
-foreign import ccall unsafe "EVP_sha512" mdSHA512 :: IO MDEngine
-
--- |Map a 'MessageDigest' type into the the corresponding
--- 'MDEngine'.
-
-toMDEngine :: MessageDigest -> IO MDEngine
-toMDEngine Null = mdNull
-toMDEngine MD5 = mdMD5
-toMDEngine SHA = mdSHA
-toMDEngine SHA1 = mdSHA1
-toMDEngine DSS = mdDSS
-toMDEngine DSS1 = mdDSS1
-toMDEngine RIPEMD160 = mdRIPEMD160
-toMDEngine MDC2 = mdMDC2
-toMDEngine SHA224 = mdSHA224
-toMDEngine SHA256 = mdSHA256
-toMDEngine SHA384 = mdSHA384
-toMDEngine SHA512 = mdSHA512
-
--- * Helper Functions
-
--- |Neat helper to print digests with:
--- @
--- \\ws :: [Word8] -> ws >>= toHex
--- @
-
-toHex :: Word8 -> String
-toHex w = case showHex w "" of
- w1:w2:[] -> w1:w2:[]
- w2:[] -> '0':w2:[]
- _ -> error "showHex returned []"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/Setup.hs new/hopenssl-2.2.1/Setup.hs
--- old/hopenssl-1.7/Setup.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/hopenssl-2.2.1/Setup.hs 2017-07-07 13:30:48.000000000 +0200
@@ -0,0 +1,34 @@
+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -Wall #-}
+
+module Main ( main ) where
+
+#ifndef MIN_VERSION_cabal_doctest
+#define MIN_VERSION_cabal_doctest(x,y,z) 0
+#endif
+
+#if MIN_VERSION_cabal_doctest(1,0,0)
+
+import Distribution.Extra.Doctest ( defaultMainWithDoctests )
+main :: IO ()
+main = defaultMainWithDoctests "doctests"
+
+#else
+
+#ifdef MIN_VERSION_Cabal
+-- If the macro is defined, we have new cabal-install,
+-- but for some reason we don't have cabal-doctest in package-db
+--
+-- Probably we are running cabal sdist, when otherwise using new-build
+-- workflow
+#warning You are configuring this package without cabal-doctest installed. \
+ The doctests test-suite will not work as a result. \
+ To fix this, install cabal-doctest before configuring.
+#endif
+
+import Distribution.Simple
+
+main :: IO ()
+main = defaultMain
+
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/Setup.lhs new/hopenssl-2.2.1/Setup.lhs
--- old/hopenssl-1.7/Setup.lhs 2014-12-17 18:25:00.000000000 +0100
+++ new/hopenssl-2.2.1/Setup.lhs 1970-01-01 01:00:00.000000000 +0100
@@ -1,8 +0,0 @@
-#!/usr/bin/env runhaskell
-
-> module Main (main) where
->
-> import Distribution.Simple
->
-> main :: IO ()
-> main = defaultMain
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/hopenssl.cabal new/hopenssl-2.2.1/hopenssl.cabal
--- old/hopenssl-1.7/hopenssl.cabal 2014-12-17 18:25:00.000000000 +0100
+++ new/hopenssl-2.2.1/hopenssl.cabal 2017-07-07 13:30:48.000000000 +0200
@@ -1,31 +1,68 @@
-Name: hopenssl
-Version: 1.7
-Copyright: (c) 2004-2013 Peter Simons
-License: BSD3
-License-File: LICENSE
-Author: Peter Simons <simons(a)cryp.to>,
- Jesper Louis Andersen <jesper.louis.andersen(a)gmail.com>,
- Markus Rothe <markus(a)unixforces.net>
-Maintainer: Peter Simons <simons(a)cryp.to>
-Homepage: http://github.com/peti/hopenssl
-Category: Foreign, Cryptography
-Synopsis: FFI bindings to OpenSSL's EVP digest interface
-Description: Foreign-function bindings to the OpenSSL library
- <http://www.openssl.org/>. Currently provides
- access to the messages digests MD5, DSS, DSS1,
- RIPEMD160, and several variants of SHA through
- the EVP digest interface.
-Cabal-Version: >= 1.6
-Build-Type: Simple
-Tested-With: GHC >= 6.10.4 && <= 7.8.3
-
-Source-Repository head
- Type: git
- Location: git://github.com/peti/hopenssl.git
-
-Library
- Build-Depends: base >= 3 && < 5, mtl, bytestring
- Extensions: ForeignFunctionInterface
- Extra-Libraries: crypto
- Includes: "openssl/evp.h"
- Exposed-Modules: OpenSSL.Digest, OpenSSL.Digest.ByteString, OpenSSL.Digest.ByteString.Lazy
+name: hopenssl
+version: 2.2.1
+copyright: (c) 2004-2017 Peter Simons
+license: BSD3
+license-file: LICENSE
+author: Peter Simons, Markus Rothe
+maintainer: Peter Simons <simons(a)cryp.to>
+homepage: http://github.com/peti/hopenssl
+category: Foreign, Cryptography
+synopsis: FFI Bindings to OpenSSL's EVP Digest Interface
+description: Foreign-function bindings to the
+ <http://www.openssl.org/ OpenSSL library>. Currently
+ provides access to the messages digests MD5, DSS, DSS1,
+ RIPEMD160, and various SHA variants through the EVP
+ digest interface.
+cabal-version: >= 1.8
+build-type: Custom
+tested-with: GHC > 7.6 && < 8.1
+
+custom-setup
+ setup-depends:
+ base >= 4 && <5,
+ Cabal,
+ cabal-doctest >= 1 && <1.1
+
+source-repository head
+ type: git
+ location: git://github.com/peti/hopenssl.git
+
+library
+ build-depends: base >= 4.6 && < 5, bytestring
+ hs-source-dirs: src
+ other-extensions: CPP, DeriveDataTypeable, EmptyDataDecls, FlexibleInstances,
+ ForeignFunctionInterface, TypeSynonymInstances
+ extra-libraries: crypto
+ includes: "openssl/evp.h"
+ exposed-modules: OpenSSL.Digest
+ OpenSSL.Util
+ OpenSSL.EVP.Digest
+ OpenSSL.EVP.Digest.Algorithm
+ OpenSSL.EVP.Digest.Digest
+ OpenSSL.EVP.Digest.Context
+ OpenSSL.EVP.Digest.Error
+ OpenSSL.EVP.Digest.Initialization
+ build-tools: hsc2hs
+
+test-suite check-low-level-digest-api
+ type: exitcode-stdio-1.0
+ main-is: CheckLowLevelDigestAPI.hs
+ other-modules: OpenSesame
+ hs-source-dirs: test
+ build-depends: base >= 3 && < 5, hopenssl, HUnit
+ ghc-options: -threaded
+
+test-suite check-high-level-digest-api
+ type: exitcode-stdio-1.0
+ main-is: CheckHighLevelDigestAPI.hs
+ other-modules: OpenSesame
+ hs-source-dirs: test
+ build-depends: base >= 3 && < 5, hopenssl, HUnit
+ ghc-options: -threaded
+
+test-suite doctests
+ type: exitcode-stdio-1.0
+ main-is: doctests.hs
+ hs-source-dirs: test
+ build-depends: base, hopenssl, doctest
+ ghc-options: -threaded
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/src/OpenSSL/Digest.hs new/hopenssl-2.2.1/src/OpenSSL/Digest.hs
--- old/hopenssl-1.7/src/OpenSSL/Digest.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/hopenssl-2.2.1/src/OpenSSL/Digest.hs 2017-07-07 13:30:48.000000000 +0200
@@ -0,0 +1,196 @@
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE TypeSynonymInstances #-}
+
+{- |
+ Maintainer: simons(a)cryp.to
+ Stability: provisional
+ Portability: portable
+
+ This module provides a generic high-level API to the message digest
+ algorithms found in OpenSSL's @crypto@ library. There are two functions of
+ particular interest: 'digestByName' and 'digest'. The former can be used to
+ retrieve an 'Algorithm', i.e. an OpenSSL object that implements a particular
+ algorithm. That type can then be used to compute actual message digests with
+ the latter function:
+
+ >>> import Data.ByteString.Char8 ( pack )
+ >>> digest (digestByName "md5") (pack "Hello, world.")
+ "\b\n\239\131\155\149\250\207s\236Y\147u\233-G"
+
+ Neat pretty-printing can be achieved with 'toHex', which converts the binary
+ representation of a message digest into the common hexadecimal one:
+
+ >>> toHex $ digest (digestByName "md5") (pack "Hello, world.")
+ "080aef839b95facf73ec599375e92d47"
+ >>> toHex $ digest (digestByName "sha1") (pack "Hello, world.")
+ "2ae01472317d1935a84797ec1983ae243fc6aa28"
+
+ The precise set of available digest algorithms provided by OpenSSL depends
+ on the version of the library installed into the system, obviously, but it's
+ reasonable to expect the following algorithms to be present: MD5, RIPEMD160,
+ SHA1, SHA224, SHA256, SHA384, and SHA512. If an algorithm is not available,
+ 'digestByName' will throw an 'DigestAlgorithmNotAvailableInOpenSSL'
+ exception. If you don't like exceptions, use the tamer 'digestByName''
+ variant:
+
+ >>> digestByName' "i bet this algorithm won't exist"
+ Nothing
+
+ 'Algorithm' is an instance of 'IsString', so with the proper GHC extensions
+ enabled it's possible to simplify the call to 'digest' even further:
+
+ >>> :set -XOverloadedStrings
+ >>> toHex $ digest "sha256" (pack "The 'Through the Universe' podcast rules.")
+ "73624694a9435095c8fdaad711273a23c02226196c452f817cfd86f965895614"
+
+ Last but not least, 'digest' is actually a class method of 'Digestable',
+ which collects things we can compute digests of. The defaults are
+ conservative, i.e. we support all things that correspond roughly to C's
+ construct of "void pointer plus a length". @digest@ can use with any of the
+ following signatures:
+
+ >>> let shape1 = digest :: Algorithm -> (Ptr (), CSize) -> MessageDigest
+ >>> let shape2 = digest :: Algorithm -> (Ptr Word8, CSize) -> MessageDigest
+ >>> let shape3 = digest :: Algorithm -> (Ptr Word8, CUInt) -> MessageDigest
+ >>> let shape4 = digest :: Algorithm -> (Ptr (), Int) -> MessageDigest
+ >>> let shape5 = digest :: Algorithm -> StrictByteString -> MessageDigest
+ >>> let shape6 = digest :: Algorithm -> LazyByteString -> MessageDigest
+
+ 'StrictByteString' and 'LazyByteString' are also instances of 'IsString' and
+ therefore subject to implicit construction from string literals:
+
+ >>> shape5 "sha256" "hello" == shape6 "sha256" "hello"
+ True
+
+ Note that this code offers no overloaded 'digest' version for 'String',
+ because that function would produce non-deterministic results for Unicode
+ characters. There is an instance for @[Word8]@, though, so strings can be
+ hashed after a proper encoding has been applied. For those who don't care
+ about determinism, there is the following specialized function:
+
+ >>> toHex $ digestString "md5" "no Digestable instance for this sucker"
+ "a74827f849005794565f83fbd68ad189"
+
+ If you don't mind orphaned instances, however, feel free to shoot yourself
+ in the foot:
+
+ >>> :set -XFlexibleInstances
+ >>> instance Digestable String where updateChunk ctx str = withCStringLen str (updateChunk ctx)
+ >>> toHex $ digest "sha256" ("now we can hash strings" :: String)
+ "7f2989f173125810aa917c4ffe0e26ae1b5f7fb852274829c210297a43dfc7f9"
+-}
+
+module OpenSSL.Digest
+ ( -- * Generic digest API
+ MessageDigest, digest, Digestable(..), digestByName, digestByName', Algorithm
+ , -- * Special instances
+ digestString
+ , -- * Helper Types and Functions
+ toHex, StrictByteString, LazyByteString
+ )
+ where
+
+import OpenSSL.EVP.Digest
+import qualified OpenSSL.Util as Util
+
+import Control.Exception
+import qualified Data.ByteString as Strict ( ByteString, packCStringLen, concatMap )
+import Data.ByteString.Char8 as Strict8 ( pack )
+import qualified Data.ByteString.Lazy as Lazy ( ByteString, toChunks )
+import Data.ByteString.Unsafe ( unsafeUseAsCStringLen )
+import Foreign
+import Foreign.C
+import System.IO.Unsafe as IO
+
+-- Generic Class API ----------------------------------------------------------
+
+-- | A message digest is essentially an array of 'Word8' octets.
+
+type MessageDigest = StrictByteString
+
+-- | Compute the given message digest of any 'Digestable' thing, i.e. any type
+-- that can be converted /efficiently/ and /unambiguously/ into a continuous
+-- memory buffer or a sequence of continuous memory buffers. Note that 'String'
+-- does /not/ have that property, because the binary representation chosen for
+-- Unicode characters during the marshaling process is determined by the
+-- system's locale and is therefore non-deterministic.
+
+digest :: Digestable a => Algorithm -> a -> MessageDigest
+digest algo input =
+ IO.unsafePerformIO $
+ bracket newContext freeContext $ \ctx -> do
+ initDigest algo ctx
+ updateChunk ctx input
+ let mdSize = fromIntegral (digestSize algo)
+ allocaArray mdSize $ \md -> do
+ finalizeDigest ctx md
+ Strict.packCStringLen (castPtr md, mdSize)
+
+-- | A class of things that can be part of a digest computations. By default,
+-- we define instances only for various representations of plain memory
+-- buffers, but in theory that class can be extended to contain all kinds of
+-- complex data types.
+
+class Digestable a where
+ updateChunk :: Context -> a -> IO ()
+
+instance Digestable (Ptr a, CSize) where
+ {-# INLINE updateChunk #-}
+ updateChunk ctx = uncurry (updateDigest ctx)
+
+instance Digestable (Ptr a, CUInt) where
+ {-# INLINE updateChunk #-}
+ updateChunk ctx = updateChunk ctx . fmap (fromIntegral :: CUInt -> CSize)
+
+instance Digestable (Ptr a, CInt) where
+ {-# INLINE updateChunk #-}
+ updateChunk ctx = updateChunk ctx . fmap (fromIntegral :: CInt -> CSize)
+
+instance Digestable (Ptr a, Int) where
+ {-# INLINE updateChunk #-}
+ updateChunk ctx = updateChunk ctx . fmap (fromIntegral :: Int -> CSize)
+
+instance Digestable [Word8] where
+ {-# INLINE updateChunk #-}
+ updateChunk ctx buf = withArrayLen buf $ \len ptr -> updateChunk ctx (ptr,len)
+
+instance Digestable StrictByteString where
+ {-# INLINE updateChunk #-}
+ updateChunk ctx str = unsafeUseAsCStringLen str (updateChunk ctx)
+
+instance Digestable LazyByteString where
+ {-# INLINE updateChunk #-}
+ updateChunk ctx = mapM_ (updateChunk ctx) . Lazy.toChunks
+
+-- |We do /not/ define a 'Digestable' instance for 'String', because there is
+-- no one obviously correct way to encode Unicode characters for purposes of
+-- calculating a digest. We have, however, this specialized function which
+-- computes a digest over a @String@ by means of 'withCStrinLen'. This means
+-- that the representation of Unicode characters depends on the process locale
+-- a.k.a. it's non-deterministc!
+--
+-- >>> toHex $ digestString (digestByName "sha1") "Hello, world."
+-- "2ae01472317d1935a84797ec1983ae243fc6aa28"
+
+digestString :: Algorithm -> String -> MessageDigest
+digestString algo str = IO.unsafePerformIO $
+ withCStringLen str (return . digest algo)
+
+-- Helper functions -----------------------------------------------------------
+
+-- | Synonym for the strict 'Strict.ByteString' variant to improve readability.
+
+type StrictByteString = Strict.ByteString
+
+-- | Synonym for the lazy 'Lazy.ByteString' variant to improve readability.
+
+type LazyByteString = Lazy.ByteString
+
+-- | Pretty-print a given message digest from binary into hexadecimal
+-- representation.
+--
+-- >>> toHex (Data.ByteString.pack [0..15])
+-- "000102030405060708090a0b0c0d0e0f"
+
+toHex :: MessageDigest -> StrictByteString
+toHex = Strict.concatMap (pack . Util.toHex)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/src/OpenSSL/EVP/Digest/Algorithm.hsc new/hopenssl-2.2.1/src/OpenSSL/EVP/Digest/Algorithm.hsc
--- old/hopenssl-1.7/src/OpenSSL/EVP/Digest/Algorithm.hsc 1970-01-01 01:00:00.000000000 +0100
+++ new/hopenssl-2.2.1/src/OpenSSL/EVP/Digest/Algorithm.hsc 2017-07-07 13:30:48.000000000 +0200
@@ -0,0 +1,100 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+{- |
+ Maintainer: simons(a)cryp.to
+ Stability: provisional
+ Portability: portable
+
+ Low-level bindings to OpenSSL's EVP interface. Most users do not need this
+ code. Check out "OpenSSL.Digest" for a more comfortable interface.
+-}
+
+module OpenSSL.EVP.Digest.Algorithm where
+
+import OpenSSL.EVP.Digest.Initialization
+import OpenSSL.EVP.Digest.Error ( UnknownAlgorithm(..) )
+
+import Control.Exception
+import Data.Maybe
+import Data.String ( IsString(..) )
+import Foreign
+import Foreign.C
+import System.IO.Unsafe as IO
+
+#include "openssl/opensslv.h"
+#include "openssl/evp.h"
+
+-- | An opaque handle into OpenSSL's collection of message digest algorithms.
+-- Use 'digestByName' to look up any of the available algorithms by name. For
+-- the sake of convenience, 'Algorithm' is an instance of 'IsString' so
+-- that the compiler can transparently map 'String' literals to algorithms via
+-- 'fromString' if the @XOverloadedStrings@ extension is enabled.
+--
+-- >>> fromString "sha256" == digestByName "sha256"
+-- True
+
+newtype Algorithm = Algorithm (Ptr ())
+ deriving (Show, Eq)
+
+instance IsString Algorithm where
+ fromString = digestByName
+
+-- | Look up a digest algorithm engine by name. Algorithms usually offered by
+-- OpenSSL are "md2", "md5", "sha1", "mdc2", "ripemd160", "blake2b512",
+-- "blake2s256", "sha224", "sha256", "sha384", and "sha512", but the exact set
+-- may vary between platforms. Throws 'UnknownAlgorithm' if the requested
+-- algorithm is not known.
+
+digestByName :: String -> Algorithm
+digestByName algo =
+ fromMaybe (throw (UnknownAlgorithm algo)) (digestByName' algo)
+
+-- | Variant of 'digestByName' that signals failure by evaluating to 'Nothing'
+-- rather than failing.
+--
+-- >>> digestByName' "sha256" == Just (digestByName "sha256")
+-- True
+-- >>> digestByName' "Guess what?" :: Maybe Algorithm
+-- Nothing
+
+digestByName' :: String -> Maybe Algorithm
+digestByName' algo = do
+ let Algorithm p = IO.unsafePerformIO $ do
+ initializeEVPDigests
+ withCString algo (return . _digestByName)
+ if p == nullPtr then Nothing else Just (Algorithm p)
+
+-- | Return the size of the digest in bytes that the given algorithm will produce.
+--
+-- >>> digestSize (digestByName "sha256")
+-- 32
+
+digestSize :: Algorithm -> Int
+digestSize = fromIntegral . _digestSize
+
+-- | The largest possible digest size of any of the algorithms supported by
+-- this library will generate. So if you want to store a digest without
+-- bothering to retrieve the appropriate size with 'digestSize' first, allocate
+-- a buffer of that size.
+
+maxDigestSize :: Int
+maxDigestSize = #{const EVP_MAX_MD_SIZE}
+
+-- | Return the block size the the given algorithm operates with.
+--
+-- >>> digestBlockSize (digestByName "sha256")
+-- 64
+
+digestBlockSize :: Algorithm -> Int
+digestBlockSize = fromIntegral . _digestBlockSize
+
+-------------------------------------------------------------------------------
+
+foreign import ccall unsafe "openssl/evp.h EVP_get_digestbyname"
+ _digestByName :: CString -> Algorithm
+
+foreign import ccall unsafe "openssl/evp.h EVP_MD_size"
+ _digestSize :: Algorithm -> CInt
+
+foreign import ccall unsafe "openssl/evp.h EVP_MD_block_size"
+ _digestBlockSize :: Algorithm -> CInt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/src/OpenSSL/EVP/Digest/Context.hs new/hopenssl-2.2.1/src/OpenSSL/EVP/Digest/Context.hs
--- old/hopenssl-1.7/src/OpenSSL/EVP/Digest/Context.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/hopenssl-2.2.1/src/OpenSSL/EVP/Digest/Context.hs 2017-07-07 13:30:48.000000000 +0200
@@ -0,0 +1,68 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE CPP #-}
+
+{- |
+ Maintainer: simons(a)cryp.to
+ Stability: provisional
+ Portability: portable
+
+ Low-level bindings to OpenSSL's EVP interface. Most users do not need this
+ code. Check out "OpenSSL.Digest" for a more comfortable interface.
+-}
+
+module OpenSSL.EVP.Digest.Context where
+
+import OpenSSL.EVP.Digest.Error ( throwIfZero )
+
+import Control.Monad
+import Foreign
+import Foreign.C
+
+#include "openssl/opensslv.h"
+
+-- | A context for digest computations. Use 'newContext' and 'freeContext' to
+-- allocate/deallocate this type.
+
+newtype Context = Context (Ptr ())
+ deriving (Show, Eq)
+
+-- | Allocate and initialize an 'Context' for use in a digest computation
+-- on the heap. Release its underlying memory after use with 'freeContext'.
+
+newContext :: IO Context
+newContext = do ctx@(Context p) <- _newContext
+ when (p == nullPtr) (fail "OpenSSL.EVP.Digest.Context.newContext failed")
+ return ctx
+
+foreign import ccall unsafe
+#if OPENSSL_VERSION_NUMBER < 0x1010000f
+ "openssl/evp.h EVP_MD_CTX_create"
+#else
+ "openssl/evp.h EVP_MD_CTX_new"
+#endif
+ _newContext :: IO Context
+
+-- | Release all resources associated with a digest computation.
+
+foreign import ccall unsafe
+#if OPENSSL_VERSION_NUMBER < 0x1010000f
+ "openssl/evp.h EVP_MD_CTX_destroy"
+#else
+ "openssl/evp.h EVP_MD_CTX_free"
+#endif
+ freeContext :: Context -> IO ()
+
+-- | Free all resources associated with this 'Context', but don't destroy the
+-- context itself so that it can be re-used for a new digest computation.
+
+resetDigest :: Context -> IO ()
+resetDigest ctx =
+ throwIfZero "OpenSSL.EVP.Digest.resetDigest" (_resetContext ctx)
+
+foreign import ccall unsafe
+#if OPENSSL_VERSION_NUMBER < 0x1010000f
+ "openssl/evp.h EVP_MD_CTX_cleanup"
+#else
+ "openssl/evp.h EVP_MD_CTX_reset"
+#endif
+ _resetContext :: Context -> IO CInt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/src/OpenSSL/EVP/Digest/Digest.hs new/hopenssl-2.2.1/src/OpenSSL/EVP/Digest/Digest.hs
--- old/hopenssl-1.7/src/OpenSSL/EVP/Digest/Digest.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/hopenssl-2.2.1/src/OpenSSL/EVP/Digest/Digest.hs 2017-07-07 13:30:48.000000000 +0200
@@ -0,0 +1,67 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE EmptyDataDecls #-}
+
+{- |
+ Maintainer: simons(a)cryp.to
+ Stability: provisional
+ Portability: portable
+
+ Low-level bindings to OpenSSL's EVP interface. Most users do not need this
+ code. Check out "OpenSSL.Digest" for a more comfortable interface.
+-}
+
+module OpenSSL.EVP.Digest.Digest where
+
+import OpenSSL.EVP.Digest.Algorithm
+import OpenSSL.EVP.Digest.Context
+import OpenSSL.EVP.Digest.Error ( throwIfZero )
+
+import Foreign
+import Foreign.C
+
+-- | Configure the given digest context to use the given message digest
+-- algorithm. Throws an exception to signal failure, i.e. because the system is
+-- out of memory.
+
+initDigest :: Algorithm -> Context -> IO ()
+initDigest algo ctx =
+ throwIfZero "OpenSSL.EVP.Digest.initDigest" (_initDigest ctx algo nullPtr)
+
+-- | Hash the given block of memory and update the digest state accordingly.
+-- This function can be called many times. Then use 'finalizeDigest' to
+-- retrieve the actual hash value.
+
+updateDigest :: Context -> Ptr a -> CSize -> IO ()
+updateDigest ctx ptr len =
+ throwIfZero "OpenSSL.EVP.Digest.updateDigest" (_updateDigest ctx ptr len)
+
+-- | Finalize the digest calculation and return the result in the 'Word8' array
+-- passed as an argument. Naturally, that array is expected to be large enough
+-- to contain the digest. 'digestSize' or 'maxDigestSize' are your friends.
+-- This function does /not/ clean up the digest context; this has to be done
+-- with an explicit call to 'freeContext' (or 'resetContext', if you want to
+-- re-use it). However, it does invalidate the digest state so that no further
+-- calls of 'digestUpdate' can be made without re-initializing the context
+-- first.
+
+finalizeDigest :: Context -> Ptr Word8 -> IO ()
+finalizeDigest ctx ptr =
+ throwIfZero "OpenSSL.EVP.Digest.finalizeDigest" (_finalizeDigest ctx ptr nullPtr)
+
+-------------------------------------------------------------------------------
+
+-- | We don't support choosing a custom engine to implement the given
+-- algorithm. This type is just a place holder, and we always pass 'nullPtr'
+-- whereever it is required to let OpenSSL choose whatever engine it thinks is
+-- best.
+
+data OpaqueEngine
+
+foreign import ccall unsafe "openssl/evp.h EVP_DigestInit_ex"
+ _initDigest :: Context -> Algorithm -> Ptr OpaqueEngine -> IO CInt
+
+foreign import ccall unsafe "openssl/evp.h EVP_DigestUpdate"
+ _updateDigest :: Context -> Ptr a -> CSize -> IO CInt
+
+foreign import ccall unsafe "openssl/evp.h EVP_DigestFinal_ex"
+ _finalizeDigest :: Context -> Ptr Word8 -> Ptr CUInt -> IO CInt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/src/OpenSSL/EVP/Digest/Error.hs new/hopenssl-2.2.1/src/OpenSSL/EVP/Digest/Error.hs
--- old/hopenssl-1.7/src/OpenSSL/EVP/Digest/Error.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/hopenssl-2.2.1/src/OpenSSL/EVP/Digest/Error.hs 2017-07-07 13:30:48.000000000 +0200
@@ -0,0 +1,33 @@
+{-# LANGUAGE DeriveDataTypeable #-}
+
+{- |
+ Maintainer: simons(a)cryp.to
+ Stability: provisional
+ Portability: portable
+
+ Low-level bindings to OpenSSL's EVP interface. Most users do not need this
+ code. Check out "OpenSSL.Digest" for a more comfortable interface.
+-}
+
+module OpenSSL.EVP.Digest.Error where
+
+import Control.Exception
+import Data.Typeable ( Typeable )
+import Foreign
+import Foreign.C
+
+-- | Most OpenSSL functions return an approximation of @Bool@ to signify
+-- failure. This wrapper makes it easier to move the error handling to the
+-- exception layer where appropriate.
+
+throwIfZero :: String -> IO CInt -> IO ()
+throwIfZero fname =
+ throwIf_ (==0) (const (showString fname " failed with error code 0"))
+
+-- | A custom exception type which is thrown by 'digestByName' in case the
+-- requested digest algorithm is not available in the OpenSSL system library.
+
+newtype UnknownAlgorithm = UnknownAlgorithm String
+ deriving (Show, Typeable)
+
+instance Exception UnknownAlgorithm
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/src/OpenSSL/EVP/Digest/Initialization.hs new/hopenssl-2.2.1/src/OpenSSL/EVP/Digest/Initialization.hs
--- old/hopenssl-1.7/src/OpenSSL/EVP/Digest/Initialization.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/hopenssl-2.2.1/src/OpenSSL/EVP/Digest/Initialization.hs 2017-07-07 13:30:48.000000000 +0200
@@ -0,0 +1,41 @@
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+{- |
+ Maintainer: simons(a)cryp.to
+ Stability: provisional
+ Portability: portable
+
+ Low-level bindings to OpenSSL's EVP interface. Most users do not need this
+ code. Check out "OpenSSL.Digest" for a more comfortable interface.
+-}
+
+module OpenSSL.EVP.Digest.Initialization ( initializeEVPDigests ) where
+
+import Control.Concurrent.MVar
+import Control.Monad
+import System.IO.Unsafe as IO
+
+#include "openssl/opensslv.h"
+
+-- | Initialize the OpenSSL EVP engine and register all known digest types in
+-- the internal data structures. This function must be called before any of the
+-- message digest functions can succeed. This is generally handled
+-- transparently by the Haskell implementation and users do not need to worry
+-- about this.
+
+initializeEVPDigests :: IO ()
+initializeEVPDigests =
+#if OPENSSL_VERSION_NUMBER >= 0x1010000f
+ return ()
+#else
+ modifyMVar_ isDigestEngineInitialized $ \isInitialized ->
+ unless isInitialized _addAllDigests >> return True
+
+{-# NOINLINE isDigestEngineInitialized #-}
+isDigestEngineInitialized :: MVar Bool
+isDigestEngineInitialized = IO.unsafePerformIO $ newMVar False
+
+foreign import ccall unsafe "openssl/evp.h OpenSSL_add_all_digests" _addAllDigests :: IO ()
+
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/src/OpenSSL/EVP/Digest.hs new/hopenssl-2.2.1/src/OpenSSL/EVP/Digest.hs
--- old/hopenssl-1.7/src/OpenSSL/EVP/Digest.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/hopenssl-2.2.1/src/OpenSSL/EVP/Digest.hs 2017-07-07 13:30:48.000000000 +0200
@@ -0,0 +1,26 @@
+{- |
+ Maintainer: simons(a)cryp.to
+ Stability: provisional
+ Portability: portable
+
+ Low-level bindings to OpenSSL's EVP interface. Most users do not need this
+ code. Check out "OpenSSL.Digest" for a more comfortable interface.
+-}
+
+module OpenSSL.EVP.Digest
+ (
+ -- * Digest Algorithms
+ Algorithm
+ , digestByName, digestByName', digestSize, maxDigestSize, digestBlockSize
+ , UnknownAlgorithm
+ , -- * Digest Contexts
+ Context, newContext, freeContext, resetDigest
+ , -- * Digest Computations
+ initDigest, updateDigest, finalizeDigest
+ )
+ where
+
+import OpenSSL.EVP.Digest.Algorithm
+import OpenSSL.EVP.Digest.Context
+import OpenSSL.EVP.Digest.Digest
+import OpenSSL.EVP.Digest.Error
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/src/OpenSSL/Util.hs new/hopenssl-2.2.1/src/OpenSSL/Util.hs
--- old/hopenssl-1.7/src/OpenSSL/Util.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/hopenssl-2.2.1/src/OpenSSL/Util.hs 2017-07-07 13:30:48.000000000 +0200
@@ -0,0 +1,24 @@
+{- |
+ Maintainer: simons(a)cryp.to
+ Stability: provisional
+ Portability: portable
+
+ Random collection of utility functions that may be useful, but which aren't
+ useful enough to be included in the main API modules.
+-}
+
+module OpenSSL.Util where
+
+import Data.Word
+import Numeric
+
+-- |Neat helper to pretty-print digests into the common hexadecimal notation:
+--
+-- >>> [0..15] >>= toHex
+-- "000102030405060708090a0b0c0d0e0f"
+
+toHex :: Word8 -> String
+toHex w = case showHex w "" of
+ [w1,w2] -> [w1, w2]
+ [w2] -> ['0', w2]
+ _ -> "showHex returned []"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/test/CheckHighLevelDigestAPI.hs new/hopenssl-2.2.1/test/CheckHighLevelDigestAPI.hs
--- old/hopenssl-1.7/test/CheckHighLevelDigestAPI.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/hopenssl-2.2.1/test/CheckHighLevelDigestAPI.hs 2017-07-07 13:30:48.000000000 +0200
@@ -0,0 +1,18 @@
+module Main ( main ) where
+
+import OpenSSL.Digest
+import OpenSesame
+
+import Test.HUnit
+
+main :: IO ()
+main = runTestTT (TestList tests) >> return ()
+
+tests :: [Test]
+tests = map (uncurry (mkTest "open sesame")) opensesame
+
+mkTest :: String -> String -> String -> Test
+mkTest input algoName expect = TestCase $
+ case digestByName' algoName of
+ Nothing -> return ()
+ Just algo -> assertEqual algoName expect (show (toHex (digestString algo input)))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/test/CheckLowLevelDigestAPI.hs new/hopenssl-2.2.1/test/CheckLowLevelDigestAPI.hs
--- old/hopenssl-1.7/test/CheckLowLevelDigestAPI.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/hopenssl-2.2.1/test/CheckLowLevelDigestAPI.hs 2017-07-07 13:30:48.000000000 +0200
@@ -0,0 +1,34 @@
+module Main ( main ) where
+
+import OpenSesame
+
+import OpenSSL.EVP.Digest
+import OpenSSL.Util
+
+import Control.Exception
+import Foreign
+import Foreign.C.String
+import Test.HUnit
+
+main :: IO ()
+main = runTestTT (TestList tests) >> return ()
+
+tests :: [Test]
+tests = map (uncurry (mkTest "open sesame")) opensesame
+
+mkTest :: String -> String -> String -> Test
+mkTest input algoName expect = TestCase $
+ case digestByName' algoName of
+ Nothing -> return ()
+ Just algo -> digest algo input >>= assertEqual algoName expect
+
+digest :: Algorithm -> String -> IO String
+digest algo input = do
+ let mdSize = digestSize algo
+ md <- bracket newContext freeContext $ \ctx -> do
+ initDigest algo ctx
+ withCStringLen input $ \(ptr,len) -> updateDigest ctx ptr (fromIntegral len)
+ allocaArray mdSize $ \md -> do
+ finalizeDigest ctx md
+ peekArray mdSize md
+ return (md >>= toHex)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/test/OpenSesame.hs new/hopenssl-2.2.1/test/OpenSesame.hs
--- old/hopenssl-1.7/test/OpenSesame.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/hopenssl-2.2.1/test/OpenSesame.hs 2017-07-07 13:30:48.000000000 +0200
@@ -0,0 +1,15 @@
+module OpenSesame where
+
+opensesame :: [(String, String)]
+opensesame = [ ("MD5", "54ef36ec71201fdf9d1423fd26f97f6b")
+ , ("SHA", "2ccefef64c76ac0d42ca1657457977675890c42f")
+ , ("SHA1", "5bcaff7f22ff533ca099b3408ead876c0ebba9a7")
+ , ("DSS", "5bcaff7f22ff533ca099b3408ead876c0ebba9a7")
+ , ("DSS1", "5bcaff7f22ff533ca099b3408ead876c0ebba9a7")
+ , ("RIPEMD160", "bdb2bba6ec93bd566dc1181cadbc92176aa78382")
+ , ("MDC2", "112db2200ce1e9db3c2d132aea4ef7d0")
+ , ("SHA224", "1ee0f9d93a873a67fe781852d716cb3e5904e015aafaa4d1ff1a81bc")
+ , ("SHA256", "41ef4bb0b23661e66301aac36066912dac037827b4ae63a7b1165a5aa93ed4eb")
+ , ("SHA384", "ae2a5d6649035c00efe2bc1b5c97f4d5ff97fa2df06f273afa0231c425e8aff30e4cc1db5e5756e8d2245a1514ad1a2d")
+ , ("SHA512", "8470cdd3bf1ef85d5f092bce5ae5af97ce50820481bf43b2413807fec37e2785b533a65d4c7d71695b141d81ebcd4b6c4def4284e6067f0b9ddc318b1b230205")
+ ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hopenssl-1.7/test/doctests.hs new/hopenssl-2.2.1/test/doctests.hs
--- old/hopenssl-1.7/test/doctests.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/hopenssl-2.2.1/test/doctests.hs 2017-07-07 13:30:48.000000000 +0200
@@ -0,0 +1,10 @@
+module Main where
+
+import Build_doctests (flags, pkgs, module_sources)
+import Data.Foldable (traverse_)
+import Test.DocTest (doctest)
+
+main :: IO ()
+main = do let args = flags ++ pkgs ++ module_sources
+ traverse_ putStrLn args -- optionally print arguments
+ doctest args
[View Less]
1
0
Hello community,
here is the log from the commit of package ghc-hoauth2 for openSUSE:Factory checked in at 2017-08-31 20:47:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-hoauth2 (Old)
and /work/SRC/openSUSE:Factory/.ghc-hoauth2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-hoauth2"
Thu Aug 31 20:47:36 2017 rev:3 rq:513384 version:1.3.0
Changes:
--------
--- /work/…
[View More]SRC/openSUSE:Factory/ghc-hoauth2/ghc-hoauth2.changes 2017-03-24 02:14:52.281650628 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-hoauth2.new/ghc-hoauth2.changes 2017-08-31 20:47:36.486029750 +0200
@@ -1,0 +2,5 @@
+Thu Jul 27 14:06:02 UTC 2017 - psimons(a)suse.com
+
+- Update to version 1.3.0.
+
+-------------------------------------------------------------------
Old:
----
hoauth2-0.5.7.tar.gz
New:
----
hoauth2-1.3.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-hoauth2.spec ++++++
--- /var/tmp/diff_new_pack.vDUTlf/_old 2017-08-31 20:47:37.505886598 +0200
+++ /var/tmp/diff_new_pack.vDUTlf/_new 2017-08-31 20:47:37.509886036 +0200
@@ -18,7 +18,7 @@
%global pkg_name hoauth2
Name: ghc-%{pkg_name}
-Version: 0.5.7
+Version: 1.3.0
Release: 0
Summary: Haskell OAuth2 authentication client
License: BSD-3-Clause
@@ -28,17 +28,21 @@
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-aeson-devel
BuildRequires: ghc-bytestring-devel
+BuildRequires: ghc-exceptions-devel
BuildRequires: ghc-http-conduit-devel
BuildRequires: ghc-http-types-devel
+BuildRequires: ghc-microlens-devel
BuildRequires: ghc-rpm-macros
BuildRequires: ghc-text-devel
BuildRequires: ghc-unordered-containers-devel
+BuildRequires: ghc-uri-bytestring-aeson-devel
+BuildRequires: ghc-uri-bytestring-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Haskell OAuth2 authentication client. Tested with the following services:
-* Google web: <https://developers.google.com/accounts/docs/OAuth2WebServer>
+* Google: <https://developers.google.com/accounts/docs/OAuth2WebServer>
* Github: <http://developer.github.com/v3/oauth/>
@@ -46,6 +50,10 @@
* Fitbit: <http://dev.fitbit.com/docs/oauth2/>
+* StackExchange: <https://api.stackexchange.com/docs/authentication>
+
+* DropBox: <https://www.dropbox.com/developers/reference/oauth-guide>
+
* Weibo: <http://open.weibo.com/wiki/Oauth2>
* Douban: <http://developers.douban.com/wiki/?title=oauth2>.
++++++ hoauth2-0.5.7.tar.gz -> hoauth2-1.3.0.tar.gz ++++++
++++ 1734 lines of diff (skipped)
[View Less]
1
0
Hello community,
here is the log from the commit of package ghc-hledger-lib for openSUSE:Factory checked in at 2017-08-31 20:47:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-hledger-lib (Old)
and /work/SRC/openSUSE:Factory/.ghc-hledger-lib.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-hledger-lib"
Thu Aug 31 20:47:34 2017 rev:2 rq:513383 version:1.2
Changes:
-----…
[View More]---
--- /work/SRC/openSUSE:Factory/ghc-hledger-lib/ghc-hledger-lib.changes 2017-04-18 13:51:20.622441969 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-hledger-lib.new/ghc-hledger-lib.changes 2017-08-31 20:47:34.818263847 +0200
@@ -1,0 +2,5 @@
+Thu Jul 27 14:08:05 UTC 2017 - psimons(a)suse.com
+
+- Update to version 1.2 revision 1.
+
+-------------------------------------------------------------------
Old:
----
hledger-lib-1.1.tar.gz
New:
----
hledger-lib-1.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-hledger-lib.spec ++++++
--- /var/tmp/diff_new_pack.5UBz5y/_old 2017-08-31 20:47:36.034093187 +0200
+++ /var/tmp/diff_new_pack.5UBz5y/_new 2017-08-31 20:47:36.050090942 +0200
@@ -19,7 +19,7 @@
%global pkg_name hledger-lib
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 1.1
+Version: 1.2
Release: 0
Summary: Core data types, parsers and functionality for the hledger accounting tools
License: GPL-3.0+
@@ -47,18 +47,15 @@
BuildRequires: ghc-mtl-devel
BuildRequires: ghc-old-time-devel
BuildRequires: ghc-parsec-devel
-BuildRequires: ghc-parsers-devel
BuildRequires: ghc-pretty-show-devel
BuildRequires: ghc-regex-tdfa-devel
BuildRequires: ghc-rpm-macros
BuildRequires: ghc-safe-devel
BuildRequires: ghc-semigroups-devel
BuildRequires: ghc-split-devel
-BuildRequires: ghc-system-filepath-devel
BuildRequires: ghc-text-devel
BuildRequires: ghc-time-devel
BuildRequires: ghc-transformers-devel
-BuildRequires: ghc-trifecta-devel
BuildRequires: ghc-uglymemo-devel
BuildRequires: ghc-utf8-string-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-build
++++++ hledger-lib-1.1.tar.gz -> hledger-lib-1.2.tar.gz ++++++
++++ 3963 lines of diff (skipped)
++++++ hledger-lib.cabal ++++++
--- /var/tmp/diff_new_pack.5UBz5y/_old 2017-08-31 20:47:36.366046592 +0200
+++ /var/tmp/diff_new_pack.5UBz5y/_new 2017-08-31 20:47:36.366046592 +0200
@@ -1,12 +1,10 @@
--- This file has been generated from package.yaml by hpack version 0.15.0.
+-- This file has been generated from package.yaml by hpack version 0.17.0.
--
-- see: https://github.com/sol/hpack
name: hledger-lib
-version: 1.1
+version: 1.2
x-revision: 1
-stability: stable
-category: Finance
synopsis: Core data types, parsers and functionality for the hledger accounting tools
description: This is a reusable library containing hledger's core functionality.
.
@@ -16,15 +14,17 @@
with ledger(1). hledger provides command-line, curses and web
interfaces, and aims to be a reliable, practical tool for daily
use.
-license: GPL
-license-file: LICENSE
-author: Simon Michael <simon(a)joyful.com>
-maintainer: Simon Michael <simon(a)joyful.com>
+category: Finance
+stability: stable
homepage: http://hledger.org
bug-reports: http://bugs.hledger.org
-cabal-version: >= 1.10
-build-type: Simple
+author: Simon Michael <simon(a)joyful.com>
+maintainer: Simon Michael <simon(a)joyful.com>
+license: GPL-3
+license-file: LICENSE
tested-with: GHC==7.10.3, GHC==8.0
+build-type: Simple
+cabal-version: >= 1.10
extra-source-files:
CHANGES
@@ -55,8 +55,7 @@
library
hs-source-dirs:
- other/ledger-parse
- , .
+ ./.
ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans
build-depends:
base >=4.8 && <5
@@ -73,7 +72,7 @@
, directory
, filepath
, hashtables >= 1.2
- , megaparsec >=5.0 && < 5.3
+ , megaparsec >=5.0 && < 5.4
, mtl
, mtl-compat
, old-time
@@ -86,9 +85,6 @@
, uglymemo
, utf8-string >=0.3.5 && <1.1
, HUnit
- , parsers >= 0.5
- , system-filepath
- , trifecta >= 0.91
, parsec
, semigroups
if impl(ghc <7.6)
@@ -111,19 +107,20 @@
Hledger.Data.Dates
Hledger.Data.Journal
Hledger.Data.Ledger
+ Hledger.Data.MarketPrice
Hledger.Data.Period
Hledger.Data.StringFormat
Hledger.Data.Posting
Hledger.Data.RawOptions
Hledger.Data.Timeclock
Hledger.Data.Transaction
+ Hledger.Data.AutoTransaction
Hledger.Data.Types
Hledger.Query
Hledger.Read
Hledger.Read.Common
Hledger.Read.CsvReader
Hledger.Read.JournalReader
- Hledger.Read.LedgerReader
Hledger.Read.TimedotReader
Hledger.Read.TimeclockReader
Hledger.Reports
@@ -144,18 +141,16 @@
Hledger.Utils.Tree
Hledger.Utils.UTF8IOCompat
other-modules:
- Ledger.Parser.Text
Paths_hledger_lib
default-language: Haskell2010
test-suite doctests
type: exitcode-stdio-1.0
+ main-is: doctests.hs
hs-source-dirs:
- other/ledger-parse
- , .
- , tests
+ ./.
+ tests
ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans
- main-is: doctests.hs
build-depends:
base >=4.8 && <5
, base-compat >=0.8.1
@@ -171,7 +166,7 @@
, directory
, filepath
, hashtables >= 1.2
- , megaparsec >=5.0 && < 5.3
+ , megaparsec >=5.0 && < 5.4
, mtl
, mtl-compat
, old-time
@@ -184,25 +179,23 @@
, uglymemo
, utf8-string >=0.3.5 && <1.1
, HUnit
- , parsers >= 0.5
- , system-filepath
- , trifecta >= 0.91
, doctest >=0.8
, Glob >=0.7
if impl(ghc <7.6)
build-depends:
ghc-prim
other-modules:
- Ledger.Parser.Text
Hledger
Hledger.Data
Hledger.Data.Account
Hledger.Data.AccountName
Hledger.Data.Amount
+ Hledger.Data.AutoTransaction
Hledger.Data.Commodity
Hledger.Data.Dates
Hledger.Data.Journal
Hledger.Data.Ledger
+ Hledger.Data.MarketPrice
Hledger.Data.Period
Hledger.Data.Posting
Hledger.Data.RawOptions
@@ -215,7 +208,6 @@
Hledger.Read.Common
Hledger.Read.CsvReader
Hledger.Read.JournalReader
- Hledger.Read.LedgerReader
Hledger.Read.TimeclockReader
Hledger.Read.TimedotReader
Hledger.Reports
@@ -241,9 +233,8 @@
type: exitcode-stdio-1.0
main-is: hunittests.hs
hs-source-dirs:
- other/ledger-parse
- , .
- , tests
+ ./.
+ tests
ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans
build-depends:
base >=4.8 && <5
@@ -260,7 +251,7 @@
, directory
, filepath
, hashtables >= 1.2
- , megaparsec >=5.0 && < 5.3
+ , megaparsec >=5.0 && < 5.4
, mtl
, mtl-compat
, old-time
@@ -273,9 +264,6 @@
, uglymemo
, utf8-string >=0.3.5 && <1.1
, HUnit
- , parsers >= 0.5
- , system-filepath
- , trifecta >= 0.91
, hledger-lib
, parsec
, test-framework
@@ -291,16 +279,17 @@
build-depends:
time >=1.5
other-modules:
- Ledger.Parser.Text
Hledger
Hledger.Data
Hledger.Data.Account
Hledger.Data.AccountName
Hledger.Data.Amount
+ Hledger.Data.AutoTransaction
Hledger.Data.Commodity
Hledger.Data.Dates
Hledger.Data.Journal
Hledger.Data.Ledger
+ Hledger.Data.MarketPrice
Hledger.Data.Period
Hledger.Data.Posting
Hledger.Data.RawOptions
@@ -313,7 +302,6 @@
Hledger.Read.Common
Hledger.Read.CsvReader
Hledger.Read.JournalReader
- Hledger.Read.LedgerReader
Hledger.Read.TimeclockReader
Hledger.Read.TimedotReader
Hledger.Reports
[View Less]
1
0
Hello community,
here is the log from the commit of package ghc-hjsonpointer for openSUSE:Factory checked in at 2017-08-31 20:47:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-hjsonpointer (Old)
and /work/SRC/openSUSE:Factory/.ghc-hjsonpointer.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-hjsonpointer"
Thu Aug 31 20:47:32 2017 rev:3 rq:513381 version:1.2.0
Changes:…
[View More]
--------
--- /work/SRC/openSUSE:Factory/ghc-hjsonpointer/ghc-hjsonpointer.changes 2017-06-04 01:53:48.235273048 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-hjsonpointer.new/ghc-hjsonpointer.changes 2017-08-31 20:47:33.426459208 +0200
@@ -1,0 +2,5 @@
+Thu Jul 27 14:08:16 UTC 2017 - psimons(a)suse.com
+
+- Update to version 1.2.0 revision 3.
+
+-------------------------------------------------------------------
Old:
----
hjsonpointer-1.1.1.tar.gz
New:
----
hjsonpointer-1.2.0.tar.gz
hjsonpointer.cabal
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-hjsonpointer.spec ++++++
--- /var/tmp/diff_new_pack.zm8po7/_old 2017-08-31 20:47:34.510307074 +0200
+++ /var/tmp/diff_new_pack.zm8po7/_new 2017-08-31 20:47:34.522305389 +0200
@@ -19,13 +19,14 @@
%global pkg_name hjsonpointer
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 1.1.1
+Version: 1.2.0
Release: 0
Summary: JSON Pointer library
License: MIT
Group: Development/Languages/Other
Url: https://hackage.haskell.org/package/%{pkg_name}
Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{ve…
+Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/3.cabal…
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-QuickCheck-devel
BuildRequires: ghc-aeson-devel
@@ -57,6 +58,7 @@
%prep
%setup -q -n %{pkg_name}-%{version}
+cp -p %{SOURCE1} %{pkg_name}.cabal
%build
%ghc_lib_build
++++++ hjsonpointer-1.1.1.tar.gz -> hjsonpointer-1.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hjsonpointer-1.1.1/hjsonpointer.cabal new/hjsonpointer-1.2.0/hjsonpointer.cabal
--- old/hjsonpointer-1.1.1/hjsonpointer.cabal 2017-04-16 23:06:04.000000000 +0200
+++ new/hjsonpointer-1.2.0/hjsonpointer.cabal 2017-06-26 23:10:14.000000000 +0200
@@ -1,5 +1,5 @@
name: hjsonpointer
-version: 1.1.1
+version: 1.2.0
synopsis: JSON Pointer library
homepage: https://github.com/seagreen/hjsonpointer
license: MIT
@@ -22,15 +22,15 @@
exposed-modules:
JSONPointer
build-depends:
- base >= 4.6 && < 4.10
- , aeson >= 0.7 && < 1.3
- , hashable >= 1.2 && < 1.3
- , QuickCheck >= 2.8 && < 2.10
- , unordered-containers >= 0.2 && < 0.3
- , semigroups >= 0.18 && < 1.0
+ base >= 4.6 && < 4.10
+ , aeson >= 0.7
+ , hashable >= 1.2
+ , QuickCheck >= 2.8
+ , unordered-containers >= 0.2
+ , semigroups >= 0.18
-- ^ for GHCs < 8
- , text >= 1.2 && < 1.3
- , vector >= 0.10 && < 1.0
+ , text >= 1.2
+ , vector >= 0.10
test-suite unit
hs-source-dirs:
@@ -48,8 +48,8 @@
aeson
, base
, hjsonpointer
- , hspec >= 2.2 && < 3.0
- , http-types >= 0.8 && < 1.0
+ , hspec >= 2.2
+ , http-types >= 0.8
, QuickCheck
, unordered-containers
, text
++++++ hjsonpointer.cabal ++++++
name: hjsonpointer
version: 1.2.0
cabal-version: >=1.10
build-type: Simple
license: MIT
license-file: MIT-LICENSE.txt
maintainer: ian(a)housejeffries.com
homepage: https://github.com/seagreen/hjsonpointer
synopsis: JSON Pointer library
category: Data
author: Ian Grant Jeffries
extra-source-files:
changelog.md
README.md
x-revision: 3
source-repository head
type: git
location: git://github.com/seagreen/hjsonpointer.git
library
exposed-modules:
JSONPointer
build-depends:
base >=4.6 && <4.10,
aeson >=0.7 && <1.3,
hashable ==1.2.*,
QuickCheck >=2.8 && <2.11,
unordered-containers ==0.2.*,
semigroups ==0.18.*,
text ==1.2.*,
vector >=0.10 && <0.13
default-language: Haskell2010
hs-source-dirs: src
ghc-options: -Wall
test-suite unit
type: exitcode-stdio-1.0
main-is: Unit.hs
build-depends:
aeson <1.3,
base <4.10,
hjsonpointer <1.3,
hspec >=2.2 && <2.5,
http-types >=0.8 && <0.10,
QuickCheck <2.11,
unordered-containers <0.3,
text <1.3,
vector <0.13
default-language: Haskell2010
default-extensions: OverloadedStrings
hs-source-dirs: test ./
other-modules:
Example
ghc-options: -Wall
[View Less]
1
0
Hello community,
here is the log from the commit of package ghc-hformat for openSUSE:Factory checked in at 2017-08-31 20:47:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-hformat (Old)
and /work/SRC/openSUSE:Factory/.ghc-hformat.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-hformat"
Thu Aug 31 20:47:29 2017 rev:2 rq:513379 version:0.3.0.0
Changes:
--------
--- /…
[View More]work/SRC/openSUSE:Factory/ghc-hformat/ghc-hformat.changes 2017-03-08 00:53:33.348046169 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-hformat.new/ghc-hformat.changes 2017-08-31 20:47:30.662847125 +0200
@@ -1,0 +2,5 @@
+Thu Jul 27 14:08:16 UTC 2017 - psimons(a)suse.com
+
+- Update to version 0.3.0.0.
+
+-------------------------------------------------------------------
Old:
----
hformat-0.1.0.1.tar.gz
New:
----
hformat-0.3.0.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-hformat.spec ++++++
--- /var/tmp/diff_new_pack.b1G41g/_old 2017-08-31 20:47:31.466734286 +0200
+++ /var/tmp/diff_new_pack.b1G41g/_new 2017-08-31 20:47:31.474733164 +0200
@@ -1,7 +1,7 @@
#
# spec file for package ghc-hformat
#
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,15 +19,15 @@
%global pkg_name hformat
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 0.1.0.1
+Version: 0.3.0.0
Release: 0
Summary: Simple Haskell formatting
License: BSD-3-Clause
-Group: System/Libraries
+Group: Development/Languages/Other
Url: https://hackage.haskell.org/package/%{pkg_name}
Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{ve…
BuildRequires: ghc-Cabal-devel
-# Begin cabal-rpm deps:
+BuildRequires: ghc-ansi-terminal-devel
BuildRequires: ghc-base-unicode-symbols-devel
BuildRequires: ghc-rpm-macros
BuildRequires: ghc-text-devel
@@ -35,7 +35,6 @@
%if %{with tests}
BuildRequires: ghc-hspec-devel
%endif
-# End cabal-rpm deps
%description
String formatting.
@@ -54,20 +53,14 @@
%prep
%setup -q -n %{pkg_name}-%{version}
-
%build
%ghc_lib_build
-
%install
%ghc_lib_install
-
%check
-%if %{with tests}
-%{cabal} test
-%endif
-
+%cabal_test
%post devel
%ghc_pkg_recache
++++++ hformat-0.1.0.1.tar.gz -> hformat-0.3.0.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hformat-0.1.0.1/hformat.cabal new/hformat-0.3.0.0/hformat.cabal
--- old/hformat-0.1.0.1/hformat.cabal 2016-05-24 00:27:53.000000000 +0200
+++ new/hformat-0.3.0.0/hformat.cabal 2017-04-23 23:39:10.000000000 +0200
@@ -1,5 +1,5 @@
name: hformat
-version: 0.1.0.1
+version: 0.3.0.0
synopsis: Simple Haskell formatting
description: String formatting
homepage: http://github.com/mvoidex/hformat
@@ -20,11 +20,14 @@
default-language: Haskell2010
ghc-options: -Wall -fno-warn-tabs
default-extensions: UnicodeSyntax
- exposed-modules:
+ exposed-modules:
Text.Format
+ Text.Format.Flags
+ Text.Format.Colored
build-depends:
base >= 4.8 && < 5,
base-unicode-symbols >= 0.2,
+ ansi-terminal >= 0.6,
text >= 1.2.1
test-suite test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hformat-0.1.0.1/src/Text/Format/Colored.hs new/hformat-0.3.0.0/src/Text/Format/Colored.hs
--- old/hformat-0.1.0.1/src/Text/Format/Colored.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/hformat-0.3.0.0/src/Text/Format/Colored.hs 2017-04-23 23:39:10.000000000 +0200
@@ -0,0 +1,62 @@
+module Text.Format.Colored (
+ colored, coloredLine,
+ hColored, hColoredLine
+ ) where
+
+import Prelude.Unicode
+
+import Data.Maybe (mapMaybe)
+import System.Console.ANSI
+import System.IO
+
+import Text.Format
+
+colored ∷ Formatted → IO ()
+colored = hColored stdout
+
+coloredLine ∷ Formatted → IO ()
+coloredLine = hColoredLine stdout
+
+hColored ∷ Handle → Formatted → IO ()
+hColored h (Formatted fs) = mapM_ go fs >> setSGR [] where
+ go (FormattedPart flags v) = setFlags flags >> hPutStr h v >> setSGR []
+ setFlags = setSGR ∘ mapMaybe toSGR
+ toSGR "bold" = Just $ SetConsoleIntensity BoldIntensity
+ toSGR "italic" = Just $ SetItalicized True
+ toSGR "undelined" = Just $ SetUnderlining SingleUnderline
+ toSGR "black" = Just $ SetColor Foreground Vivid Black
+ toSGR "red" = Just $ SetColor Foreground Vivid Red
+ toSGR "green" = Just $ SetColor Foreground Vivid Green
+ toSGR "yellow" = Just $ SetColor Foreground Vivid Yellow
+ toSGR "blue" = Just $ SetColor Foreground Vivid Blue
+ toSGR "magenta" = Just $ SetColor Foreground Vivid Magenta
+ toSGR "cyan" = Just $ SetColor Foreground Vivid Cyan
+ toSGR "white" = Just $ SetColor Foreground Vivid White
+ toSGR "darkgray" = Just $ SetColor Foreground Dull Black
+ toSGR "darkred" = Just $ SetColor Foreground Dull Red
+ toSGR "darkgreen" = Just $ SetColor Foreground Dull Green
+ toSGR "darkyellow" = Just $ SetColor Foreground Dull Yellow
+ toSGR "darkblue" = Just $ SetColor Foreground Dull Blue
+ toSGR "darkmagenta" = Just $ SetColor Foreground Dull Magenta
+ toSGR "darkcyan" = Just $ SetColor Foreground Dull Cyan
+ toSGR "gray" = Just $ SetColor Foreground Dull White
+ toSGR "bg/black" = Just $ SetColor Background Vivid Black
+ toSGR "bg/red" = Just $ SetColor Background Vivid Red
+ toSGR "bg/green" = Just $ SetColor Background Vivid Green
+ toSGR "bg/yellow" = Just $ SetColor Background Vivid Yellow
+ toSGR "bg/blue" = Just $ SetColor Background Vivid Blue
+ toSGR "bg/magenta" = Just $ SetColor Background Vivid Magenta
+ toSGR "bg/cyan" = Just $ SetColor Background Vivid Cyan
+ toSGR "bg/white" = Just $ SetColor Background Vivid White
+ toSGR "bg/darkgray" = Just $ SetColor Background Dull Black
+ toSGR "bg/darkred" = Just $ SetColor Background Dull Red
+ toSGR "bg/darkgreen" = Just $ SetColor Background Dull Green
+ toSGR "bg/darkyellow" = Just $ SetColor Background Dull Yellow
+ toSGR "bg/darkblue" = Just $ SetColor Background Dull Blue
+ toSGR "bg/darkmagenta" = Just $ SetColor Background Dull Magenta
+ toSGR "bg/darkcyan" = Just $ SetColor Background Dull Cyan
+ toSGR "bg/gray" = Just $ SetColor Background Dull White
+ toSGR _ = Nothing
+
+hColoredLine ∷ Handle → Formatted → IO ()
+hColoredLine h f = hColored h f >> hPutStrLn h ""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hformat-0.1.0.1/src/Text/Format/Flags.hs new/hformat-0.3.0.0/src/Text/Format/Flags.hs
--- old/hformat-0.1.0.1/src/Text/Format/Flags.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/hformat-0.3.0.0/src/Text/Format/Flags.hs 2017-04-23 23:39:10.000000000 +0200
@@ -0,0 +1,37 @@
+module Text.Format.Flags (
+ FormatFlags,
+ getFlag, hasFlag,
+ baseFlag, preciseFlag
+ ) where
+
+import Prelude.Unicode
+
+import Control.Applicative
+import Data.List (stripPrefix)
+import Data.Maybe (listToMaybe, mapMaybe, fromMaybe)
+import Text.Read
+
+type FormatFlags = [String]
+
+getFlag ∷ (String → Maybe a) → [String] → Maybe a
+getFlag fn = listToMaybe ∘ mapMaybe fn
+
+hasFlag ∷ String → [String] → Bool
+hasFlag = (∈)
+
+getFlagValue ∷ Read a ⇒ String → [String] → Maybe a
+getFlagValue nm fmts = do
+ f ← getFlag (stripPrefix (nm ++ "=")) fmts
+ readMaybe f
+
+baseFlag ∷ (Read a, Integral a) ⇒ [String] → a
+baseFlag fmts
+ | hasFlag "bin" fmts ∨ hasFlag "b" fmts = 2
+ | hasFlag "octal" fmts ∨ hasFlag "o" fmts = 8
+ | hasFlag "hex" fmts ∨ hasFlag "h" fmts = 16
+ | otherwise = fromMaybe 10 (getFlagValue "base" fmts <|> getFlagValue "b" fmts)
+
+preciseFlag ∷ [String] → Maybe Int
+preciseFlag fmts = read <$> listToMaybe (mapMaybe preciseFlag' fmts) where
+ preciseFlag' ('d':d) = Just d
+ preciseFlag' _ = Nothing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hformat-0.1.0.1/src/Text/Format.hs new/hformat-0.3.0.0/src/Text/Format.hs
--- old/hformat-0.1.0.1/src/Text/Format.hs 2016-05-24 00:27:53.000000000 +0200
+++ new/hformat-0.3.0.0/src/Text/Format.hs 2017-04-23 23:39:10.000000000 +0200
@@ -3,9 +3,9 @@
-- | Format string with named args
--
-- >-- Named args
--- >"My name is {name}, I am {age} years old" ~~ ("name" %= "Joe") ~~ ("age" %= 24) ≡ "My name is Joe, I am 24 years old"
+-- >"My name is {name}, I am {age} years old" ~~ ("name" ~% "Joe") ~~ ("age" ~% 24) ≡ "My name is Joe, I am 24 years old"
-- >-- Arg can have default value
--- >"{var:x} = {val:10}" ~~ ("var" %= y) ≡ "y = 10"
+-- >"{var:x} = {val:10}" ~~ ("var" ~% y) ≡ "y = 10"
-- >-- Numeric position can be used
-- >"{0} {1} {0}" ~~ "foo" ~~ "bar" ≡ "foo bar foo"
-- >-- Positions can be omitted
@@ -13,105 +13,164 @@
-- >-- Double braces to escape them
-- >"{} and {{}}" ~~ 10 ≡ "10 and {}"
module Text.Format (
+ FormattedPart(..), Formatted(..), withFlags,
FormatArg(..), Format(..), Formatter(..),
- build,
- FormatBuild(..), Hole(..), fmt, FormatResult(..),
- format, (~~), (%=)
+ prebuild, build,
+ Formattable(..), Hole(..), fmt, FormatResult(..),
+ format, formats, (~~), (~%),
+
+ module Text.Format.Flags
) where
import Prelude.Unicode
import Control.Applicative
-import Data.List (find)
+import Data.Char (intToDigit)
+import Data.List (find, intercalate, nub)
import Data.Maybe (fromMaybe, listToMaybe)
import qualified Data.Text as T
import Data.Text.Lazy (Text, unpack)
-import Data.Text.Lazy.Builder (Builder)
-import qualified Data.Text.Lazy.Builder as B
import Data.String
+import Numeric
import Text.Read (readMaybe)
import Text.ParserCombinators.ReadP
-data FormatArg = FormatNamed String Builder | FormatPos Builder
+import Text.Format.Flags
+
+data FormattedPart = FormattedPart {
+ formattedFlags ∷ FormatFlags,
+ formattedValue ∷ String }
+ deriving (Eq, Ord, Show)
+
+instance IsString FormattedPart where
+ fromString = FormattedPart [] ∘ fromString
+
+newtype Formatted = Formatted { formattedParts ∷ [FormattedPart] } deriving (Eq, Ord, Show)
+
+instance IsString Formatted where
+ fromString = Formatted ∘ return ∘ fromString
+
+instance Monoid Formatted where
+ mempty = Formatted []
+ Formatted l `mappend` Formatted r = Formatted $ l ++ r
+
+withFlags ∷ String → [String] → Formatted
+withFlags v fs = Formatted [FormattedPart fs v]
+
+data FormatArg = FormatNamed String ([String] → Formatted) | FormatPos ([String] → Formatted)
data Format = Format {
formatString ∷ String,
formatArgs ∷ [FormatArg] }
+instance Show Format where
+ show = mconcat ∘ map formattedValue ∘ formattedParts ∘ prebuild
+
instance IsString Format where
fromString str = Format str []
data Formatter = Formatter {
formatter ∷ Either String Int,
- formatterDefault ∷ Maybe String }
+ formatterDefault ∷ Maybe String,
+ formatterFlags ∷ [String] }
instance Show Formatter where
- show (Formatter f def) = "{" ++ either id show f ++ maybe "" (':':) def ++ "}"
+ show (Formatter f def cfgs) = "{" ++ concat parts ++ "}" where
+ parts = [either id show f, fromMaybe "" (fmap ('=':) def), if null cfgs then "" else (':' : intercalate "," cfgs)]
instance Read Formatter where
readsPrec _ = readP_to_S $ between (char '{') (char '}') $ do
- n ← munch1 (∉ ":}")
+ n ← munch (∉ "=:}")
v ← option Nothing $ do
- _ ← char ':'
- v' ← munch1 (≢ '}')
+ _ ← char '='
+ v' ← munch1 (∉ ":}")
return $ Just v'
- return $ Formatter (maybe (Left n) Right $ readMaybe n) v
+ cs ← option [] $ do
+ _ ← char ':'
+ flip sepBy (char ',') (munch1 (∉ ",}"))
+ return $ Formatter (maybe (Left n) Right $ readMaybe n) v cs
-build ∷ Format → Text
-build fstr = B.toLazyText $ mconcat $ build' 0 fstr where
- build' ∷ Int → Format → [Builder]
- build' _ (Format "" _) = []
- build' i (Format ('{':'{':fstr') args) = B.singleton '{' : build' i (Format fstr' args)
- build' i (Format ('}':'}':fstr') args) = B.singleton '}' : build' i (Format fstr' args)
- build' i (Format ('{':'}':fstr') args) = formatArg' (Formatter (Right i) Nothing) args : build' (succ i) (Format fstr' args)
+prebuild ∷ Format → Formatted
+prebuild = buildFormat True
+
+build ∷ Format → Formatted
+build = buildFormat False
+
+buildFormat ∷ Bool → Format → Formatted
+buildFormat pre fstr = build' 0 fstr where
+ build' ∷ Int → Format → Formatted
+ build' _ (Format "" _) = mempty
+ build' i (Format ('{':'{':fstr') args) = fromString "{" `mappend` build' i (Format fstr' args)
+ build' i (Format ('}':'}':fstr') args) = fromString "}" `mappend` build' i (Format fstr' args)
+ build' i (Format ('{':'}':fstr') args) = formatArg' (Formatter (Right i) Nothing []) args `mappend` build' (succ i) (Format fstr' args)
build' i (Format ('{':fstr') args) = case reads ('{':fstr') of
[] → error $ "Can't parse formatter at " ++ fstr'
- (f, fstr''):_ → formatArg' f args : build' i (Format fstr'' args)
- build' i (Format fstr' args) = fromString s : build' i (Format fstr'' args) where
+ (f, fstr''):_ → formatArg' f args `mappend` build' i (Format fstr'' args)
+ build' i (Format fstr' args) = fromString s `mappend` build' i (Format fstr'' args) where
(s, fstr'') = break (∈ "{}") fstr'
- formatArg' ∷ Formatter → [FormatArg] → Builder
- formatArg' (Formatter (Left name) defVal) args = fromMaybe (error $ "Argument " ++ name ++ " not set") (lookArg <|> fmap B.fromString defVal) where
- lookArg = do
- FormatNamed _ fval ← find byName args
- return fval
- byName (FormatNamed n _) = n ≡ name
- byName _ = False
- formatArg' (Formatter (Right i) defVal) args = fromMaybe (error $ "Argument at index " ++ show i ++ " not set") (lookIdx <|> fmap B.fromString defVal) where
- lookIdx = do
- FormatPos fval ← listToMaybe $ drop i $ filter isPos args
- return fval
- isPos (FormatPos _) = True
- isPos _ = False
-
--- | FormatBuild class, by default using @show@
-class FormatBuild a where
- formatBuild ∷ a → Builder
- default formatBuild ∷ Show a ⇒ a → Builder
- formatBuild = B.fromString ∘ show
-
-instance FormatBuild String where
- formatBuild = B.fromString
-
-instance FormatBuild Char where
- formatBuild = B.singleton
-
-instance FormatBuild Int
-instance FormatBuild Integer
-instance FormatBuild Double
-instance FormatBuild Float
-instance FormatBuild Bool
+ formatArg' ∷ Formatter → [FormatArg] → Formatted
+ formatArg' f@(Formatter (Left name) defVal fmtCfgs) args
+ | pre = fromMaybe (formatted f fmtCfgs) lookArg
+ | otherwise = fromMaybe (error $ "Argument " ++ name ++ " not set") (lookArg <|> fmap (flip formatted fmtCfgs) defVal)
+ where
+ lookArg = do
+ FormatNamed _ fval ← find byName args
+ return $ fval fmtCfgs
+ byName (FormatNamed n _) = n ≡ name
+ byName _ = False
+ formatArg' f@(Formatter (Right i) defVal fmtCfgs) args
+ | pre = fromMaybe (formatted f fmtCfgs) lookIdx
+ | otherwise = fromMaybe (error $ "Argument at index " ++ show i ++ " not set") (lookIdx <|> fmap (flip formatted fmtCfgs) defVal)
+ where
+ lookIdx = do
+ FormatPos fval ← listToMaybe $ drop i $ filter isPos args
+ return $ fval fmtCfgs
+ isPos (FormatPos _) = True
+ isPos _ = False
+
+-- | Formattable class, by default using @show@
+class Formattable a where
+ formattable ∷ a → FormatFlags → Formatted
+ default formattable ∷ Show a ⇒ a → FormatFlags → Formatted
+ formattable x _ = fromString ∘ show $ x
+
+formatted ∷ Formattable a ⇒ a → FormatFlags → Formatted
+formatted v fmts = Formatted ∘ map addFmts ∘ formattedParts ∘ formattable v $ fmts where
+ addFmts (FormattedPart flags' v') = FormattedPart (nub $ fmts ++ flags') v'
+
+instance Formattable String where
+ formattable s _ = fromString s
+
+instance Formattable Char where
+ formattable ch _ = fromString [ch]
+
+instance Formattable Int where
+ formattable i fmts = fromString ∘ formatInt (baseFlag fmts) $ i
+instance Formattable Integer where
+ formattable i fmts = fromString ∘ formatInt (baseFlag fmts) $ i
+instance Formattable Double where
+ formattable d fmts = fromString ∘ formatDouble (preciseFlag fmts) $ d
+instance Formattable Float where
+ formattable f fmts = fromString ∘ formatDouble (preciseFlag fmts) $ f
+instance Formattable Bool
+
+instance Formattable Text where
+ formattable s _ = fromString ∘ unpack $ s
-instance FormatBuild Text where
- formatBuild = B.fromLazyText
+instance Formattable T.Text where
+ formattable s _ = fromString ∘ T.unpack $ s
-instance FormatBuild T.Text where
- formatBuild = B.fromText
+instance Formattable Formatter where
+ formattable s _ = fromString ∘ show $ s
class Hole a where
hole ∷ a → [FormatArg]
-instance Hole Builder where
- hole = return ∘ FormatPos
+instance Hole Formatted where
+ hole v = [FormatPos $ const v]
+
+instance {-# OVERLAPPING #-} Hole FormatArg where
+ hole = return
instance {-# OVERLAPPING #-} Hole [FormatArg] where
hole = id
@@ -119,11 +178,11 @@
instance {-# OVERLAPPING #-} Hole [[FormatArg]] where
hole = concat
-instance {-# OVERLAPPABLE #-} FormatBuild a ⇒ Hole a where
- hole = return ∘ FormatPos ∘ formatBuild
+instance {-# OVERLAPPABLE #-} Formattable a ⇒ Hole a where
+ hole v = [FormatPos $ formatted v]
-fmt ∷ Hole a ⇒ a → [FormatArg]
-fmt = hole
+fmt ∷ Formattable a ⇒ a → FormatArg
+fmt v = FormatPos $ formatted v
class FormatResult r where
formatResult ∷ Format → r
@@ -131,21 +190,35 @@
instance FormatResult Format where
formatResult = id
-instance {-# OVERLAPPING #-} FormatResult Text where
- formatResult = build
+instance {-# OVERLAPPING #-} FormatResult String where
+ formatResult = mconcat ∘ map formattedValue ∘ formattedParts ∘ build
instance {-# OVERLAPPABLE #-} IsString s ⇒ FormatResult s where
- formatResult = fromString ∘ unpack ∘ formatResult
+ formatResult = fromString ∘ formatResult
+
+instance {-# OVERLAPPABLE #-} FormatResult Formatted where
+ formatResult = build
format ∷ FormatResult r ⇒ String → r
format = formatResult ∘ fromString
+formats ∷ FormatResult r ⇒ String → [FormatArg] → r
+formats f = formatResult ∘ Format f
+
infixl 7 ~~
(~~) ∷ (Hole a, FormatResult r) ⇒ Format → a → r
fstr ~~ arg = formatResult $ fstr { formatArgs = formatArgs fstr ++ hole arg }
-infixr 8 %=
+infixr 8 ~%
+
+(~%) ∷ Formattable a ⇒ String → a → FormatArg
+name ~% value = FormatNamed name (formatted value)
+
+-- * Util
+
+formatInt ∷ (Show a, Integral a) ⇒ a → a → String
+formatInt base v = showIntAtBase base intToDigit v ""
-(%=) ∷ FormatBuild a ⇒ String → a → [FormatArg]
-name %= value = [FormatNamed name (formatBuild value)]
+formatDouble ∷ RealFloat a ⇒ Maybe Int → a → String
+formatDouble p v = showGFloat p v ""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hformat-0.1.0.1/tests/Test.hs new/hformat-0.3.0.0/tests/Test.hs
--- old/hformat-0.1.0.1/tests/Test.hs 2016-05-24 00:27:53.000000000 +0200
+++ new/hformat-0.3.0.0/tests/Test.hs 2017-04-23 23:39:10.000000000 +0200
@@ -1,3 +1,5 @@
+{-# LANGUAGE OverloadedStrings #-}
+
module Main (
main
) where
@@ -11,24 +13,36 @@
main ∷ IO ()
main = hspec $ do
describe "positional arguments" $ do
- it "should format unnamed arguments" $
- (format "{} + {} = {}" ~~ (10 ∷ Int) ~~ (12 ∷ Int) ~~ (22 ∷ Int) ≡ "10 + 12 = 22")
- it "should format positional arguments" $
- (format "{0} + {0} = {1}" ~~ (10 ∷ Int) ~~ (20 ∷ Int) ≡ "10 + 10 = 20")
+ it "should format unnamed arguments"
+ (format "{} + {} = {}" ~~ (10 ∷ Int) ~~ (12 ∷ Int) ~~ (22 ∷ Int) ≡ str "10 + 12 = 22")
+ it "should format positional arguments"
+ (format "{0} + {0} = {1}" ~~ (10 ∷ Int) ~~ (20 ∷ Int) ≡ str "10 + 10 = 20")
describe "named arguments" $
- it "should format named arguments" $
- (format "{x} + {y} = {z}" ~~ "x" %= (1 ∷ Int) ~~ "y" %= (2 ∷ Int) ~~ "z" %= (3 ∷ Int) ≡ "1 + 2 = 3")
+ it "should format named arguments"
+ (format "{x} + {y} = {z}" ~~ "x" ~% (1 ∷ Int) ~~ "y" ~% (2 ∷ Int) ~~ "z" ~% (3 ∷ Int) ≡ str "1 + 2 = 3")
describe "default values" $ do
- it "should accept default values for positional arguments" $
- (format "{0:foo} is {1:bar}" ~~ "blah" ≡ "blah is bar")
- it "should accept default values for named arguments" $
- (format "{x:12} + {y:13}" ~~ "y" %= (10 ∷ Int) ≡ "12 + 10")
- describe "lists" $ do
- it "should accept list of values" $
- (format "{0} + {x:10} = {1}" ~~ [fmt (3 ∷ Int), "x" %= (5 ∷ Int), fmt (8 ∷ Int)] ≡ "3 + 5 = 8")
+ it "should accept default values for positional arguments"
+ (format "{0=foo} is {1=bar}" ~~ str "blah" ≡ str "blah is bar")
+ it "should accept default values for named arguments"
+ (format "{x=12} + {y=13}" ~~ "y" ~% (10 ∷ Int) ≡ str "12 + 10")
+ describe "format options" $ do
+ it "should accept format options"
+ (format "x is {0=foo:octal}" ~~ (10 ∷ Int) ≡ str "x is 12")
+ describe "colorized output" $ do
+ it "should accept colors"
+ (format "x is {0:red}" ~~ (10 ∷ Int) ≡ Formatted [FormattedPart [] "x is ", FormattedPart ["red"] "10"])
+ describe "lists" $
+ it "should accept list of values"
+ (format "{0} + {x:10} = {1}" ~~ [fmt (3 ∷ Int), "x" ~% (5 ∷ Int), fmt (8 ∷ Int)] ≡ str "3 + 5 = 8")
describe "escape" $
- it "should escape curly braces" $
- (format "{} is not {{}}" ~~ "{}" ≡ "{} is not {}")
+ it "should escape curly braces"
+ (format "{} is not {{}}" ~~ str "{}" ≡ str "{} is not {}")
describe "mix" $
- it "should process mixed arguments" $
- (format "{1:foo} and {} are {what:args}" ~~ "what" %= "quux" ~~ (10 ∷ Int) ~~ (20 ∷ Int) ≡ "20 and 10 are quux")
+ it "should process mixed arguments"
+ (format "{1=foo} and {} are {what=args}" ~~ str "what" ~% str "quux" ~~ (10 ∷ Int) ~~ (20 ∷ Int) ≡ str "20 and 10 are quux")
+ describe "prebuild" $
+ it "should show partially formatted" $
+ show (format "{0} ≡ {1}" ~~ str "foo" ∷ Format) ≡ str "foo ≡ {1}"
+
+str ∷ String → String
+str = id
[View Less]
1
0
Hello community,
here is the log from the commit of package ghc-haskell-src-meta for openSUSE:Factory checked in at 2017-08-31 20:47:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-haskell-src-meta (Old)
and /work/SRC/openSUSE:Factory/.ghc-haskell-src-meta.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-haskell-src-meta"
Thu Aug 31 20:47:27 2017 rev:3 rq:513367 …
[View More]version:0.8.0.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-haskell-src-meta/ghc-haskell-src-meta.changes 2017-06-22 10:37:42.336355403 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-haskell-src-meta.new/ghc-haskell-src-meta.changes 2017-08-31 20:47:28.663127816 +0200
@@ -1,0 +2,5 @@
+Thu Jul 27 14:03:02 UTC 2017 - psimons(a)suse.com
+
+- Update to version 0.8.0.1.
+
+-------------------------------------------------------------------
Old:
----
haskell-src-meta-0.7.0.1.tar.gz
haskell-src-meta.cabal
New:
----
haskell-src-meta-0.8.0.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-haskell-src-meta.spec ++++++
--- /var/tmp/diff_new_pack.u78ZBc/_old 2017-08-31 20:47:29.814966137 +0200
+++ /var/tmp/diff_new_pack.u78ZBc/_new 2017-08-31 20:47:29.818965576 +0200
@@ -17,15 +17,15 @@
%global pkg_name haskell-src-meta
+%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 0.7.0.1
+Version: 0.8.0.1
Release: 0
Summary: Parse source to template-haskell abstract syntax
License: BSD-3-Clause
Group: Development/Languages/Other
Url: https://hackage.haskell.org/package/%{pkg_name}
Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{ve…
-Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal…
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-haskell-src-exts-devel
BuildRequires: ghc-pretty-devel
@@ -34,6 +34,11 @@
BuildRequires: ghc-template-haskell-devel
BuildRequires: ghc-th-orphans-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-build
+%if %{with tests}
+BuildRequires: ghc-HUnit-devel
+BuildRequires: ghc-test-framework-devel
+BuildRequires: ghc-test-framework-hunit-devel
+%endif
%description
The translation from haskell-src-exts abstract syntax to template-haskell
@@ -53,7 +58,6 @@
%prep
%setup -q -n %{pkg_name}-%{version}
-cp -p %{SOURCE1} %{pkg_name}.cabal
%build
%ghc_lib_build
@@ -61,6 +65,9 @@
%install
%ghc_lib_install
+%check
+%cabal_test
+
%post devel
%ghc_pkg_recache
++++++ haskell-src-meta-0.7.0.1.tar.gz -> haskell-src-meta-0.8.0.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-src-meta-0.7.0.1/ChangeLog new/haskell-src-meta-0.8.0.1/ChangeLog
--- old/haskell-src-meta-0.7.0.1/ChangeLog 2017-01-11 14:37:22.000000000 +0100
+++ new/haskell-src-meta-0.8.0.1/ChangeLog 2017-05-31 20:40:48.000000000 +0200
@@ -1,9 +1,23 @@
+0.8.0.1
+- Bump base and template-haskell library to versions shipped with GHC 7.6.
+
+0.8
+- Compatibility with GHC 8.2.
+- Remove deprecated modules.
+
+0.7.0.1
+- Fixed a bug that caused deriving clauses to be ignored on TH 2.11.
+
+0.7.0
+- Compatibility with haskell-src-exts 1.18.
+- Support dropped for GHC < 7.6 and haskell-src-exts < 1.17.
+
0.6.0.14:
- Compatibility with GHC 8.0.
0.6.0.13:
- Compatibility with GHC HEAD, haskell-src-exts 1.17
-- Remove hsBindsToDecs, since it was redundant with toDecs. Technically this
+- Remove hsBindsToDecs, since it was redundant with toDecs. Technically this
requires a minor-version bump, but I doubt anyone was using it.
0.6.0.12:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-src-meta-0.7.0.1/haskell-src-meta.cabal new/haskell-src-meta-0.8.0.1/haskell-src-meta.cabal
--- old/haskell-src-meta-0.7.0.1/haskell-src-meta.cabal 2017-01-11 14:37:22.000000000 +0100
+++ new/haskell-src-meta-0.8.0.1/haskell-src-meta.cabal 2017-05-31 20:40:48.000000000 +0200
@@ -1,6 +1,6 @@
name: haskell-src-meta
-version: 0.7.0.1
-cabal-version: >= 1.6
+version: 0.8.0.1
+cabal-version: >= 1.8
build-type: Simple
license: BSD3
license-file: LICENSE
@@ -9,8 +9,7 @@
copyright: (c) Matt Morrow
maintainer: Ben Millwood <haskell(a)benmachine.co.uk>
bug-reports: https://github.com/bmillwood/haskell-src-meta/issues
--- That is to say, "builds with". It's not like we have a testsuite.
-tested-with: GHC == 7.6.3, GHC == 7.8.3, GHC == 7.10.3, GHC == 8.0.1
+tested-with: GHC == 7.6.3, GHC == 7.8.3, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.1
synopsis: Parse source to template-haskell abstract syntax.
description: The translation from haskell-src-exts abstract syntax
to template-haskell abstract syntax isn't 100% complete yet.
@@ -18,31 +17,37 @@
extra-source-files: ChangeLog README.md examples/*.hs
library
- build-depends: base >= 4.5 && < 4.10,
- haskell-src-exts >= 1.17 && < 1.19,
+ build-depends: base >= 4.6 && < 4.11,
+ haskell-src-exts >= 1.17 && < 1.20,
pretty >= 1.0 && < 1.2,
- syb >= 0.1 && < 0.7,
- template-haskell >= 2.7 && < 2.12,
+ syb >= 0.1 && < 0.8,
+ template-haskell >= 2.8 && < 2.13,
th-orphans >= 0.9.1 && < 0.14
- extensions: CPP,
- RankNTypes,
- StandaloneDeriving,
- TemplateHaskell,
- TypeSynonymInstances,
- FlexibleContexts,
- FlexibleInstances,
- DeriveDataTypeable,
- PatternGuards
+ if impl(ghc < 7.8)
+ build-depends: safe <= 0.3.9
+
hs-source-dirs: src
exposed-modules: Language.Haskell.Meta
Language.Haskell.Meta.Parse
- Language.Haskell.Meta.Parse.Careful
Language.Haskell.Meta.Syntax.Translate
- Language.Haskell.TH.Instances.Lift
Language.Haskell.Meta.Utils
+test-suite unit
+ type: exitcode-stdio-1.0
+ hs-source-dirs: tests
+ main-is: Main.hs
+
+ build-depends:
+ HUnit >= 1.2 && < 1.7,
+ base >= 4.5 && < 4.11,
+ haskell-src-exts >= 1.17 && < 1.20,
+ haskell-src-meta,
+ pretty >= 1.0 && < 1.2,
+ template-haskell >= 2.7 && < 2.13,
+ test-framework >= 0.8 && < 0.9,
+ test-framework-hunit >= 0.3 && < 0.4
+
source-repository head
type: git
location: git://github.com/bmillwood/haskell-src-meta.git
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-src-meta-0.7.0.1/src/Language/Haskell/Meta/Parse/Careful.hs new/haskell-src-meta-0.8.0.1/src/Language/Haskell/Meta/Parse/Careful.hs
--- old/haskell-src-meta-0.7.0.1/src/Language/Haskell/Meta/Parse/Careful.hs 2017-01-11 14:37:22.000000000 +0100
+++ new/haskell-src-meta-0.8.0.1/src/Language/Haskell/Meta/Parse/Careful.hs 1970-01-01 01:00:00.000000000 +0100
@@ -1,60 +0,0 @@
-{- |
-DEPRECATED: haskell-src-meta now requires GHC >= 7.4, so this module is no longer necessary. It will be GHC-warning deprecated soon.
-
-This module provides the tools to handle operator fixities in infix expressions correctly.
-
-The problem we solve is the following. Consider making a quasiquoter which antiquotes to Haskell - for instance, the quasiquoter in <http://hackage.haskell.org/package/hmatrix-static> allows me to write
-
-> myVec :: Vector Double
-> myVec = [vec| 2+3*4, 5-4-3 |]
-
-To correctly parse such expressions, we need to know the fixities and precedences of the operators, so that the above is parsed the same way as
-
-> myVec = [vec| 2+(3*4), (5-4)-3 |]
-
-There is a danger, if we are not careful in parsing, that the above expression instead parses as
-
-> myVec = [vec| (2+3)*4, 5-(4-3) |]
-
-which is a surprising bug, and would only be detected through testing at runtime, rather than at compile time.
-
-When this danger arises, we use this \"careful\" module. It handles \"unresolved infix\" expressions such as @2+3*4@ in two ways, depending on the version of GHC:
-
- * in GHC 7.4 and above (where support for \"unresolved infix\" was added in Template Haskell), resolution of the infix expression is deferred to the compiler, which has all fixities available to it.
-
- * prior to GHC 7.4, any ambiguous infix expression is flagged as a parse error at compile time, and the user is advised to resolve the ambiguity by adding parentheses.
-
--}
-module Language.Haskell.Meta.Parse.Careful(
- parsePat,
- parseExp,
- parseType,
- parseDecs
- ) where
-
-import qualified Language.Haskell.Meta.Parse as Sloppy
-import qualified Language.Haskell.Meta.Syntax.Translate as Translate
-import qualified Language.Haskell.TH as TH
-import qualified Language.Haskell.Exts.Syntax as Hs
-
-doChecked parser translater p =
- case parser p of
- Left s -> Left s
- Right p' | amb p' -> Left "Infix expression could not be resolved as operator fixities are not known. Resolve ambiguity by adding parentheses"
- | otherwise -> Right (translater p')
-
-parsePat :: String -> Either String TH.Pat
-parsePat = doChecked Sloppy.parseHsPat Translate.toPat
-
-parseExp :: String -> Either String TH.Exp
-parseExp = doChecked Sloppy.parseHsExp Translate.toExp
-
-parseType :: String -> Either String TH.Type
-parseType = doChecked Sloppy.parseHsType Translate.toType
-
-parseDecs :: String -> Either String [TH.Dec]
-parseDecs = doChecked Sloppy.parseHsDecls Translate.toDecs
-
--- This was more complicated, but since support for GHC pre-7.4 was dropped,
--- it's no longer necessary
-amb = const False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-src-meta-0.7.0.1/src/Language/Haskell/Meta/Syntax/Translate.hs new/haskell-src-meta-0.8.0.1/src/Language/Haskell/Meta/Syntax/Translate.hs
--- old/haskell-src-meta-0.7.0.1/src/Language/Haskell/Meta/Syntax/Translate.hs 2017-01-11 14:37:22.000000000 +0100
+++ new/haskell-src-meta-0.8.0.1/src/Language/Haskell/Meta/Syntax/Translate.hs 2017-05-31 20:40:48.000000000 +0200
@@ -42,11 +42,20 @@
class ToTyVars a where toTyVars :: a -> [TyVarBndr]
#if MIN_VERSION_haskell_src_exts(1,18,0)
class ToMaybeKind a where toMaybeKind :: a -> Maybe Kind
+#endif
#if MIN_VERSION_template_haskell(2,11,0)
class ToInjectivityAnn a where toInjectivityAnn :: a -> InjectivityAnn
#endif
+
+#if MIN_VERSION_template_haskell(2,12,0)
+#elif MIN_VERSION_template_haskell(2,11,0)
+type DerivClause = Pred
+#else
+type DerivClause = Name
#endif
+class ToDerivClauses a where toDerivClauses :: a -> [DerivClause]
+
-- for error messages
moduleName = "Language.Haskell.Meta.Syntax.Translate"
@@ -342,7 +351,6 @@
toStrictType :: Hs.Type l -> StrictType
-#if MIN_VERSION_haskell_src_exts(1,18,0)
#if MIN_VERSION_template_haskell(2,11,0)
toStrictType (Hs.TyBang _ s u t) = (Bang (toUnpack u) (toStrict s), toType t)
where
@@ -353,7 +361,7 @@
toUnpack (Hs.NoUnpack _) = SourceNoUnpack
toUnpack (Hs.NoUnpackPragma _) = NoSourceUnpackedness
toStrictType x = (Bang NoSourceUnpackedness NoSourceStrictness, toType x)
-#else
+#elif MIN_VERSION_haskell_src_exts(1,18,0)
-- TyBang l (BangType l) (Unpackedness l) (Type l)
-- data BangType l = BangedTy l | LazyTy l | NoStrictAnnot l
-- data Unpackedness l = Unpack l | NoUnpack l | NoUnpackPragma l
@@ -364,25 +372,12 @@
toStrict _ (Hs.Unpack _) = Unpacked
toStrict _ _ = NotStrict
toStrictType x = (NotStrict, toType x)
-#endif
#else
-#if MIN_VERSION_template_haskell(2,11,0)
-toStrictType (Hs.TyBang _ (Hs.UnpackedTy _) t) = toStrictType2 SourceUnpack t
-toStrictType t = toStrictType2 NoSourceUnpackedness t
-
-toStrictType2 u t(a)(Hs.TyBang _ _ Hs.TyBang{}) =
- nonsense "toStrictType" "double strictness annotation" t
-toStrictType2 u (Hs.TyBang _ (Hs.BangedTy _) t) = (Bang u SourceStrict, toType t)
-toStrictType2 u (Hs.TyBang _ (Hs.UnpackedTy _) t) =
- nonsense "toStrictType" "double unpackedness annotation" t
-toStrictType2 u t = (Bang u NoSourceStrictness, toType t)
-#else /* !MIN_VERSION_template_haskell(2,11,0) */
toStrictType t(a)(Hs.TyBang _ _ Hs.TyBang{}) =
nonsense "toStrictType" "double strictness annotation" t
toStrictType (Hs.TyBang _ (Hs.BangedTy _) t) = (IsStrict, toType t)
toStrictType (Hs.TyBang _ (Hs.UnpackedTy _) t) = (Unpacked, toType t)
toStrictType t = (NotStrict, toType t)
-#endif /* !MIN_VERSION_template_haskell(2,11,0) */
#endif
@@ -402,16 +397,20 @@
toPred a(a)Hs.IParam{} = noTH "toCxt" a
toPred p = todo "toPred" p
-#if MIN_VERSION_template_haskell(2,11,0)
-instance ToCxt (Hs.Deriving l) where
- toCxt (Hs.Deriving _ rule) = toCxt rule
-instance ToCxt [Hs.InstRule l] where
- toCxt = concatMap toCxt
+#if MIN_VERSION_template_haskell(2,12,0)
+instance ToDerivClauses (Hs.Deriving l) where
+ toDerivClauses (Hs.Deriving _ irules) = [DerivClause Nothing (map toType irules)]
+#elif MIN_VERSION_template_haskell(2,11,0)
+instance ToDerivClauses (Hs.Deriving l) where
+ toDerivClauses (Hs.Deriving _ irules) = map toType irules
+#else
+instance ToDerivClauses (Hs.Deriving l) where
+ toDerivClauses (Hs.Deriving _ irules) = concatMap toNames irules
#endif
-instance ToCxt a => ToCxt (Maybe a) where
- toCxt Nothing = []
- toCxt (Just a) = toCxt a
+instance ToDerivClauses a => ToDerivClauses (Maybe a) where
+ toDerivClauses Nothing = []
+ toDerivClauses (Just a) = toDerivClauses a
foldAppT :: Type -> [Type] -> Type
foldAppT t ts = foldl' AppT t ts
@@ -444,13 +443,7 @@
Nothing
#endif
(fmap qualConDeclToCon qcds)
-#if MIN_VERSION_template_haskell(2,11,0)
- -- Convert a Deriving into a list of types, one for each derived class
- -- Assumes that the types do not have any contexts
- (maybe [] (\(Hs.Deriving _ q) -> map toType q) qns)
-#else
- (toNames qns)
-#endif
+ (toDerivClauses qns)
Hs.NewType _ -> let qcd = case qcds of
[x] -> x
_ -> nonsense "toDec" ("newtype with " ++
@@ -462,11 +455,7 @@
Nothing
#endif
(qualConDeclToCon qcd)
-#if MIN_VERSION_template_haskell(2,11,0)
- (maybe [] (\(Hs.Deriving _ q) -> map toType q) qns)
-#else
- (toNames qns)
-#endif
+ (toDerivClauses qns)
-- This type-signature conversion is just wrong.
-- Type variables need to be dealt with. /Jonas
@@ -483,7 +472,6 @@
inline | b = Inline | otherwise = NoInline
#if MIN_VERSION_template_haskell(2,11,0)
-#if MIN_VERSION_haskell_src_exts(1,18,0)
toDec (Hs.TypeFamDecl _ h sig inj)
= OpenTypeFamilyD $ TypeFamilyHead (toName h)
(toTyVars h)
@@ -491,19 +479,7 @@
(fmap toInjectivityAnn inj)
toDec (Hs.DataFamDecl _ _ h sig)
= DataFamilyD (toName h) (toTyVars h) (toMaybeKind sig)
-#else
- toDec (Hs.TypeFamDecl _ h k)
- = OpenTypeFamilyD $ TypeFamilyHead (toName h)
- (toTyVars h)
- (maybe NoSig (KindSig . toKind) k)
- Nothing
- -- TODO: do something with context?
- toDec (Hs.DataFamDecl _ _ h k)
- = DataFamilyD (toName h) (toTyVars h) (fmap toKind k)
-#endif
-
-#else
-#if MIN_VERSION_haskell_src_exts(1,18,0)
+#elif MIN_VERSION_haskell_src_exts(1,18,0)
toDec (Hs.TypeFamDecl _ h sig inj)
= FamilyD TypeFam (toName h) (toTyVars h) (toMaybeKind sig)
toDec (Hs.DataFamDecl _ _ h sig)
@@ -516,7 +492,6 @@
toDec (Hs.DataFamDecl _ _ h k)
= FamilyD DataFam (toName h) (toTyVars h) (fmap toKind k)
#endif
-#endif /* MIN_VERSION_template_haskell(2,11,0) */
toDec a(a)(Hs.FunBind _ mtchs) = hsMatchesToFunD mtchs
toDec (Hs.PatBind _ p rhs bnds) = ValD (toPat p)
@@ -561,12 +536,12 @@
instance ToMaybeKind a => ToMaybeKind (Maybe a) where
toMaybeKind Nothing = Nothing
toMaybeKind (Just a) = toMaybeKind a
+#endif
#if MIN_VERSION_template_haskell(2,11,0)
instance ToInjectivityAnn (Hs.InjectivityInfo l) where
toInjectivityAnn (Hs.InjectivityInfo _ n ns) = InjectivityAnn (toName n) (fmap toName ns)
#endif
-#endif
transAct :: Maybe (Hs.Activation l) -> Phases
transAct Nothing = AllPhases
@@ -610,6 +585,10 @@
Hs.CxSingle _ x' -> [toPred x']
Hs.CxTuple _ xs -> fmap toPred xs
+instance ToCxt a => ToCxt (Maybe a) where
+ toCxt Nothing = []
+ toCxt (Just a) = toCxt a
+
instance ToType (Hs.InstRule l) where
toType (Hs.IRule _ _ _ h) = toType h
toType (Hs.IParen _ irule) = toType irule
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-src-meta-0.7.0.1/src/Language/Haskell/TH/Instances/Lift.hs new/haskell-src-meta-0.8.0.1/src/Language/Haskell/TH/Instances/Lift.hs
--- old/haskell-src-meta-0.7.0.1/src/Language/Haskell/TH/Instances/Lift.hs 2017-01-11 14:37:22.000000000 +0100
+++ new/haskell-src-meta-0.8.0.1/src/Language/Haskell/TH/Instances/Lift.hs 1970-01-01 01:00:00.000000000 +0100
@@ -1,16 +0,0 @@
-{- |
- Module : Language.Haskell.TH.Instances.Lift
- Copyright : (c) Matt Morrow 2008
- License : BSD3
- Maintainer : Matt Morrow <mjm2002(a)gmail.com>
- Stability : experimental
- Portability : portable (template-haskell)
-
- This module is exported for backwards-compatibility purposes.
- All it does is re-export the instances defined in
- "Language.Haskell.TH.Instances", from the th-orphans package.
--}
-module Language.Haskell.TH.Instances.Lift
- {-# DEPRECATED "Use the th-orphans package instead." #-} () where
-
-import Language.Haskell.TH.Instances
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-src-meta-0.7.0.1/tests/Main.hs new/haskell-src-meta-0.8.0.1/tests/Main.hs
--- old/haskell-src-meta-0.7.0.1/tests/Main.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/haskell-src-meta-0.8.0.1/tests/Main.hs 2017-05-31 20:40:48.000000000 +0200
@@ -0,0 +1,33 @@
+{-# LANGUAGE CPP #-}
+
+module Main where
+
+import Language.Haskell.Meta.Parse
+#if MIN_VERSION_haskell_src_exts(1,18,0)
+import qualified Language.Haskell.Exts as Exts
+#else
+import qualified Language.Haskell.Exts.Annotated as Exts
+#endif
+import qualified Language.Haskell.TH as TH
+import Test.Framework
+import Test.Framework.Providers.HUnit
+import Test.HUnit (Assertion, (@?=))
+
+main :: IO ()
+main = defaultMain tests
+
+tests :: [Test]
+tests = [derivingClausesTest]
+
+derivingClausesTest :: Test
+derivingClausesTest = testCase "Deriving clauses preserved" $
+ roundTripDecls "data Foo = Foo deriving (A, B, C)"
+
+roundTripDecls :: String -> Assertion
+roundTripDecls s = do
+ declsExts <- liftEither $ parseHsDecls s
+ declsExts' <- liftEither $ parseDecs s >>= parseHsDecls . TH.pprint
+ declsExts' @?= declsExts
+
+liftEither :: Monad m => Either String a -> m a
+liftEither = either fail return
[View Less]
1
0
Hello community,
here is the log from the commit of package ghc-haskell-names for openSUSE:Factory checked in at 2017-08-31 20:47:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-haskell-names (Old)
and /work/SRC/openSUSE:Factory/.ghc-haskell-names.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-haskell-names"
Thu Aug 31 20:47:25 2017 rev:2 rq:513366 version:0.8.0
…
[View More]Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-haskell-names/ghc-haskell-names.changes 2017-04-12 18:06:40.838857563 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-haskell-names.new/ghc-haskell-names.changes 2017-08-31 20:47:26.319456786 +0200
@@ -1,0 +2,5 @@
+Fri Jul 28 07:54:15 UTC 2017 - psimons(a)suse.com
+
+- Relax the over-specified version constraint on aeson.
+
+-------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-haskell-names.spec ++++++
--- /var/tmp/diff_new_pack.FYpU01/_old 2017-08-31 20:47:27.143341142 +0200
+++ /var/tmp/diff_new_pack.FYpU01/_new 2017-08-31 20:47:27.143341142 +0200
@@ -63,6 +63,7 @@
%prep
%setup -q -n %{pkg_name}-%{version}
+cabal-tweak-dep-ver aeson '< 1.1' ' < 2'
%build
%ghc_lib_build
[View Less]
1
0
31 Aug '17
Hello community,
here is the log from the commit of package ghc-happstack-authenticate for openSUSE:Factory checked in at 2017-08-31 20:47:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-happstack-authenticate (Old)
and /work/SRC/openSUSE:Factory/.ghc-happstack-authenticate.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-happstack-authenticate"
Thu Aug 31 20:47:22 …
[View More]2017 rev:2 rq:513362 version:2.3.4.7
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-happstack-authenticate/ghc-happstack-authenticate.changes 2017-05-17 10:52:32.934065153 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-happstack-authenticate.new/ghc-happstack-authenticate.changes 2017-08-31 20:47:24.747677409 +0200
@@ -1,0 +2,5 @@
+Fri Jul 28 09:56:13 UTC 2017 - psimons(a)suse.com
+
+- Relax over-specified version constraint on ghc-email-validate.
+
+-------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-happstack-authenticate.spec ++++++
--- /var/tmp/diff_new_pack.lwjqVS/_old 2017-08-31 20:47:25.559563449 +0200
+++ /var/tmp/diff_new_pack.lwjqVS/_new 2017-08-31 20:47:25.571561764 +0200
@@ -84,6 +84,7 @@
%prep
%setup -q -n %{pkg_name}-%{version}
+cabal-tweak-dep-ver email-validate '< 2.3' ' < 2.4'
%build
%ghc_lib_build
[View Less]
1
0
Hello community,
here is the log from the commit of package ghc-gogol-core for openSUSE:Factory checked in at 2017-08-31 20:47:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-gogol-core (Old)
and /work/SRC/openSUSE:Factory/.ghc-gogol-core.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-gogol-core"
Thu Aug 31 20:47:20 2017 rev:2 rq:513292 version:0.3.0
Changes:
-------…
[View More]-
--- /work/SRC/openSUSE:Factory/ghc-gogol-core/ghc-gogol-core.changes 2017-05-10 20:39:47.821608489 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-gogol-core.new/ghc-gogol-core.changes 2017-08-31 20:47:20.928213529 +0200
@@ -1,0 +2,5 @@
+Thu Jul 27 14:07:38 UTC 2017 - psimons(a)suse.com
+
+- Update to version 0.3.0.
+
+-------------------------------------------------------------------
Old:
----
gogol-core-0.1.1.tar.gz
gogol-core.cabal
New:
----
gogol-core-0.3.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-gogol-core.spec ++++++
--- /var/tmp/diff_new_pack.Y2kiWb/_old 2017-08-31 20:47:21.784093394 +0200
+++ /var/tmp/diff_new_pack.Y2kiWb/_new 2017-08-31 20:47:21.788092832 +0200
@@ -19,14 +19,13 @@
%global pkg_name gogol-core
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 0.1.1
+Version: 0.3.0
Release: 0
Summary: Core data types and functionality for Gogol libraries
License: MPL-2.0
Group: Development/Languages/Other
Url: https://hackage.haskell.org/package/%{pkg_name}
Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{ve…
-Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal…
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-aeson-devel
BuildRequires: ghc-attoparsec-devel
@@ -42,7 +41,6 @@
BuildRequires: ghc-http-media-devel
BuildRequires: ghc-http-types-devel
BuildRequires: ghc-lens-devel
-BuildRequires: ghc-memory-devel
BuildRequires: ghc-resourcet-devel
BuildRequires: ghc-rpm-macros
BuildRequires: ghc-scientific-devel
@@ -76,7 +74,6 @@
%prep
%setup -q -n %{pkg_name}-%{version}
-cp -p %{SOURCE1} %{pkg_name}.cabal
%build
%ghc_lib_build
++++++ gogol-core-0.1.1.tar.gz -> gogol-core-0.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gogol-core-0.1.1/gogol-core.cabal new/gogol-core-0.3.0/gogol-core.cabal
--- old/gogol-core-0.1.1/gogol-core.cabal 2016-11-03 14:21:01.000000000 +0100
+++ new/gogol-core-0.3.0/gogol-core.cabal 2017-07-12 16:45:05.000000000 +0200
@@ -1,5 +1,5 @@
name: gogol-core
-version: 0.1.1
+version: 0.3.0
synopsis: Core data types and functionality for Gogol libraries.
homepage: https://github.com/brendanhay/gogol
bug-reports: https://github.com/brendanhay/gogol/issues
@@ -36,7 +36,7 @@
ghc-options: -Wall
exposed-modules:
- Network.Google.Data.Base64
+ Network.Google.Data.Bytes
, Network.Google.Data.JSON
, Network.Google.Data.Numeric
, Network.Google.Data.Time
@@ -59,7 +59,6 @@
, http-media >= 0.6
, http-types >= 0.8.6
, lens >= 4.4
- , memory >= 0.8
, resourcet >= 1.1
, scientific >= 0.3
, servant >= 0.4.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gogol-core-0.1.1/src/Network/Google/Data/Base64.hs new/gogol-core-0.3.0/src/Network/Google/Data/Base64.hs
--- old/gogol-core-0.1.1/src/Network/Google/Data/Base64.hs 2016-11-03 14:21:01.000000000 +0100
+++ new/gogol-core-0.3.0/src/Network/Google/Data/Base64.hs 1970-01-01 01:00:00.000000000 +0100
@@ -1,53 +0,0 @@
-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-
--- |
--- Module : Network.Google.Data.Base64
--- Copyright : (c) 2013-2016 Brendan Hay
--- License : Mozilla Public License, v. 2.0.
--- Maintainer : Brendan Hay <brendan.g.hay(a)gmail.com>
--- Stability : provisional
--- Portability : non-portable (GHC extensions)
---
-module Network.Google.Data.Base64
- ( Base64 (..)
- , _Base64
- ) where
-
-import Control.Lens (Iso', iso)
-import Data.Aeson (FromJSON (..), ToJSON (..))
-import qualified Data.ByteArray.Encoding as BA
-import Data.ByteString (ByteString)
-import qualified Data.ByteString.Char8 as BS8
-import Data.Data (Data, Typeable)
-import Data.Hashable
-import qualified Data.Text.Encoding as Text
-import GHC.Generics (Generic)
-import Network.Google.Data.JSON (parseJSONText, toJSONText)
-import Web.HttpApiData (FromHttpApiData (..),
- ToHttpApiData (..))
-
--- | Base64 encoded binary data.
---
--- Encoding\/decoding is automatically deferred to serialisation and deserialisation
--- respectively.
-newtype Base64 = Base64 { unBase64 :: ByteString }
- deriving (Eq, Read, Ord, Data, Typeable, Generic)
-
-instance Hashable Base64
-
-_Base64 :: Iso' Base64 ByteString
-_Base64 = iso unBase64 Base64
-
-instance ToHttpApiData Base64 where
- toQueryParam = Text.decodeUtf8 . toHeader
- toHeader = BA.convertToBase BA.Base64 . unBase64
-
-instance FromHttpApiData Base64 where
- parseQueryParam = parseHeader . Text.encodeUtf8
- parseHeader = either fail (pure . Base64) . BA.convertFromBase BA.Base64
-
-instance Show Base64 where show = show . BS8.unpack . unBase64
-instance FromJSON Base64 where parseJSON = parseJSONText "Base64"
-instance ToJSON Base64 where toJSON = toJSONText
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gogol-core-0.1.1/src/Network/Google/Data/Bytes.hs new/gogol-core-0.3.0/src/Network/Google/Data/Bytes.hs
--- old/gogol-core-0.1.1/src/Network/Google/Data/Bytes.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/gogol-core-0.3.0/src/Network/Google/Data/Bytes.hs 2017-07-12 16:45:05.000000000 +0200
@@ -0,0 +1,49 @@
+{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+
+-- |
+-- Module : Network.Google.Data.Bytes
+-- Copyright : (c) 2013-2016 Brendan Hay
+-- License : Mozilla Public License, v. 2.0.
+-- Maintainer : Brendan Hay <brendan.g.hay(a)gmail.com>
+-- Stability : provisional
+-- Portability : non-portable (GHC extensions)
+--
+module Network.Google.Data.Bytes
+ ( Bytes (..)
+ , _Bytes
+ ) where
+
+import Control.Lens (Iso', iso)
+import Data.Aeson (FromJSON (..), ToJSON (..))
+import Data.ByteString (ByteString)
+import Data.Data (Data, Typeable)
+import Data.Hashable
+import qualified Data.Text.Encoding as Text
+import GHC.Generics (Generic)
+import Network.Google.Data.JSON (parseJSONText, toJSONText)
+import Web.HttpApiData (FromHttpApiData (..),
+ ToHttpApiData (..))
+-- | Binary data.
+--
+-- This data is passed to/from the serialisation routines as-is, and any
+-- particular encoding or decoding (say, base64) is left up to the caller.
+newtype Bytes = Bytes { unBytes :: ByteString }
+ deriving (Eq, Show, Read, Ord, Data, Typeable, Generic)
+
+instance Hashable Bytes
+
+_Bytes :: Iso' Bytes ByteString
+_Bytes = iso unBytes Bytes
+
+instance ToHttpApiData Bytes where
+ toQueryParam = Text.decodeUtf8 . unBytes
+ toHeader = unBytes
+
+instance FromHttpApiData Bytes where
+ parseQueryParam = pure . Bytes . Text.encodeUtf8
+ parseHeader = pure . Bytes
+
+instance FromJSON Bytes where parseJSON = parseJSONText "Bytes"
+instance ToJSON Bytes where toJSON = toJSONText
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gogol-core-0.1.1/src/Network/Google/Data/Time.hs new/gogol-core-0.3.0/src/Network/Google/Data/Time.hs
--- old/gogol-core-0.1.1/src/Network/Google/Data/Time.hs 2016-11-03 14:21:01.000000000 +0100
+++ new/gogol-core-0.3.0/src/Network/Google/Data/Time.hs 2017-07-12 16:45:05.000000000 +0200
@@ -1,3 +1,4 @@
+{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
@@ -22,6 +23,7 @@
, _Duration
) where
+import Data.Monoid ((<>))
import Control.Lens
import Data.Aeson
import qualified Data.Aeson.Types as Aeson
@@ -86,7 +88,7 @@
instance ToHttpApiData Duration where
toQueryParam =
LText.toStrict
- . Build.toLazyText
+ . (\seconds -> Build.toLazyText seconds <> "s")
. Sci.formatScientificBuilder Sci.Fixed (Just 9)
. unDuration
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gogol-core-0.1.1/src/Network/Google/Prelude.hs new/gogol-core-0.3.0/src/Network/Google/Prelude.hs
--- old/gogol-core-0.1.1/src/Network/Google/Prelude.hs 2016-11-03 14:21:01.000000000 +0100
+++ new/gogol-core-0.3.0/src/Network/Google/Prelude.hs 2017-07-12 16:45:05.000000000 +0200
@@ -27,11 +27,11 @@
import Network.HTTP.Client as Export (RequestBody)
import Numeric.Natural as Export (Natural)
import Prelude as Export hiding (product)
-import Servant.API as Export hiding (Headers, getResponse)
+import Servant.API as Export hiding (Headers, Link, getResponse)
import Servant.Utils.Links as Export hiding (Link)
import Web.HttpApiData as Export (FromHttpApiData (..), ToHttpApiData (..))
-import Network.Google.Data.Base64 as Export
+import Network.Google.Data.Bytes as Export
import Network.Google.Data.JSON as Export
import Network.Google.Data.Numeric as Export
import Network.Google.Data.Time as Export
[View Less]
1
0
Hello community,
here is the log from the commit of package ghc-glazier-pipes for openSUSE:Factory checked in at 2017-08-31 20:47:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-glazier-pipes (Old)
and /work/SRC/openSUSE:Factory/.ghc-glazier-pipes.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-glazier-pipes"
Thu Aug 31 20:47:18 2017 rev:2 rq:513257 version:0.1.5.1
…
[View More]Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-glazier-pipes/ghc-glazier-pipes.changes 2017-05-10 20:47:29.856415309 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-glazier-pipes.new/ghc-glazier-pipes.changes 2017-08-31 20:47:19.512412258 +0200
@@ -1,0 +2,5 @@
+Thu Jul 27 14:08:15 UTC 2017 - psimons(a)suse.com
+
+- Update to version 0.1.5.1.
+
+-------------------------------------------------------------------
Old:
----
glazier-pipes-0.1.4.0.tar.gz
New:
----
glazier-pipes-0.1.5.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-glazier-pipes.spec ++++++
--- /var/tmp/diff_new_pack.xJxXEG/_old 2017-08-31 20:47:20.692246651 +0200
+++ /var/tmp/diff_new_pack.xJxXEG/_new 2017-08-31 20:47:20.696246089 +0200
@@ -18,21 +18,17 @@
%global pkg_name glazier-pipes
Name: ghc-%{pkg_name}
-Version: 0.1.4.0
+Version: 0.1.5.1
Release: 0
-Summary: Converts Glazier widgets into a Pipe
+Summary: A threaded rendering framework using glaizer and pipes
License: BSD-3-Clause
Group: Development/Languages/Other
Url: https://hackage.haskell.org/package/%{pkg_name}
Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{ve…
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-glazier-devel
-BuildRequires: ghc-lens-devel
BuildRequires: ghc-mmorph-devel
-BuildRequires: ghc-mtl-devel
-BuildRequires: ghc-pipes-concurrency-devel
BuildRequires: ghc-pipes-devel
-BuildRequires: ghc-pipes-misc-devel
BuildRequires: ghc-rpm-macros
BuildRequires: ghc-stm-devel
BuildRequires: ghc-stm-extras-devel
@@ -40,7 +36,7 @@
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
-Converts Glazier widgets into a Pipe.
+A threaded rendering framework using glaizer and pipes.
%package devel
Summary: Haskell %{pkg_name} library development files
++++++ glazier-pipes-0.1.4.0.tar.gz -> glazier-pipes-0.1.5.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glazier-pipes-0.1.4.0/LICENSE new/glazier-pipes-0.1.5.1/LICENSE
--- old/glazier-pipes-0.1.4.0/LICENSE 2017-01-14 04:53:33.000000000 +0100
+++ new/glazier-pipes-0.1.5.1/LICENSE 2017-03-06 21:31:29.000000000 +0100
@@ -1,4 +1,4 @@
-Copyright Author name here (c) 2017
+Copyright Louis Pan (c) 2017
All rights reserved.
@@ -13,7 +13,7 @@
disclaimer in the documentation and/or other materials provided
with the distribution.
- * Neither the name of Author name here nor the names of other
+ * Neither the name of Louis Pan nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
@@ -27,4 +27,4 @@
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glazier-pipes-0.1.4.0/glazier-pipes.cabal new/glazier-pipes-0.1.5.1/glazier-pipes.cabal
--- old/glazier-pipes-0.1.4.0/glazier-pipes.cabal 2017-02-03 22:31:12.000000000 +0100
+++ new/glazier-pipes-0.1.5.1/glazier-pipes.cabal 2017-03-06 21:39:36.000000000 +0100
@@ -1,6 +1,6 @@
name: glazier-pipes
-version: 0.1.4.0
-synopsis: Converts Glazier widgets into a Pipe.
+version: 0.1.5.1
+synopsis: A threaded rendering framework using glaizer and pipes
description: Please see README.md
homepage: https://github.com/louispan/glazier-pipes#readme
license: BSD3
@@ -16,17 +16,11 @@
library
hs-source-dirs: src
- exposed-modules: Glazier.Pipes.Lazy
- Glazier.Pipes.Strict
- Glazier.Pipes.Ui
+ exposed-modules: Glazier.Pipes.Ui
build-depends: base >= 4.7 && < 5
- , glazier >= 0.7 && < 1
- , lens >= 4 && < 5
+ , glazier >= 0.8 && < 1
, mmorph >= 1 && < 2
- , mtl >= 2 && < 3
, pipes >= 4 && < 5
- , pipes-concurrency >= 2 && < 3
- , pipes-misc >= 0.2.3 && < 1
, stm >= 2.4 && < 3
, stm-extras > 0.1 && < 1
, transformers >= 0.4 && < 0.6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glazier-pipes-0.1.4.0/src/Glazier/Pipes/Lazy.hs new/glazier-pipes-0.1.5.1/src/Glazier/Pipes/Lazy.hs
--- old/glazier-pipes-0.1.4.0/src/Glazier/Pipes/Lazy.hs 2017-02-02 11:13:33.000000000 +0100
+++ new/glazier-pipes-0.1.5.1/src/Glazier/Pipes/Lazy.hs 1970-01-01 01:00:00.000000000 +0100
@@ -1,35 +0,0 @@
-{-# LANGUAGE RankNTypes #-}
-
-module Glazier.Pipes.Lazy where
-
-import Control.Concurrent
-import Control.Concurrent.STM
-import Control.Concurrent.STM.TMVar.Extras as STE
-import Control.Lens
-import Control.Monad.Morph
-import Control.Monad.State.Lazy
-import Control.Monad.Trans.Maybe
-import qualified Glazier.Gadget.Lazy as G
-import qualified Pipes as P
-import qualified Pipes.Concurrent as PC
-import qualified Pipes.Lift as PL
-import qualified Pipes.Misc.Concurrent as PM
-import qualified Pipes.Misc.State.Lazy as PM
-
--- | Converts a 'Glazier.Gadget' into a 'Pipes.Pipe'
-gadgetToPipe :: (Monad m, MonadTrans t, MonadState s (t m)) => G.Gadget s m a c -> P.Pipe a c (t m) r
-gadgetToPipe g = forever $ do
- a <- P.await
- s <- get
- -- This is the only line that is different between the Strict and Lazy version
- ~(c, s') <- lift . lift $ view G._Gadget g a s
- put s'
- P.yield c
-{-# INLINABLE gadgetToPipe #-}
-
--- | Convert a 'Pipes.Concurrent.Input' and a 'Glazier.Gadget' into a stateful 'Pipes.Producer' of commands to interpret.
-gadgetToProducer ::
- (MonadState s (t STM), MonadTrans t) =>
- PC.Input a -> G.Gadget s STM a c -> P.Producer' c (t STM) ()
-gadgetToProducer input g = hoist lift (PM.fromInputSTM input) P.>-> gadgetToPipe g
-{-# INLINABLE gadgetToProducer #-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glazier-pipes-0.1.4.0/src/Glazier/Pipes/Strict.hs new/glazier-pipes-0.1.5.1/src/Glazier/Pipes/Strict.hs
--- old/glazier-pipes-0.1.4.0/src/Glazier/Pipes/Strict.hs 2017-02-03 22:30:33.000000000 +0100
+++ new/glazier-pipes-0.1.5.1/src/Glazier/Pipes/Strict.hs 1970-01-01 01:00:00.000000000 +0100
@@ -1,38 +0,0 @@
-{-# LANGUAGE RankNTypes #-}
-
-module Glazier.Pipes.Strict where
-
-import Control.Concurrent
-import Control.Concurrent.STM
-import Control.Concurrent.STM.TMVar.Extras as STE
-import Control.Lens
-import Control.Monad.Morph
-import Control.Monad.State.Strict
-import Control.Monad.Trans.Maybe
-import qualified Glazier.Gadget.Strict as G
-import qualified Pipes as P
-import qualified Pipes.Concurrent as PC
-import qualified Pipes.Lift as PL
-import qualified Pipes.Misc.Concurrent as PM
-import qualified Pipes.Misc.State.Strict as PM
-import qualified Pipes.Prelude as PP
-import qualified Pipes.Internal as PI
-
-
--- | Converts a 'Glazier.Gadget' into a 'Pipes.Pipe'
-gadgetToPipe :: (Monad m, MonadTrans t, MonadState s (t m)) => G.Gadget s m a c -> P.Pipe a c (t m) r
-gadgetToPipe g = forever $ do
- a <- P.await
- s <- get
- -- This is the only line that is different between the Strict and Lazy version
- (c, s') <- lift . lift $ view G._Gadget g a s
- put s'
- P.yield c
-{-# INLINABLE gadgetToPipe #-}
-
--- | Convert a 'Pipes.Concurrent.Input' and a 'Glazier.Gadget' into a stateful 'Pipes.Producer' of commands to interpret.
-gadgetToProducer ::
- (MonadState s (t STM), MonadTrans t) =>
- PC.Input a -> G.Gadget s STM a c -> P.Producer' c (t STM) ()
-gadgetToProducer input g = hoist lift (PM.fromInputSTM input) P.>-> gadgetToPipe g
-{-# INLINABLE gadgetToProducer #-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glazier-pipes-0.1.4.0/src/Glazier/Pipes/Ui.hs new/glazier-pipes-0.1.5.1/src/Glazier/Pipes/Ui.hs
--- old/glazier-pipes-0.1.4.0/src/Glazier/Pipes/Ui.hs 2017-02-03 22:38:47.000000000 +0100
+++ new/glazier-pipes-0.1.5.1/src/Glazier/Pipes/Ui.hs 2017-02-22 22:21:37.000000000 +0100
@@ -15,6 +15,8 @@
-- | This is similar to part of the Elm startApp.
-- This is responsible for running the Glazier Gadget update tick until it quits.
-- This is also responsible for rendering the frame.
+-- This function is only required if you are not using another application framework which
+-- already takes care of rendering and processing user input.
runUi :: (MonadIO io) =>
Int
-> (s -> IO ()) -- render
@@ -57,10 +59,11 @@
lift $ render s)
(const . atomically $ putTMVar finishedRenderThread ())
- -- This is different between the Strict and Lazy version
+ -- application run
s' <- P.runEffect $
appSignal P.>-> PP.mapM
(liftIO . atomically . void . STE.forceSwapTMVar latestState) P.>-> PP.drain
+
-- cleanup
-- allow rendering of the frame one last time
liftIO . atomically $ takeTMVar enableRenderThread
[View Less]
1
0