On Thu, Nov 11, 2010 at 8:16 PM, John Lask <jvl...@hotmail.com> wrote:
> consider "length" ...
>
> I have records with the attribute length, length can be given as an Int,
> Double, Float or maybe as a constructed type "Length", length's use as a
> record selector would also clash with List.length. All these have the same
> denotation.
>
> should I then seporate into int_length, float_length, or use rec1_length,
> rec2_length etc etc...

class Lengthy a where
  type LengthType a
  length :: a -> LengthType a

This extends easily to lenses if you want setters.

> This is easily handled in C, Pascal, PL/1, Cobol why not in Haskell ?

By this argument, Haskell should provide global mutable state and
allow side-effects universally.

-- 
Dave Menendez <d...@zednenem.com>
<http://www.eyrie.org/~zednenem/>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to