bytestring Questions

1

Solved

I have a Haskell program that generates ~280M of logging text data during a run inside the ST monad. This is where virtually all memory consumption goes (with logging disabled the program allocates...
Prentiss asked 15/8, 2013 at 8:55

2

Solved

Learn You a Haskell has a code example like this: ghci> B.pack [99,97,110] Chunk "can" Empty (B stands for Data.ByteString.Lazy) But my ghci does not show Chunk and Empty data constructors...
Corridor asked 25/6, 2013 at 19:26

2

Solved

I need to make extensive use of: slice :: Int -> Int -> ByteString -> ByteString slice start len = take len . drop start Two part question: Does this already have a name? I can't find...
Unseasoned asked 31/5, 2013 at 3:47

2

Solved

My understanding is that ByteStrings are just lists of vectors of Word8s. This packaging gives better memory and speed performance on binary streams. Similarly, the Text type boosts performance on ...
Bolide asked 30/5, 2013 at 4:45

2

Solved

I am currently trying to use the Full CSV Parser presented in Real World Haskell. In order to I tried to modify the code to use ByteString instead of String, but there is a string combinator which ...
Strader asked 16/3, 2013 at 21:49

2

Solved

I've been trying to solve problem 1330 from acm.timus.ru in Haskell. Basically, it boils down to this: 1) read from stdin an array A of length N (N < 10^4) and M pairs of integers (M < 10^5);...
Plastometer asked 27/1, 2013 at 2:20

3

Solved

I need to read a binary format in Haskell. The format is fairly simple: four octets indicating the length of the data, followed by the data. The four octets represent an integer in network byte-ord...
Equisetum asked 15/1, 2013 at 10:29

1

Solved

So I want to access the individual bytes of the UTF-8 encoding of a string. I tried using Data.ByteString.Char8.pack, but that seems to just truncate it to the last byte of each character: ghci&g...
Silva asked 26/12, 2012 at 22:44

2

I have the following Haskell type definition: import Data.Sequence(Seq, length) import Data.ByteString.UTF8(ByteString) type StringSeq = Seq ByteString I have expressions of type StringSeq for ...
Ie asked 19/12, 2012 at 23:44

1

Solved

Consider the following simple code: import Crypto.Hash.SHA1 (hashlazy) import qualified Data.ByteString as BS main = return () I installed cabal install --global bytestring and then I obtain (on...
Brainard asked 6/11, 2012 at 19:46

4

Solved

I'm writing a function that does some searching in a sequence of arbitrary symbols. I'd like to make it generic enough so that it works on lists, Foldables as well on ByteStrings and Texts. General...
Achromat asked 12/10, 2012 at 11:0

1

I think HXT, a XML/HTML processing library in Haskell, has really flexible and powerful methods for traversing and manipulating DOM trees by Arrows. http://adit.io/posts/2012-04-14-working_with_HTM...
Homerus asked 8/7, 2012 at 9:51

3

Solved

I wish to compress my application's network traffic. According to the (latest?) "Haskell Popularity Rankings", zlib seems to be a pretty popular solution. zlib's interface uses ByteStrings: comp...
Yourself asked 20/9, 2009 at 19:10

3

Solved

I needed to be able to give the hex representation of a SHA512 hash. Maybe I just didn't look hard enough, but I could find any functions on Hackage to do it. So I wrote an implementation using unf...
Woadwaxen asked 11/4, 2012 at 4:43

2

Solved

I have to parse a file, and indeed a have to read it first, here is my program : import qualified Data.ByteString.Char8 as B import System.Environment main = do args <- getArgs let path = ...
Bosson asked 4/4, 2012 at 13:28

1

Solved

I want to write a simple function which splits a ByteString into [ByteString] using '\n' as the delimiter. My attempt: import Data.ByteString listize :: ByteString -> [ByteString] listize xs =...
Oxidation asked 23/1, 2012 at 1:47

1

Solved

Can anyone explain the pros and cons to using Data.Textand Data.ByteString.Char8 data types? Does working with ASCII-only text change these pros and cons? Do their lazy variants change the story as...
Betz asked 18/1, 2012 at 19:28

2

Solved

I always run into the following error when trying to read a ByteString: Prelude.read: no parse Here's a sample of code that will cause this error to occur upon rendering in a browser: factSplice...
Almagest asked 16/1, 2012 at 23:25

1

Solved

Since a ByteString is a constructor with ForeignPtr: data ByteString = PS {-# UNPACK #-} !(ForeignPtr Word8) -- payload {-# UNPACK #-} !Int                -- offset {-# UNPACK #-} !Int          ...
Hildahildagard asked 23/12, 2011 at 13:52

3

Solved

I wrote a function to convert 64-bit Double to ByteString (architecture/type safety is not really an issue - let us assume for now that the Double is 64-bit Word). While the function below works we...
Lynnelle asked 2/12, 2011 at 1:50

2

Solved

I am learing Haskell Lazy IO. I am looking for an elegant way to copy a large file (8Gb) while printing copy progress to console. Consider the following simple program that copies a file silently...
Exophthalmos asked 12/7, 2011 at 17:51

3

Solved

As part of a school project I'm implementing some crypthographic algorithms in Haskell. As you probably know this involves quite a lot of low level bit fiddling. Now I am stuck on one particular su...
Blandish asked 4/9, 2011 at 0:34

1

Solved

I need to decode ByteStrings from various encodings into Text, but the ByteStrings might be incomplete fragments. Ideally, I would need a function with signature of something like: decodeFragment ...
Kibe asked 22/7, 2011 at 6:17

1

Solved

I'm trying to understand how to use the iteratee library with Haskell. All of the articles I've seen so far seem to focus on building an intuition for how iteratees could be built, which is helpful...
Microphyte asked 10/7, 2011 at 20:35

3

Solved

I've managed to use Parsec to parse a String, but cannot manage to do the same with a ByteString. How can I make Parsec work with ByteStrings without manually converting them to Strings? I get th...
Hunk asked 19/1, 2010 at 1:9

© 2022 - 2024 — McMap. All rights reserved.