On 2009 Mar 28, at 22:36, michael rice wrote:
import Data.Ratio
cf :: [Integer] -> Rational
cf (x:xs) = (toRational x) + (1 % (cf xs))
cf (x:[]) = toRational x
cf [] = toRational 0

Data.Ratio> :load cf.hs
ERROR "cf.hs":3 - Type error in application
*** Expression     : toRational x + 1 % cf xs
*** Term           : toRational x
*** Type           : Ratio Integer
*** Does not match : Ratio (Ratio Integer)

Your function cf produces a Rational (Ratio Int); you're using it in the denominator of another Ratio, which makes that Ratio's type Ratio (Ratio Int).  This is almost certainly not what you intended, but I couldn't say what you actually want.

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH