### Run bench-runner Quick Start Source: https://github.com/composewell/streamly/blob/master/benchmark/README.md Execute the bench-runner with essential package information. Replace `./bench-runner` with the cabal run command if not installed. ```bash bin/bench-runner --package-version 0.0.0 --package-name streamly-benchmarks ``` -------------------------------- ### Quick Start bench-runner Source: https://github.com/composewell/streamly/blob/master/docs/Developer/Benchmarks.md Run all benchmark suites quickly using the `--quick` flag. Replace `./bench-runner` with `cabal run bench-runner --project-file=cabal.project.report --` if not installed. ```bash bin/bench-runner --package-version 0.0.0 --package-name streamly-benchmarks ./bench-runner --quick ``` -------------------------------- ### Build and Compile Standalone Example Source: https://github.com/composewell/streamly/blob/master/benchmark/README.md First, build the benchmark suite to generate the GHC environment file. Then, compile a standalone example file with specific optimization flags. ```bash $ cabal build # build and write ghc environment file $ ghc -O2 -fspec-constr-recursive=16 -fmax-worker-args=16 example.hs ``` -------------------------------- ### Install bench-runner with Nix Source: https://github.com/composewell/streamly/blob/master/benchmark/README.md Install the bench-runner executable within a Nix shell environment. ```bash $ cd benchmark/bench-runner $ nix-shell --run 'cabal install bench-runner --installdir=../../ --overwrite-policy=always' $ cd ../.. $ ./bench-runner ``` -------------------------------- ### Start GHCi with streamly-core Source: https://github.com/composewell/streamly/blob/master/docs/User/Tutorials/using-streamly.md Starts the GHCi REPL and loads the streamly-core package. This command may take time on the first run due to package building. ```bash $ cabal repl --build-depends streamly-core ... pleasing, the first time around ... GHCi, version 9.2.2: https://www.haskell.org/ghc/ :? for help ghci> ``` -------------------------------- ### Rooted Path Combination Example Source: https://github.com/composewell/streamly/blob/master/docs/Developer/FileSystem.Path.Design.rst Shows an example of combining rooted paths where the drive is fixed but the current directory can change, illustrating a scenario where a 'combine' operation might be used. ```text C:\x C:y -> C:\x\y C: C:y -> C:y -- C: equiv C:./ C:x C:y -> C:x\y ``` -------------------------------- ### Install bench-runner with Cabal Source: https://github.com/composewell/streamly/blob/master/benchmark/README.md Install the bench-runner executable locally using a specific project file and overwrite policy. ```bash $ cabal install bench-runner --project-file=cabal.project.report --installdir=./ --overwrite-policy=always $ ./bench-runner ``` -------------------------------- ### Start GHCi with a specific streamly-core version Source: https://github.com/composewell/streamly/blob/master/docs/User/Tutorials/using-streamly.md Starts the GHCi REPL and loads a specific version of the streamly-core package using a version constraint. ```bash $ cabal repl --build-depends streamly-core==0.1.0 ... ghci> ``` -------------------------------- ### Doctest Setup Snippet Source: https://github.com/composewell/streamly/blob/master/docs/Developer/Tests.md A Haddock $setup section defines a snippet that is executed before any other doctests. Ensure snippets are not enclosed in @ .. @ markup. ```haskell -- $setup -- >>> :m -- >>> import Control.Monad.IO.Class (MonadIO(..)) -- >>> import Data.Function ((&)) ``` -------------------------------- ### Create a project directory Source: https://github.com/composewell/streamly/blob/master/docs/User/Tutorials/using-streamly.md Creates a new directory for a Streamly project example. ```bash $ mkdir streamly-project ``` -------------------------------- ### Example Usage: Counting Code Points Source: https://github.com/composewell/streamly/blob/master/docs/Developer/utf8-decoder.md Demonstrates how to call the `countCodePoints` function and interpret its return value to check for malformed strings or get the character count. ```c if (countCodePoints(s, &count)) { printf("The string is malformed\n"); } else { printf("The string is %u characters long\n", count); } ``` -------------------------------- ### Start GHCi REPL for Project Source: https://github.com/composewell/streamly/blob/master/docs/User/Tutorials/using-streamly.md Launch the GHCi REPL within your project context to interactively run code and load project modules. ```bash $ cabal repl ... Ok, one module loaded. ghci> main 1 2 3 ghci> ``` -------------------------------- ### Run bench-runner without Installation Source: https://github.com/composewell/streamly/blob/master/benchmark/README.md Execute the bench-runner directly using cabal run without a prior installation. ```bash $ cabal run bench-runner --project-file=cabal.project.report -- ``` -------------------------------- ### Type Variable Ordering Example Source: https://github.com/composewell/streamly/blob/master/CONTRIBUTING.md Demonstrates the recommended ordering of type variables in `forall` declarations and constraints for streams. ```Haskell func :: forall m a. (MonadIO m, Storable a) => ... ``` -------------------------------- ### bench-runner Help and Target Selection Source: https://github.com/composewell/streamly/blob/master/docs/Developer/Benchmarks.md Get help for `bench-runner` or list available benchmark suites using `--targets help`. Run specific suites like `serial_grp` or multiple suites by name. ```bash $ ./bench-runner --help $ ./bench-runner --targets help # Show available benchmark suites $ ./bench-runner --targets serial_grp # Run all serial benchmark suites $ ./bench-runner --targets "Prelude.Serial Data.Parser" # run selected suites ``` -------------------------------- ### Scanl Step Implementation Example Source: https://github.com/composewell/streamly/blob/master/docs/Developer/Data.Scanl.md Illustrates a step function within a postscan implementation, handling initialization and subsequent processing. It shows how to transition between states based on the result of an initial or step action. ```haskell step _ (ScanInit st) = do res <- initial return $ case res of Partial fs -> Skip $ ScanDo st fs Done b -> Yield b ScanDone step gst (ScanDo st fs) = do res <- sstep st case res of Yield x s -> do ... ``` -------------------------------- ### Split Root Operation Examples Source: https://github.com/composewell/streamly/blob/master/docs/Developer/FileSystem.Path.Design.rst Demonstrates the behavior of the 'splitRoot' operation on various Posix and Windows paths, separating the root component from the unrooted path. ```text splitRoot :: Rooted -> (Rooted, Unrooted) -- Posix splitRoot "/" => ("/", ".") splitRoot "/x" => ("/", "x") -- Windows splitRoot "/" => ("/", ".") splitRoot "/x" => ("/", "x") splitRoot "C:" => ("C:", ".") splitRoot "C:/" => ("C:/", ".") splitRoot "//server/share" => ("//server/share", ".") ``` -------------------------------- ### Running Cabal Tests Directly Source: https://github.com/composewell/streamly/blob/master/CONTRIBUTING.md Example of how to run Cabal tests directly with specific optimization flags and test details. ```bash $ cabal test --disable-optimization --flags -opt --test-show-details=streaming --test-option=--color streamly-tests ``` -------------------------------- ### Compile Standalone Example with Diagnostics Source: https://github.com/composewell/streamly/blob/master/benchmark/README.md Add GHC OPTIONS_GHC pragmas to a standalone Haskell file for detailed diagnostics, including dumping simplification and enabling verbose fusion plugin output. ```haskell {-# OPTIONS_GHC -ddump-simpl -ddump-to-file -dsuppress-all -Wmissed-specialisations -Wall-missed-specialisations -fplugin Fusion.Plugin -fplugin-opt=Fusion.Plugin:verbose=2 -fplugin-opt=Fusion.Plugin:dump-core #-} ``` -------------------------------- ### Internal Module Hierarchy Example Source: https://github.com/composewell/streamly/blob/master/docs/Developer/module-organization.md Illustrates a common naming convention for organizing different types of arrays (unboxed, boxed, mutable) within an internal module hierarchy. ```text Streamly.Internal.Data.Array -- Unboxed arrays Streamly.Internal.Data.Array.Generic -- Boxed arrays Streamly.Internal.Data.MutArray -- Unboxed mutable arrays Streamly.Internal.Data.MutArray.Generic -- Boxed mutable arrays ``` -------------------------------- ### StreamD Coding Style Example Source: https://github.com/composewell/streamly/blob/master/CONTRIBUTING.md Illustrates the conventions for naming variables and structuring code within the StreamD library, focusing on scope. ```Haskell mapM f (Stream step1 state1) = Stream step state where step gst st = do r <- step1 (adaptState gst) st case r of Yield x s -> f x >>= \a -> return $ Yield a s Skip s -> return $ Skip s Stop -> return Stop ``` -------------------------------- ### Rooted and Unrooted Path Definitions Source: https://github.com/composewell/streamly/blob/master/docs/Developer/FileSystem.Path.Design.rst Provides examples of paths classified as 'Rooted' (having anchoring semantics) and 'Unrooted' (pure appendable path branches). ```text Examples of Rooted: "/", "/x", "C:", "C:x", "C:/", "//x/y". Examples of Unrooted: "x", "x/y", ".", "./x", "..", "../x". ``` -------------------------------- ### Compare Benchmark Results with Baseline Source: https://github.com/composewell/streamly/blob/master/benchmark/README.md Checkout baseline commits, run benchmarks, and append new results for comparison. Use --no-measure to display existing results. ```bash # Checkout baseline commit $ ./bench-runner --quick # Checkout commit with new changes $ ./bench-runner --quick --append # To add another result to comparisons just repeat the above command on # desired commit # To display the current results without running the benchmarks. # See "Reporting without measuring" for more info. $ ./bench-runner --no-measure ``` -------------------------------- ### bench-runner Help and Target Selection Source: https://github.com/composewell/streamly/blob/master/benchmark/README.md Display help information or select specific benchmark suites and targets for execution. Supports filtering by prefix and running specific benchmarks. ```bash $ ./bench-runner --help $ ./bench-runner --quick # run all the benchmark suites $ ./bench-runner --targets help # Show available benchmark suites $ ./bench-runner --targets serial_grp # Run all serial benchmark suites $ ./bench-runner --targets "Prelude.Serial Data.Parser" # run selected suites $ ./bench-runner --no-measure # don't run benchmarks just show previous results # Run all O(1) space complexity benchmarks in `Prelude.Serial` suite $ ./bench-runner --targets Prelude.Serial --prefix Prelude.Serial/o-1-space # Run a specific benchmark in `Prelude.Serial` suite $ ./bench-runner --targets Prelude.Serial --prefix Prelude.Serial/o-1-space.generation.unfoldr ``` -------------------------------- ### getSlice Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.2.2-0.3.0.txt Gets a slice of a mutable array. ```APIDOC ## getSlice ### Description Gets a slice of a mutable array. ### Method forall a. Unbox a => Int -> Int -> MutArray a -> MutArray a ### Parameters #### Path Parameters - **offset** (Int) - Required - The starting offset of the slice. - **length** (Int) - Required - The length of the slice. - **array** (MutArray a) - Required - The mutable array to slice. ### Response #### Success Response - **MutArray a** - The resulting slice of the mutable array. ``` -------------------------------- ### Build Benchmark Suite with Fusion Plugin Source: https://github.com/composewell/streamly/blob/master/benchmark/README.md Build a specific benchmark suite, 'bench:Prelude.Serial', with the fusion-plugin enabled after applying diagnostic GHC options. ```bash $ cabal build bench:Prelude.Serial --flag fusion-plugin ``` -------------------------------- ### getSliceUnsafe Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.2.2-0.3.0.txt Unsafely gets a slice of a mutable array. ```APIDOC ## getSliceUnsafe ### Description Unsafely gets a slice of a mutable array. ### Method forall a. Unbox a => Int -> Int -> MutArray a -> MutArray a ### Parameters #### Path Parameters - **offset** (Int) - Required - The starting offset of the slice. - **length** (Int) - Required - The length of the slice. - **array** (MutArray a) - Required - The mutable array to slice. ### Response #### Success Response - **MutArray a** - The resulting slice of the mutable array. ``` -------------------------------- ### unsafeGetIndexRev Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.2.2-0.3.0.txt Retrieves an element from a MutArray by index, starting from the end. ```APIDOC ## unsafeGetIndexRev ### Description Retrieves an element from a MutArray by index, starting from the end. Requires MonadIO and Unbox constraints. ### Method N/A (Function Signature) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **a**: The element at the specified index from the end. #### Response Example None ``` -------------------------------- ### getIndexUnsafe Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.2.2-0.3.0.txt Unsafely gets an element at a specific index from a mutable array. ```APIDOC ## getIndexUnsafe ### Description Unsafely gets an element at a specific index from a mutable array. ### Method forall m a. (MonadIO m, Unbox a) => Int -> MutArray a -> m a ### Parameters #### Path Parameters - **index** (Int) - Required - The index of the element to retrieve. - **array** (MutArray a) - Required - The mutable array to get the element from. ### Response #### Success Response - **m a** - A monadic action returning the element at the specified index. ``` -------------------------------- ### Streamly.Data.MutArray.Generic.getIndexUnsafe Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.2.2-0.3.0.txt Unsafely gets a value from a specific index in a mutable array. ```APIDOC ## Streamly.Data.MutArray.Generic.getIndexUnsafe ### Description Unsafely gets a value from a specific index in a mutable array. This operation is monadic and does not perform bounds checking. ### Method Monadic Operation ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **m a** (type) - A monadic action that returns the value at the specified index. #### Response Example N/A ``` -------------------------------- ### Run Doctests using Cabal and Cabal-Docspec Source: https://github.com/composewell/streamly/blob/master/docs/Developer/Tests.md Build all code first, then use cabal-docspec to run and check doctests. Options include setting a timeout and checking properties. ```bash $ cabal build all $ cabal-docspec --timeout 60 --check-properties --property-variables xs ``` -------------------------------- ### Streamly.Data.MutArray.Generic.unsafeGetIndex Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.2.2-0.3.0.txt Unsafely gets a value from a specific index in a mutable array. ```APIDOC ## Streamly.Data.MutArray.Generic.unsafeGetIndex ### Description Unsafely gets a value from a specific index in a mutable array. This operation is monadic and does not perform bounds checking. ### Method Monadic Operation ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **m a** (type) - A monadic action that returns the value at the specified index. #### Response Example N/A ``` -------------------------------- ### Get the name of a data type Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.1.0-0.2.0.txt Retrieves the name of a data type. ```haskell [dtName] :: DataType -> Name ``` -------------------------------- ### Get the name of a data constructor Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.1.0-0.2.0.txt Retrieves the name of a data constructor. ```haskell [dcName] :: DataCon -> Name ``` -------------------------------- ### Windows Path Composition Rules (RelFixedDrive) Source: https://github.com/composewell/streamly/blob/master/docs/Developer/FileSystem.Path.Design.rst Illustrates how paths with a fixed drive are composed. If both paths have the same drive, they are combined; otherwise, a runtime error occurs. 'C:' is treated as equivalent to 'C:./'. ```text C:\x C:y -> C:\x\y C: C:y -> C:y -- C: equiv C:./ C:x C:y -> C:x\y D:x C:y -> error \x C:y -> error x C:y -> error ``` -------------------------------- ### sliceOffLen Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.2.2-0.3.0.txt Slices a MutArray to extract a portion of a specified length starting from a given offset. ```APIDOC ## sliceOffLen ### Description Slices a MutArray to extract a portion of a specified length starting from a given offset. Requires Unbox constraint. ### Method N/A (Function Signature) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **MutArray a**: The sliced portion of the MutArray. #### Response Example None ``` -------------------------------- ### Streamly.Data.Fold.foldl1M' Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.2.2-0.3.0.txt A monadic fold that reduces a stream to a single value, starting from the first element. ```APIDOC ## Streamly.Data.Fold.foldl1M' ### Description A monadic fold that reduces a stream to a single value using a binary monadic function. It starts the reduction from the first element of the stream. Returns `Maybe a` to handle empty streams. ### Method Monadic Fold ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **Fold m a (Maybe a)** (type) - A fold that reduces a stream to a `Maybe` value. #### Response Example N/A ``` -------------------------------- ### Create and Upload Source Distribution Source: https://github.com/composewell/streamly/blob/master/docs/Developer/MAINTAINING.md Create a source distribution (sdist) and upload it to Hackage. It's recommended to use a clean workspace to avoid shipping unintended files. ```bash cabal v2-sdist; cabal upload ``` -------------------------------- ### Compile and Run a Basic Streamly Project Source: https://github.com/composewell/streamly/blob/master/docs/User/Tutorials/using-streamly.md After initializing the project, you can compile and run the default application. ```bash $ cabal run Hello, Haskell! ``` -------------------------------- ### Streamly.Data.Fold.foldlM1' Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.2.2-0.3.0.txt A monadic fold that reduces a stream to a single value, starting from the first element. ```APIDOC ## Streamly.Data.Fold.foldlM1' ### Description A monadic fold that reduces a stream to a single value using a binary monadic function. It starts the reduction from the first element of the stream. Returns `Maybe a` to handle empty streams. ### Method Monadic Fold ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **Fold m a (Maybe a)** (type) - A fold that reduces a stream to a `Maybe` value. #### Response Example N/A ``` -------------------------------- ### Streamly.Data.MutArray.getIndexUnsafe Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.2.2-0.3.0.txt Unsafely gets a value from a specific index in a mutable array, with Unbox constraint. ```APIDOC ## Streamly.Data.MutArray.getIndexUnsafe ### Description Unsafely gets a value from a specific index in a mutable array. Requires the element type `a` to have an `Unbox` instance. This operation is monadic and does not perform bounds checking. ### Method Monadic Operation ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **m a** (type) - A monadic action that returns the value at the specified index. #### Response Example N/A ``` -------------------------------- ### Compare Benchmark Suites Source: https://github.com/composewell/streamly/blob/master/docs/Developer/Benchmarks.md Run comparison group benchmarks (ending in `_cmp`) to compare all benchmark suites within that group. Use `--targets help` to see available suites. ```bash $ ./bench-runner --targets help $ ./bench-runner --targets array_cmp ``` -------------------------------- ### Streamly.Data.MutArray.unsafeGetIndex Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.2.2-0.3.0.txt Unsafely gets a value from a specific index in a mutable array, with Unbox constraint. ```APIDOC ## Streamly.Data.MutArray.unsafeGetIndex ### Description Unsafely gets a value from a specific index in a mutable array. Requires the element type `a` to have an `Unbox` instance. This operation is monadic and does not perform bounds checking. ### Method Monadic Operation ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **m a** (type) - A monadic action that returns the value at the specified index. #### Response Example N/A ``` -------------------------------- ### Build Project with Development Streamly Version Source: https://github.com/composewell/streamly/blob/master/docs/User/Tutorials/using-streamly.md After creating the `cabal.project` file, run `cabal repl` to fetch and build the development version of `streamly-core`. ```bash $ cabal repl Cloning into '/home/harendra/streamly-project/... ... In order, the following will be built (use -v for more details): - streamly-core-0.1.0 (lib:streamly-core) (requires build) - streamly-project-0.1.0.0 (exe:streamly-project) (configuration changed) ... ghci> ``` -------------------------------- ### Get the context of a data type Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.1.0-0.2.0.txt Retrieves the type context associated with a data type. ```haskell [dtCxt] :: DataType -> Cxt ``` -------------------------------- ### Get the context of a data constructor Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.1.0-0.2.0.txt Retrieves the type context associated with a data constructor. ```haskell [dcCxt] :: DataCon -> Cxt ``` -------------------------------- ### Compare Benchmark Suites Source: https://github.com/composewell/streamly/blob/master/benchmark/README.md Run comparison group benchmarks (ending in `_cmp`) to see comparisons of all benchmark suites within that group. ```bash $ ./bench-runner --targets help $ ./bench-runner --targets array_cmp ``` -------------------------------- ### Streamly.Data.Stream stripPrefix Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.1.0.txt Checks if a stream starts with a given prefix. Requires Monad and Eq constraints. ```APIDOC ## stripPrefix :: (Monad m, Eq a) => Stream m a -> Stream m a -> m (Maybe (Stream m a)) ### Description Checks if the first stream is a prefix of the second stream. If it is, returns Just the remainder of the second stream; otherwise, returns Nothing. ### Method N/A (Function signature) ### Endpoint N/A (Function signature) ### Parameters #### Path Parameters - **Stream m a** (Stream) - Required - The potential prefix stream. - **Stream m a** (Stream) - Required - The stream to check. ### Response #### Success Response - **m (Maybe (Stream m a))** - A monadic value containing Maybe the remaining stream if the prefix matches, or Nothing. ### Request Example N/A (Function signature) ### Response Example N/A (Function signature) ``` -------------------------------- ### Constructing Monadic Streams from IO Actions Source: https://github.com/composewell/streamly/blob/master/docs/User/HowTo/streamly-vs-lists.md Shows how to construct a stream using monadic IO actions like `getLine`. The actions are executed sequentially as the stream is consumed. ```haskell >>> import qualified Streamly.Data.StreamK as StreamK >>> StreamK.toList $ getLine `StreamK.cons` getLine `StreamK.cons` StreamK.nil ``` -------------------------------- ### Build and Run a Single Test Suite using Cabal Source: https://github.com/composewell/streamly/blob/master/docs/Developer/Tests.md Compile and run a specific test suite, such as Prelude.Serial. Using 'cabal test' for a single suite may build all suites first. ```bash $ cabal run test:Prelude.Serial ``` ```bash $ cd test; cabal run Prelude.Serial ``` -------------------------------- ### Streamly.Data.Stream unfold Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.1.0.txt Unfolds a stream from a starting value using an unfold. Requires Applicative constraint. ```APIDOC ## unfold :: Applicative m => Unfold m a b -> a -> Stream m b ### Description Creates a stream by applying an unfold starting from an initial value. ### Method N/A (Function signature) ### Endpoint N/A (Function signature) ### Parameters #### Path Parameters - **Unfold m a b** (Unfold) - Required - The unfold to use. - **a** (starting value) - Required - The initial value for the unfold. ### Response #### Success Response - **Stream m b** - The generated stream. ### Request Example N/A (Function signature) ### Response Example N/A (Function signature) ``` -------------------------------- ### Get the constructors of a data type Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.1.0-0.2.0.txt Retrieves the list of data constructors for a given data type. ```haskell [dtCons] :: DataType -> [DataCon] ``` -------------------------------- ### Initialize Haskell Project with Streamly Dependency Source: https://github.com/composewell/streamly/blob/master/docs/User/Tutorials/using-streamly.md Use `cabal init` to create a new Haskell project with `streamly-core` as a dependency. Ensure `base` is also listed. ```bash $ cd streamly-project $ cabal init --non-interactive --minimal --dependency base --dependency streamly-core ``` -------------------------------- ### deserializePtrN Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.2.2-0.3.0.txt Deserializes a value from a mutable array starting at a given pointer, returning the value and the remaining array. ```APIDOC ## deserializePtrN ### Description Deserializes a value from a mutable array starting at a given pointer, returning the value and the remaining array. ### Method MutArray Word8 -> (Ptr a -> Int -> m b) -> m (a, MutArray Word8) ### Parameters #### Path Parameters - **array** (MutArray Word8) - Required - The mutable array containing serialized data. - **deserializer** (Ptr a -> Int -> m b) - Required - A function to perform the deserialization. ### Response #### Success Response - **m (a, MutArray Word8)** - A monadic action returning the deserialized value and the remaining mutable array. ``` -------------------------------- ### Create and Upload Haddock Documentation Source: https://github.com/composewell/streamly/blob/master/docs/Developer/MAINTAINING.md Generate Haddock documentation for Hackage and upload it. Ensure the documentation is built with the correct flags. ```bash cabal v2-haddock --haddock-for-hackage --enable-doc; cabal upload -d ``` -------------------------------- ### Infinite Stream of Integers Source: https://github.com/composewell/streamly/blob/master/docs/User/Tutorials/streams-as-loops.md Defines an infinite stream of integers starting from 1. Requires importing Streamly.Data.Stream. ```haskell >>> s2 = Stream.enumerateFrom 1 :: Stream IO Int ``` -------------------------------- ### Basic Stream Operations in GHCi Source: https://github.com/composewell/streamly/blob/master/docs/User/Tutorials/using-streamly.md Demonstrates importing Streamly modules and performing basic stream operations like mapping and folding. It shows how to create a stream from a list, print each element, and drain the stream. ```haskell ghci> import qualified Streamly.Data.Stream as Stream ghci> import qualified Streamly.Data.Fold as Fold ghci> Stream.fold Fold.drain $ Stream.mapM print $ Stream.fromList [1..3] 1 2 3 ghci> ``` -------------------------------- ### Create and Push Git Tag for Release Source: https://github.com/composewell/streamly/blob/master/docs/Developer/MAINTAINING.md Create a Git tag for the release in the format P-X.Y.Z (where P is the package name) and push it to the origin. This is essential for version control and release tracking. ```bash git tag P-X.Y.Z && git push -f origin P-X.Y.Z ``` -------------------------------- ### Get type variables of a data type Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.1.0-0.2.0.txt Retrieves the list of type variables associated with a data type. ```haskell [dtTvs] :: DataType -> [Name] ``` -------------------------------- ### Compile Benchmarks with Diagnostics Source: https://github.com/composewell/streamly/blob/master/benchmark/README.md Configure GHC options to dump simplification, suppress all but specific warnings, and enable verbose fusion plugin output for detailed diagnostics. This is done by commenting out other benchmarks and adding OPTIONS_GHC pragmas. ```haskell {-# OPTIONS_GHC -ddump-simpl -ddump-to-file -dsuppress-all -Wmissed-specialisations -Wall-missed-specialisations -fplugin-opt=Fusion.Plugin:verbose=2 -fplugin-opt=Fusion.Plugin:dump-core #-} ``` -------------------------------- ### Get type variables of a data constructor Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.1.0-0.2.0.txt Retrieves the list of type variables associated with a data constructor. ```haskell [dcTvs] :: DataCon -> [Name] ``` -------------------------------- ### Get Contributors Between Tags Source: https://github.com/composewell/streamly/blob/master/docs/User/Project/CONTRIBUTORS.md Use this git command to list contributors between two specific tags in the repository. ```bash git shortlog -sn tag1...tag2 ``` -------------------------------- ### Specify External Input File for FileSystem.Handle Benchmark Source: https://github.com/composewell/streamly/blob/master/benchmark/README.md Set the Benchmark_FileSystem_Handle_InputFile environment variable to specify an input file for the FileSystem.Handle benchmark, useful for testing unicode input. ```bash $ export Benchmark_FileSystem_Handle_InputFile=./gutenberg-500.txt $ cabal run FileSystem.Handle -- FileSystem.Handle/o-1-space/reduce/read/S.splitOnSeq ``` -------------------------------- ### Generate Dependency Graph with Nix Source: https://github.com/composewell/streamly/blob/master/docs/Developer/MAINTAINING.md Generates a PDF of the dependency graph using nix. Remove test and benchmark components from shellFor/packages in default.nix for library-only dependencies. ```bash nix-shell --run "ghc-pkg dot | dot -Tpdf > streamly.pdf" ``` -------------------------------- ### Recommended GHC Compilation Options Source: https://github.com/composewell/streamly/blob/master/docs/User/HowTo/Compiling.md These GHC options are recommended for optimal performance when using the fusion-plugin. Ensure 'fusion-plugin' is added to your cabal file's build-depends. ```text -O2 -fdicts-strict -fmax-worker-args=16 -fspec-constr-recursive=16 -fplugin Fusion.Plugin ``` -------------------------------- ### Get inline deserialization setting Source: https://github.com/composewell/streamly/blob/master/core/docs/ApiChangelogs/0.1.0-0.2.0.txt Retrieves the 'cfgInlineDeserialize' setting from a 'SerializeConfig'. Indicates whether to inline deserialization logic. ```haskell [cfgInlineDeserialize] :: SerializeConfig -> Maybe Inline ```