packages feed

streamly-core 0.2.0 → 0.2.1

raw patch · 11 files changed

+103/−27 lines, 11 files

Files

Changelog.md view
@@ -1,5 +1,10 @@ # Changelog +## 0.2.1 (Dec 2023)++* Make the serialization of the unit constructor deterministic.+* Expose `pinnedSerialize` & `deserialize` via `Streamly.Data.Array`.+ ## 0.2.0 (Nov 2023)  See [0.1.0-0.2.0 API Changelog](https://github.com/composewell/streamly/blob/streamly-0.10.0/core/docs/ApiChangelogs/0.1.0-0.2.0.txt)@@ -41,7 +46,8 @@ * Fold constructor has changed, added a `final` field to support   finalization and cleanup of a chain of folds. The `extract` field is   now used only for mapping the fold internal state to fold result for-  scanning purposes.+  scanning purposes. If your fold does not require cleanup you can just use+  your existing `extract` function as `final` as well to adapt to this change. * Many low level internal modules have been removed, they are entirely   exported from higher level internal modules. If you were importing any   of the missing low level modules then import the higher level modules instead.
configure view
@@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles.-# Generated by GNU Autoconf 2.71 for streamly-core 0.2.0.+# Generated by GNU Autoconf 2.71 for streamly-core 0.2.1. # # Report bugs to <streamly@composewell.com>. #@@ -610,8 +610,8 @@ # Identity of this package. PACKAGE_NAME='streamly-core' PACKAGE_TARNAME='streamly-core'-PACKAGE_VERSION='0.2.0'-PACKAGE_STRING='streamly-core 0.2.0'+PACKAGE_VERSION='0.2.1'+PACKAGE_STRING='streamly-core 0.2.1' PACKAGE_BUGREPORT='streamly@composewell.com' PACKAGE_URL='https://streamly.composewell.com' @@ -1256,7 +1256,7 @@   # Omit some internal or obsolete options to make the list less imposing.   # This message is too long to be a string in the A/UX 3.1 sh.   cat <<_ACEOF-\`configure' configures streamly-core 0.2.0 to adapt to many kinds of systems.+\`configure' configures streamly-core 0.2.1 to adapt to many kinds of systems.  Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1318,7 +1318,7 @@  if test -n "$ac_init_help"; then   case $ac_init_help in-     short | recursive ) echo "Configuration of streamly-core 0.2.0:";;+     short | recursive ) echo "Configuration of streamly-core 0.2.1:";;    esac   cat <<\_ACEOF @@ -1404,7 +1404,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then   cat <<\_ACEOF-streamly-core configure 0.2.0+streamly-core configure 0.2.1 generated by GNU Autoconf 2.71  Copyright (C) 2021 Free Software Foundation, Inc.@@ -1622,7 +1622,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by streamly-core $as_me 0.2.0, which was+It was created by streamly-core $as_me 0.2.1, which was generated by GNU Autoconf 2.71.  Invocation command line was    $ $0$ac_configure_args_raw@@ -3832,7 +3832,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log="-This file was extended by streamly-core $as_me 0.2.0, which was+This file was extended by streamly-core $as_me 0.2.1, which was generated by GNU Autoconf 2.71.  Invocation command line was    CONFIG_FILES    = $CONFIG_FILES@@ -3888,7 +3888,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\-streamly-core config.status 0.2.0+streamly-core config.status 0.2.1 configured by $0, generated by GNU Autoconf 2.71,   with options \\"\$ac_cs_config\\" 
configure.ac view
@@ -3,7 +3,7 @@ # See https://www.gnu.org/software/autoconf/manual/autoconf.html for help on # the macros used in this file. -AC_INIT([streamly-core], [0.2.0], [streamly@composewell.com], [streamly-core], [https://streamly.composewell.com])+AC_INIT([streamly-core], [0.2.1], [streamly@composewell.com], [streamly-core], [https://streamly.composewell.com])  # To suppress "WARNING: unrecognized options: --with-compiler" AC_ARG_WITH([compiler], [GHC])
docs/Changelog.md view
@@ -1,5 +1,10 @@ # Changelog +## 0.2.1 (Dec 2023)++* Make the serialization of the unit constructor deterministic.+* Expose `pinnedSerialize` & `deserialize` via `Streamly.Data.Array`.+ ## 0.2.0 (Nov 2023)  See [0.1.0-0.2.0 API Changelog](https://github.com/composewell/streamly/blob/streamly-0.10.0/core/docs/ApiChangelogs/0.1.0-0.2.0.txt)@@ -41,7 +46,8 @@ * Fold constructor has changed, added a `final` field to support   finalization and cleanup of a chain of folds. The `extract` field is   now used only for mapping the fold internal state to fold result for-  scanning purposes.+  scanning purposes. If your fold does not require cleanup you can just use+  your existing `extract` function as `final` as well to adapt to this change. * Many low level internal modules have been removed, they are entirely   exported from higher level internal modules. If you were importing any   of the missing low level modules then import the higher level modules instead.
src/Streamly/Data/Array.hs view
@@ -83,16 +83,20 @@     -- , (!!)     , getIndex +    -- * Serialization+    , pinnedSerialize+    , deserialize+     -- * Re-exports     , Unbox (..)-+    , Serialize(..)     ) where  #include "inline.hs"  import Streamly.Internal.Data.Array-import Streamly.Internal.Data.Unbox (Unbox (..))+import Streamly.Internal.Data.MutByteArray (Unbox(..), Serialize(..))  import Prelude hiding (read, length) 
src/Streamly/Data/MutByteArray.hs view
@@ -21,9 +21,9 @@ -- Higher level unboxed array modules "Streamly.Data.Array" and -- "Streamly.Data.MutArray" are built on top of this module. Unboxed arrays are -- essentially serialized Haskell values. Array modules provide higher level--- serialization routines like 'Streamly.Data.Array.pinnedSerialize'--- and 'Streamly.Data.Array.deserialize' from the--- "Streamly.Data.Array" module.+-- serialization routines like 'Streamly.Internal.Data.Array.pinnedSerialize'+-- and 'Streamly.Internal.Data.Array.deserialize' from the+-- "Streamly.Internal.Data.Array" module. -- -- == Mutable Byte Array --@@ -55,9 +55,18 @@ -- and then use the type class methods to serialize and deserialize to and from -- a 'MutByteArray'. ----- See 'Streamly.Data.Array.pinnedSerialize' and--- 'Streamly.Data.Array.deserialize' for 'Array' type based+-- See 'Streamly.Internal.Data.Array.pinnedSerialize' and+-- 'Streamly.Internal.Data.Array.deserialize' for 'Array' type based -- serialization.+--+-- == Comparing serialized values+--+-- When using the `Unbox` type class the same value may result in differing+-- serialized bytes because of unused uninitialized data in case of sum types.+-- Therefore, byte comparison of serialized values is not reliable.+--+-- However, the 'Serialize' type class guarantees that the serialized values+-- are always exactly the same and byte comparison of serialized is reliable. -- module Streamly.Data.MutByteArray     (
src/Streamly/Internal/Data/Array.hs view
@@ -564,6 +564,10 @@         assertM(len == off)         pure $ Array mbarr 0 off +-- |+-- Properties:+-- 1. Identity: @deserialize . serialize == id@+-- 2. Encoded equivalence: @serialize a == serialize a@ {-# INLINE serialize #-} serialize :: Serialize a => a -> Array Word8 serialize = encodeAs Unpinned@@ -571,6 +575,10 @@ -- | Serialize a Haskell type to a pinned byte array. The array is allocated -- using pinned memory so that it can be used directly in OS APIs for writing -- to file or sending over the network.+--+-- Properties:+-- 1. Identity: @deserialize . pinnedSerialize == id@+-- 2. Encoded equivalence: @pinnedSerialize a == pinnedSerialize a@ {-# INLINE pinnedSerialize #-} pinnedSerialize :: Serialize a => a -> Array Word8 pinnedSerialize = encodeAs Pinned
src/Streamly/Internal/Data/Serialize/TH.hs view
@@ -217,6 +217,7 @@ mkDeserializeExpr False False headTy tyOfTy =     case tyOfTy of         -- Unit constructor+        -- XXX Should we peek and check if the byte value is 0?         UnitType cname ->             [|pure ($(varE _initialOffset) + 1, $(conE cname))|]         -- Product type@@ -341,7 +342,8 @@ mkSerializeExpr False False tyOfTy =     case tyOfTy of         -- Unit type-        UnitType _ -> [|pure ($(varE _initialOffset) + 1)|]+        UnitType _ ->+            [|serializeAt $(varE _initialOffset) $(varE _arr) (0 :: Word8)|]         -- Product type         (TheType (SimpleDataCon cname fields)) ->             letE@@ -395,7 +397,7 @@                   'serializeAt                   [ Clause                         (if isUnitType cons && not cfgConstructorTagAsString-                             then [VarP _initialOffset, WildP, WildP]+                             then [VarP _initialOffset, VarP _arr, WildP]                              else [VarP _initialOffset, VarP _arr, VarP _val])                         (NormalB pokeMethod)                         []
src/Streamly/Internal/Data/Unbox/TH.hs view
@@ -241,6 +241,7 @@ mkPeekExprOne :: Int -> DataCon -> Q Exp mkPeekExprOne tagSize (DataCon cname _ _ fields) =     case fields of+        -- XXX Should we peek and check if the byte value is 0?         [] -> [|pure $(conE cname)|]         _ ->             letE@@ -336,7 +337,9 @@             [|error                   ("Attempting to poke type with no constructors (" ++                    $(lift (pprint headTy)) ++ ")")|]-        [(DataCon _ _ _ [])] -> [|pure ()|]+        -- XXX We don't gaurentee encoded equivalilty for Unbox. Does it still+        -- make sense to encode a default value for unit constructor?+        [(DataCon _ _ _ [])] -> [|pure ()|] -- mkPokeExprTag ''Word8 0         [(DataCon cname _ _ fields)] ->             caseE                 (varE _val)
src/Streamly/Internal/Unicode/Parser.hs view
@@ -300,6 +300,9 @@   | SPExponentWithSign !Multiplier !Number !DecimalPlaces !PowerMultiplier   | SPAfterExponent !Multiplier !Number !DecimalPlaces !PowerMultiplier !Power +-- XXX See https://hackage.haskell.org/package/integer-conversion for large+-- integers.+ -- | A generic parser for scientific notation of numbers. Returns (mantissa, -- exponent) tuple. The result can be mapped to 'Double' or any other number -- representation e.g. @Scientific@.
streamly-core.cabal view
@@ -1,11 +1,13 @@ cabal-version:      2.2 name:               streamly-core-version:            0.2.0-synopsis:           Streaming, parsers, arrays and more+version:            0.2.1+synopsis:           Streaming, parsers, arrays, serialization and more description:   For upgrading to streamly-0.9.0+ please read the   <https://github.com/composewell/streamly/blob/streamly-0.10.0/docs/User/Project/Upgrading-0.8-to-0.9.md Streamly-0.9.0 upgrade guide>.   .+  Streamly is a standard library for Haskell that focuses on C-like+  performance, modular combinators, and streaming data flow model.   Streamly consists of two packages: "streamly-core" and "streamly".   <https://hackage.haskell.org/package/streamly-core streamly-core>   provides basic features, and depends only on GHC boot libraries (see@@ -15,9 +17,42 @@   and networking. For documentation, visit the   <https://streamly.composewell.com Streamly website>.   .-  This package provides streams, arrays, parsers, unicode text, file-  IO, and console IO functionality.+  The streamly-core package provides the following functionality:   .+  * Streams as composable producers of a sequence of values.+  * Streams provide all the functionality provided by Haskell lists but+  in an effectful, streaming fashion with better performance.+  * Streams provide ListT and logic programming functionality as well.+  * Folds as composable stream consumers that reduce the streams to a+  single value or reduce segments of streams to transform the stream.+  * Parsers as more powerful, composable stream consumers supporting+  standard parser combinators with backtracking but in a streaming+  fashion.+  * Arrays with streaming interfaces providing high performance,+  modularity, and concise interface as all streaming operations can be+  performed on arrays.+  * Arrays can be immutable or mutable, unboxed or boxed, pinned or+  unpinned.+  * Arrays generalize the functionality provided by @bytestring@ and+  @text@ packages.+  * Interoperability with @bytestring@ and @text@ is+  provided via separate packages.+  * Arrays and folds provide natural builder functionality so there are no+  separate builder modules.+  * High performance binary serialization with configurable JSON like features.+  * Streaming combinators for unicode text processing, providing+  functionality equivalent to the @text@ package.+  * String interpolation for convenient construction of strings.+  * Streaming console IO (stdin/stdout) operations.+  * Streaming file and directory IO operations.+  .+  This package covers some or all of the functionality covered+  by @streaming, pipes, conduit, list-t, logic-t, foldl, attoparsec,+  array, primitive, vector, vector-algorithms, binary, cereal, store,+  bytestring, text, stringsearch, interpolate@. Streamly provides a+  consistent, concise, modular and performant interface for all this+  functionality.+  .   Note: The dependencies "heaps" and "monad-control" are included in   the package solely for backward compatibility, and will be removed in   future versions.@@ -467,7 +502,7 @@                      , base              >= 4.12  && < 4.20                      , exceptions        >= 0.8.0 && < 0.11                      , transformers      >= 0.5.5 && < 0.7-                     , filepath          >= 1.4.2 && < 1.5+                     , filepath          >= 1.4.2 && < 1.6                      -- streamly-unicode-core                      , template-haskell  >= 2.14  && < 2.22