Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. hGetContents and modules architecture idea (PY) ---------------------------------------------------------------------- Message: 1 Date: Fri, 5 May 2017 12:31:42 +0300 From: PY <aqua...@gmail.com> To: beginners@haskell.org Subject: [Haskell-beginners] hGetContents and modules architecture idea Message-ID: <4fb2cb71-d68d-7d93-ce1b-09dc69fac...@gmail.com> Content-Type: text/plain; charset="utf-8"; Format="flowed" 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. In Haskell I see that, for example, function *hGetContents* exists in (this is my local installation): * GHC.IO.Handle * System.IO * Data.ByteString * Data.ByteString.Char8 * Data.ByteString.Lazy * Data.ByteString.Lazy.Char8 * Data.Text.IO * Data.Text.Lazy.IO * System.IO.Strict * Text.Pandoc.UTF8 * Data.ListLike * Data.ListLike.IO * ClassyPrelude * Hledger.Utils.UTF8IOCompat * Data.IOData * Darcs.Util.Ratified * Sound.File.Sndfile * Sound.File.Sndfile.Buffer * Data.String.Class * Network.BufferType 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??! So, I have 2 questions here: 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? 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? === Best regards -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20170505/d5de09de/attachment-0001.html> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 107, Issue 2 *****************************************