[Haskell-cafe] Type inference problem with division (/)

Henning Thielemann lemming at henning-thielemann.de
Wed Oct 31 18:24:35 EDT 2007


On Tue, 30 Oct 2007, noa wrote:

> I have the following function:
>
> theRemainder :: [String] -> [String] -> Double
> theRemainder xs xt = sum( map additional (unique xs) )
> 	where
> 	additional x = poccur * (inf [ppos,pneg]) --inf takes [Double]
> 		where
> 		xsxt = zip xs xt
> 		pi = countPos xr -- countPos returns an Int
> 		ni = (length xr) - pi
> 		len = length xs

-> genericLength

> 		len2 = length xr
> 		ppos = pi/len2 -- THESE ARE THE PROBLEM
> 		pneg = ni/len2 -- THESE ARE THE PROBLEM
> 		poccur = (pi+ni)/len
> 		xr = (filter ((\y -> (fst y)==x)) (xsxt))


More information about the Haskell-Cafe mailing list