
I told you where to look at code. It's C code, mind you, but written
in a decent way.
No well written device driver ever accesses memory or IO ports
directly, doing so would seriously hamper portability.
Instead you use an abstraction layer to access to hardware, and the
driver gets passed a "bus" (whatever that might be) access token (akin
to a capability).
I know you're not going to be convinced, so I won't even try. :)
-- Lennart
On Tue, Aug 26, 2008 at 9:47 PM, Adrian Hey
Lennart Augustsson wrote:
Making a network stack from peek and poke is easy in a well structured OS. The boot loader (or whatever) hands you the capability (call it something else if you want) to do raw hardware access, and you build from there. If you look at well structured OSs like NetBSD, this is pretty much how they work. No hardware drivers use global variables.
So? We all know this is possible outside Haskell. But I don't want to rely on mysterious black box OS's to "hand me the capability" any more than I want to rely on mysterious extant but unimplementable libs like Data.Unique. Most real world computing infrastructure uses no OS at all. How could I use Haskell to implement such systems?
Also (to mis-quote Linus Torvalds) could you or anyone else who agrees with you please SHOW ME THE CODE in *Haskell*! If scripture is all that's on offer I'm just not going to take any of you seriously.
Frankly I'm tired of the patronising lectures that always acompany these threads. It'd be good if someone who "knows" global variables are evil could put their code where their mouth is for a change. Fixing up the base libs to eliminate the dozen or so uses of the "unsafePerformIO hack" might be a good place to start. I'll even let you change the API of these libs if you must, provided you can give a sensible explanation why the revised API is better, safer, more convenient or whatever.
Regards -- Adrian Hey
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe