Patrick Browne schrieb: > On 30/01/2011 19:43, Henning Thielemann wrote: >> I do not see a constant 1 that is equated with a type. >> > This is due to my misunderstanding of Haskell. > After your comments my understanding of the unit function is as follows: > > 1) In the instance below the argument for unit must have type > LengthInMetres > >>> instance MetricDescription LengthInMetres Metre where >>>> valueInUnit (LengthInMetres d) = d >>>> unit l = Metre > > > 2) The constant 1 on the LHS can be replaced _ because it is the fact > that unit is defined in this instance the determines the return value.
Btw. the parameter of 'unit' is a lower-case "L" not a One. > 3) The RHS is not a type but a constructor. right _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
