On Tue, Jun 1, 2010 at 10:30 AM, Gery Debongnie
<gery.debong...@gmail.com> wrote:
> 3. Perform a reading of the font metrics file in the main program, put
> the results into some FontMetrics object, and give that to stringWidth
> :: FontMetrics -> Font -> String -> Double.  Pros : allow me to avoid
> problems of solution 1 and 2, cons : it doesn't sound right for the
> main program to have to do this, it should be confined into a Font
> module.

Ultimately all your IO is driven from main, so don't be afraid to add
more IO dependencies to it. You can let IO "infect" a module for
dealing with font files (e.g. a FontMetrics module with a function
getMetrics :: [String] -> Map String Double), then drive that module
from main and feed its results into your pure code.

Anthony
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to