<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello everyone! I'm trying to understand base idea of Haskell
modules architecture. In other languages, "reading from file" is
placed in something like "io", "istream", "file", etc modules. Also
most languages have a concept of reading from abstract bytes
streams. You read bytes from something and translate them into your
high level object/type/etc.<br>
<br>
In Haskell I see that, for example, function <b>hGetContents</b>
exists inĀ (this is my local installation):
<ul>
<li>GHC.IO.Handle</li>
<li>System.IO<br>
</li>
<li>Data.ByteString</li>
<li>Data.ByteString.Char8</li>
<li>Data.ByteString.Lazy</li>
<li>Data.ByteString.Lazy.Char8</li>
<li>Data.Text.IO</li>
<li>Data.Text.Lazy.IO</li>
<li>System.IO.Strict</li>
<li>Text.Pandoc.UTF8</li>
<li>Data.ListLike</li>
<li>Data.ListLike.IO</li>
<li>ClassyPrelude</li>
<li>Hledger.Utils.UTF8IOCompat</li>
<li>Data.IOData</li>
<li>Darcs.Util.Ratified</li>
<li>Sound.File.Sndfile</li>
<li>Sound.File.Sndfile.Buffer</li>
<li>Data.String.Class</li>
<li>Network.BufferType</li>
</ul>
If I'll create module SuperMegaShapes with some Triangle, Rectangle,
Square and other things, I'll create (to be consistent with
Haskell-way)... hGetContents there??!<br>
<br>
So, I have 2 questions here:<br>
<br>
First one: let's imagine that we have Haskell compiler for embedded.
And I want to read Text, ByteString, Sndfile and SuperMegaShapes
from... SPI. There are many devices andprotocols, right? And I have
not FILE HADNLER for most of them. So, this mean that Haskell (like
simple script language) supports only concept of FILE HANDLER
reading?! And no other ABSTRACTIONS?<br>
<br>
Second question is: must any new type which we plan to read/write to
have hGetContents? What if it is packed in some tricky container?
Matreshka? Something else, more tricky? :) And more: what other I/O
functions must be injected in our model definitions modules?<br>
<br>
<br>
===<br>
Best regards<br>
</body>
</html>