I'm trying to write some true type library (implementing only the tables
I need at the moment).
When loading a font file it doesn't make sense to "parse" every table
which isn't needed. So lazyness of haskell would perfectly meet
My problem: NewBinary supports memory buffers. After loading a file to
mem it can't change anymore so I no longer need an IO monad.
It looks like this:
bh <- readBinMem "file"
b::Word8 <- get bh
Of cause I can't remove the monad here because bh contains an internal
pointer to the current position... but it might be done returning the
(bh2,b::Word8) = get bh ?
Then I would be able to lazily parse the tables eg:
getTable1 bh = do
bh = seek bh offset -- seek to the beginning of the table
get binary data and build internal representation
return list of glyph and outlines and ...
of cause this mem should be readonly then..
Would it make sense to implement this? Does it already exist?
On Sat, May 06, 2006 at 12:39:46AM +0200, Marc Weber wrote:
> > just add unsafePerformIO:
> great idea!
> In my case I can also use unsafeInterleaveIO or lazyness, can't I?
Of cause I can't. unsafePerformIO is of type IO a -> IO a.