|
Re: Streams internal structure: msg#00118lang.haskell.libraries
Hi Bulat, Bulat Ziganshin wrote: well, your last answer shows that you don't understand my problems. Ok, I think you need to describe these problems in more detail. The message you just wrote describes the structure of the library which I think is mostly fine, and corresponds fairly well with what I had in mind. http://freearc.narod.ru/Binary_20060329184510.rar) Could you provide a .zip or .tar.gz instead? currently, Stream lib includes class Streams, what includes fine, that's closely equivalent to my InputStream/OutputStream. it's a natural class for low-level, "raw" streams such as FD or vPutBuf should be non-blocking too. MemoryStream class supports low-level, "raw" streams whose data are which is equivalent to my MemInputStream/MemOutputStream. I believe the with-style interface that I use is better though. data ReadWrite = READING | WRITING | UNKNOWN deriving (Eq, Show) I didn't have an equivalent to this class in my design. Why is it necessary? vGetByte/vPutByte can be implemented for an arbitrary BlockStream or indeed a MemoryStream. instance (BlockStream IO h) => ByteStream IO (BufferedBlockStream h) BufferedBlockStream == my BufferedInputStream/BufferedOutputStream instance (MemoryStream IO h) => ByteStream IO (BufferedMemoryStream h) what's a BufferedMemoryStream for? Isn't a memory stream already buffered by definition? instance (MemoryStream IO h) => ByteStream IO (UncheckedBufferedMemoryStream h)> These data type constructors (BufferedBlockStream...) joins raw stream Ok, I wouldn't put all those method in the class, I think. Also it is necessary to have buffering at the TextStream level, as Marcin pointed out. I haven't thought through the design carefully here. Encoding transformer attaches encoding to the ByteStream that allows yes where type "CharEncoding m" provides vGetByte->vGetChar and vPutByte->vPutChar So what are the problems you were referring to? eg. this from your previous message: > 2) separation of Stream classes make some automatic definitions > impossible. for example, released version contains vGetBuf > implementation that is defined via vGetChar and works ok for streams > that provide only vGetChar as base function. and i will be glad to add BufferedStream and SeekableStream classes which implementation issues? Cheers, Simon |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | FPS, ForeignPtr and GHC 6.6: 00118, Donald Bruce Stewart |
|---|---|
| Next by Date: | Re: FPS 0.3: 00118, Simon Marlow |
| Previous by Thread: | Streams internal structurei: 00118, Bulat Ziganshin |
| Next by Thread: | Re[2]: Streams internal structure: 00118, Bulat Ziganshin |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |