[Haskell-cafe] New-bee question about seq in Parsec.Pos

Christoph Bauer ich at christoph-bauer.net
Sun Jul 3 04:08:33 EDT 2005


Hi,

I try to understand, how Parsec works. In Pos.hs I found
these definition of SourcePos:

data SourcePos      = SourcePos SourceName !Line !Column
		     deriving (Eq,Ord)

My poor haskell knowledge says me, that Line and Column is
always strict. So, what does the following function?

forcePos :: SourcePos -> SourcePos      
forcePos pos@(SourcePos name line column)
    = seq line (seq column (pos))

thanks for an enlightenment,
Christoph Bauer

-- 
let () = let rec f a w i j = Printf.printf "%.20f\r" a; let a1 = a *. i /. j in
if w then f a1 false (i +. 2.0) j else f a1 true i (j +. 2.0) in f 2.0 false 2.0 1.0




More information about the Haskell-Cafe mailing list