[Haskell-cafe] Trouble with types

Jon Fairbairn Jon.Fairbairn at cl.cam.ac.uk
Fri Jul 23 12:24:11 EDT 2004


On 2004-07-23 at 19:18+0300 Kari Pahula wrote:
> temp :: (Real a) => Object (Energy a) (HeatC a) -> Temp a
> temp Object (Energy e) (HeatC c) = Temp e*c
> 
> But this fails in hugs with:
> ERROR "temp.hs":22 - Constructor "Object" must have exactly 2 arguments in pattern

You've given temp three arguments: Object, (Energy e) and (HeatC c).

You meant:

> temp (Object (Energy e) (HeatC c)) = Temp e*c

HTH

-- 
Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk




More information about the Haskell-Cafe mailing list