[Haskell-cafe] design question/font metrics
Anthony Cowley
acowley at seas.upenn.edu
Tue Jun 1 10:46:59 EDT 2010
On Tue, Jun 1, 2010 at 10:30 AM, Gery Debongnie
<gery.debongnie at 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
More information about the Haskell-Cafe
mailing list